- Add API endpoints for managing group pre-registrations, including approval and rejection. - Create database migration for `group_pre_registrations` table and associated enum for status. - Implement use cases for listing, approving, and rejecting pre-registrations. - Add frontend components for displaying pre-registration details and managing approvals/rejections. - Update shared schemas to include pre-registration data structures and validation. - Remove obsolete `WaitlistNoticeCard` component and replace with `PreRegistrationNoticeCard`.
55 lines
2.0 KiB
TypeScript
55 lines
2.0 KiB
TypeScript
import { z } from 'zod';
|
|
import { AttendeeDtoSchema } from './attendees.js';
|
|
import { createPageSchema, createPageSizeSchema, createPaginationSchema } from './pagination.js';
|
|
import { GroupWaitlistEntryDtoSchema } from './waitlist.js';
|
|
|
|
const isoDateTimeSchema = z.string().datetime();
|
|
const pageSchema = createPageSchema();
|
|
const pageSizeSchema = createPageSizeSchema(10);
|
|
const paginationSchema = createPaginationSchema();
|
|
|
|
export const preRegistrationStatusSchema = z.enum(['PENDING', 'APPROVED', 'REJECTED']);
|
|
export type PreRegistrationStatus = z.output<typeof preRegistrationStatusSchema>;
|
|
|
|
export const GroupPreRegistrationDtoSchema = z.object({
|
|
id: z.string(),
|
|
groupId: z.string(),
|
|
fullName: z.string(),
|
|
phone: z.string(),
|
|
email: z.string().nullable(),
|
|
status: preRegistrationStatusSchema,
|
|
reviewedAt: isoDateTimeSchema.nullable(),
|
|
createdAt: isoDateTimeSchema,
|
|
updatedAt: isoDateTimeSchema,
|
|
});
|
|
export type GroupPreRegistrationDto = z.output<typeof GroupPreRegistrationDtoSchema>;
|
|
|
|
export const GroupPreRegistrationQuerySchema = z.object({
|
|
page: pageSchema,
|
|
pageSize: pageSizeSchema,
|
|
status: preRegistrationStatusSchema.optional(),
|
|
});
|
|
export type GroupPreRegistrationQuery = z.output<typeof GroupPreRegistrationQuerySchema>;
|
|
|
|
export const GroupPreRegistrationListSchema = z.object({
|
|
data: z.array(GroupPreRegistrationDtoSchema),
|
|
pagination: paginationSchema,
|
|
});
|
|
export type GroupPreRegistrationList = z.output<typeof GroupPreRegistrationListSchema>;
|
|
|
|
export const ApproveGroupPreRegistrationResultSchema = z.object({
|
|
outcome: z.enum(['added', 'waitlisted']),
|
|
attendee: AttendeeDtoSchema.nullable(),
|
|
waitlistEntry: GroupWaitlistEntryDtoSchema.nullable(),
|
|
});
|
|
export type ApproveGroupPreRegistrationResult = z.output<
|
|
typeof ApproveGroupPreRegistrationResultSchema
|
|
>;
|
|
|
|
export const RejectGroupPreRegistrationResultSchema = z.object({
|
|
entry: GroupPreRegistrationDtoSchema,
|
|
});
|
|
export type RejectGroupPreRegistrationResult = z.output<
|
|
typeof RejectGroupPreRegistrationResultSchema
|
|
>;
|