feat: add customer email functionality for booking confirmations
- Implemented email confirmation for admin and public bookings. - Added customerEmail field to booking schemas and services. - Created email templates for booking confirmation, cancellation, and no-show notifications. - Updated booking handlers to send emails upon booking creation and status updates. - Enhanced frontend forms to capture customer email during booking creation.
This commit is contained in:
@@ -25,6 +25,8 @@ export const adminBookingSchema = z.object({
|
||||
endTime: z.string().regex(TIME_REGEX),
|
||||
customerName: z.string(),
|
||||
customerPhone: z.string(),
|
||||
customerEmail: z.string().optional(),
|
||||
price: z.number().nonnegative(),
|
||||
status: bookingStatusSchema,
|
||||
createdAt: z.string().datetime(),
|
||||
updatedAt: z.string().datetime(),
|
||||
@@ -52,6 +54,11 @@ export const createAdminBookingSchema = z.object({
|
||||
.trim()
|
||||
.min(6, 'El telefono debe tener al menos 6 caracteres.')
|
||||
.max(30, 'El telefono no puede superar los 30 caracteres.'),
|
||||
customerEmail: z
|
||||
.string()
|
||||
.email('El email ingresado no es valido.')
|
||||
.optional()
|
||||
.or(z.literal('')),
|
||||
})
|
||||
|
||||
export const updateAdminBookingStatusSchema = z.object({
|
||||
|
||||
@@ -57,6 +57,11 @@ export const createPublicBookingSchema = z.object({
|
||||
.trim()
|
||||
.min(6, 'El telefono debe tener al menos 6 caracteres.')
|
||||
.max(30, 'El telefono no puede superar los 30 caracteres.'),
|
||||
customerEmail: z
|
||||
.string()
|
||||
.email('El email ingresado no es valido.')
|
||||
.optional()
|
||||
.or(z.literal('')),
|
||||
})
|
||||
|
||||
export const publicBookingSchema = z.object({
|
||||
@@ -73,7 +78,9 @@ export const publicBookingSchema = z.object({
|
||||
endTime: z.string().regex(TIME_REGEX),
|
||||
customerName: z.string(),
|
||||
customerPhone: z.string(),
|
||||
customerEmail: z.string().optional(),
|
||||
status: z.enum(['CONFIRMED', 'CANCELLED', 'COMPLETED']),
|
||||
price: z.number().nonnegative(),
|
||||
createdAt: z.string().datetime(),
|
||||
})
|
||||
|
||||
@@ -89,6 +96,7 @@ export const publicBookingConfirmationSchema = z.object({
|
||||
courtName: z.string(),
|
||||
sport: publicBookingSportSchema,
|
||||
status: z.enum(['CONFIRMED', 'CANCELLED', 'COMPLETED']),
|
||||
customerEmail: z.string().optional(),
|
||||
createdAt: z.string().datetime(),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user