Initial attendee management
This commit is contained in:
@@ -23,6 +23,7 @@ export type AttendeeDto = z.output<typeof AttendeeDtoSchema>;
|
||||
export const AttendeeQuerySchema = z.object({
|
||||
page: pageSchema,
|
||||
pageSize: pageSizeSchema,
|
||||
groupId: z.string().optional(),
|
||||
});
|
||||
export type AttendeeQuery = z.output<typeof AttendeeQuerySchema>;
|
||||
|
||||
@@ -30,4 +31,46 @@ export const AttendeeListSchema = z.object({
|
||||
data: z.array(AttendeeDtoSchema),
|
||||
pagination: paginationSchema,
|
||||
});
|
||||
export type AttendeeList = z.output<typeof AttendeeListSchema>;
|
||||
export type AttendeeList = z.output<typeof AttendeeListSchema>;
|
||||
|
||||
export const CreateAttendeeSchema = z.object({
|
||||
firstName: z.string().trim().min(1, 'El nombre es obligatorio'),
|
||||
lastName: z.string().trim().optional().default(''),
|
||||
phone: z.string().trim().min(6, 'Ingresa un número de teléfono válido'),
|
||||
email: z.string().trim().email('Email inválido').optional().or(z.literal('')),
|
||||
notes: z.string().trim().optional(),
|
||||
});
|
||||
export type CreateAttendee = z.output<typeof CreateAttendeeSchema>;
|
||||
|
||||
export const JoinGroupViaInviteSchema = z.object({
|
||||
firstName: z.string().trim().min(1, 'El nombre es obligatorio'),
|
||||
lastName: z.string().trim().min(1, 'El apellido es obligatorio'),
|
||||
phone: z.string().trim().min(6, 'Ingresa un número de teléfono válido'),
|
||||
email: z.string().trim().email('Email inválido').optional().or(z.literal('')),
|
||||
});
|
||||
export type JoinGroupViaInvite = z.output<typeof JoinGroupViaInviteSchema>;
|
||||
|
||||
export const BulkAttendeeItemSchema = z.object({
|
||||
firstName: z.string().trim().min(1, 'El nombre es obligatorio'),
|
||||
lastName: z.string().trim().optional().default(''),
|
||||
fullName: z.string().trim().optional(),
|
||||
phone: z.string().trim().min(6, 'Ingresa un número de teléfono válido'),
|
||||
email: z.string().trim().email('Email inválido').optional().or(z.literal('')),
|
||||
notes: z.string().trim().optional(),
|
||||
});
|
||||
export type BulkAttendeeItem = z.output<typeof BulkAttendeeItemSchema>;
|
||||
|
||||
export const BulkCreateAttendeesSchema = z.object({
|
||||
attendees: z.array(BulkAttendeeItemSchema).min(1, 'Debes enviar al menos un alumno'),
|
||||
});
|
||||
export type BulkCreateAttendees = z.output<typeof BulkCreateAttendeesSchema>;
|
||||
|
||||
export const BulkCreateAttendeesResultSchema = z.object({
|
||||
totalProcessed: z.number().int(),
|
||||
createdCount: z.number().int(),
|
||||
duplicatesCount: z.number().int(),
|
||||
invalidCount: z.number().int(),
|
||||
message: z.string(),
|
||||
created: z.array(AttendeeDtoSchema),
|
||||
});
|
||||
export type BulkCreateAttendeesResult = z.output<typeof BulkCreateAttendeesResultSchema>;
|
||||
@@ -21,9 +21,29 @@ export const GroupDtoSchema = z.object({
|
||||
price: z.number().min(0).nullable(),
|
||||
billingType: billingTypeSchema.nullable(),
|
||||
dueDay: z.number().int().min(1).max(28).nullable(),
|
||||
inviteToken: z.string().nullable().optional(),
|
||||
});
|
||||
export type GroupDto = z.output<typeof GroupDtoSchema>;
|
||||
|
||||
export const GroupInviteInfoDtoSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
description: z.string().nullable(),
|
||||
teacherName: z.string(),
|
||||
days: z.array(weekdaySchema).nullable(),
|
||||
time: z.string().nullable(),
|
||||
capacity: z.number().int().nullable(),
|
||||
price: z.number().nullable(),
|
||||
billingType: billingTypeSchema.nullable(),
|
||||
});
|
||||
export type GroupInviteInfoDto = z.output<typeof GroupInviteInfoDtoSchema>;
|
||||
|
||||
export const InviteTokenResultSchema = z.object({
|
||||
token: z.string(),
|
||||
inviteUrl: z.string(),
|
||||
});
|
||||
export type InviteTokenResult = z.output<typeof InviteTokenResultSchema>;
|
||||
|
||||
export const GroupQuerySchema = z.object({
|
||||
page: pageSchema,
|
||||
pageSize: pageSizeSchema,
|
||||
|
||||
Reference in New Issue
Block a user