feat: implement group pre-registration feature with approval and rejection workflows

- 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`.
This commit is contained in:
Jose Selesan
2026-09-29 15:25:24 -03:00
parent 0f02331dfc
commit 45a1f50231
32 changed files with 1335 additions and 165 deletions

View File

@@ -0,0 +1,54 @@
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
>;