Add lessons Phase 2: schedule slots with conflict detection

Recurring weekly time slots linking instructors to lesson types.
Includes day/time overlap detection, instructor and day-of-week
filtering, and 17 new integration tests (40 total lessons tests).
This commit is contained in:
Ryan Moon
2026-03-30 09:20:03 -05:00
parent 5dbe837c08
commit f777ce5184
8 changed files with 513 additions and 3 deletions

View File

@@ -106,10 +106,14 @@ export {
InstructorUpdateSchema,
LessonTypeCreateSchema,
LessonTypeUpdateSchema,
ScheduleSlotCreateSchema,
ScheduleSlotUpdateSchema,
} from './lessons.schema.js'
export type {
InstructorCreateInput,
InstructorUpdateInput,
LessonTypeCreateInput,
LessonTypeUpdateInput,
ScheduleSlotCreateInput,
ScheduleSlotUpdateInput,
} from './lessons.schema.js'

View File

@@ -36,3 +36,18 @@ export type LessonTypeCreateInput = z.infer<typeof LessonTypeCreateSchema>
export const LessonTypeUpdateSchema = LessonTypeCreateSchema.partial()
export type LessonTypeUpdateInput = z.infer<typeof LessonTypeUpdateSchema>
// --- Schedule Slot schemas ---
export const ScheduleSlotCreateSchema = z.object({
instructorId: z.string().uuid(),
lessonTypeId: z.string().uuid(),
dayOfWeek: z.coerce.number().int().min(0).max(6),
startTime: z.string().regex(/^\d{2}:\d{2}$/, 'Must be HH:MM format'),
room: opt(z.string().max(100)),
maxStudents: z.coerce.number().int().min(1).default(1),
})
export type ScheduleSlotCreateInput = z.infer<typeof ScheduleSlotCreateSchema>
export const ScheduleSlotUpdateSchema = ScheduleSlotCreateSchema.partial()
export type ScheduleSlotUpdateInput = z.infer<typeof ScheduleSlotUpdateSchema>