- Replace Bun with pnpm 9 + Turborepo + tsx; apps/api renamed to apps/backend - Split backend into http/, modules/, lib/ layers mirroring tai-specguard - Add use-case + Result pattern, Problem Details RFC 7807, basePath /api/v1 - Mount Better Auth at /api/v1/auth, keep session-auth whitelist - Split Prisma schema into prisma/models/*, generate into generated/ - Rework packages/shared into lib/ + schemas/ with pagination DTOs - Implement health, groups, students, payments, waitlist modules - Add vitest suite with prisma mocks (21 tests), biome lint - Point web client to /api/v1/auth and /api/v1/groups/from-organization
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { z } from 'zod';
|
|
import { createPageSchema, createPageSizeSchema, createPaginationSchema } from './pagination.js';
|
|
|
|
const isoDateTimeSchema = z.string().datetime();
|
|
const pageSchema = createPageSchema();
|
|
const pageSizeSchema = createPageSizeSchema(10);
|
|
const paginationSchema = createPaginationSchema();
|
|
|
|
export const StudentDtoSchema = z.object({
|
|
id: z.string(),
|
|
groupId: z.string(),
|
|
fullName: z.string(),
|
|
email: z.string().nullable(),
|
|
phone: z.string().nullable(),
|
|
guardianName: z.string().nullable(),
|
|
guardianPhone: z.string().nullable(),
|
|
notes: z.string().nullable(),
|
|
createdAt: isoDateTimeSchema,
|
|
updatedAt: isoDateTimeSchema,
|
|
});
|
|
export type StudentDto = z.output<typeof StudentDtoSchema>;
|
|
|
|
export const StudentQuerySchema = z.object({
|
|
page: pageSchema,
|
|
pageSize: pageSizeSchema,
|
|
});
|
|
export type StudentQuery = z.output<typeof StudentQuerySchema>;
|
|
|
|
export const StudentListSchema = z.object({
|
|
data: z.array(StudentDtoSchema),
|
|
pagination: paginationSchema,
|
|
});
|
|
export type StudentList = z.output<typeof StudentListSchema>; |