Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 34df975

Browse files
committed
feat: add timetable schema
1 parent a9c8930 commit 34df975

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

apps/client/src/services/sbhsApi/schemas.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -338,30 +338,30 @@ const timetableSchema = z.object({
338338
),
339339
subjects: z.record(
340340
z.object({
341-
title: "8 Maths 1", // title of the class
342-
shortTitle: "Ma1", // corresponds to period.title
343-
subject: "Mathematics", // full name of the subject
344-
teacher: "DW", // teacher code for the class teacher
345-
fullTeacher: "Mr R Dow", // full name of the teacher
346-
year: "8", // year for the class (Note [1])
341+
title: z.string(), // title of the class
342+
shortTitle: z.string(), // corresponds to period.title
343+
subject: z.string(), // full name of the subject
344+
teacher: z.string(), // teacher code for the class teacher
345+
fullTeacher: z.string(), // full name of the teacher
346+
year: z.coerce.string(), // year for the class (Note [1])
347347
})
348348
),
349-
extraSubjects: {
350-
// collection of extra subjects
351-
"1": {
349+
extraSubjects: z.record(
350+
z.object({
352351
// these subjects have no timetable classes
353-
title: "Student Advis", // title of the class
354-
shortTitle: "SA7", // corresponds to period.title
355-
teacher: "DW", // teacher code for the class teacher
356-
fullTeacher: "Mr R Dow", // full name of the teacher
357-
},
358-
},
359-
rollcall: {
352+
title: z.string(), // title of the class
353+
shortTitle: z.string(), // corresponds to period.title
354+
teacher: z.string(), // teacher code for the class teacher
355+
fullTeacher: z.string(), // full name of the teacher
356+
})
357+
),
358+
359+
rollcall: z.object({
360360
// roll class details
361-
title: "08M", // title of the class
362-
teacher: "DW", // teacher code for the teacher
363-
fullTeacher: "Mr R Dow", // full name of the teacher
364-
room: " ", // roll class room
365-
},
366-
advisor: "Mr R Dowdell", // year adviser
361+
title: z.string(), // title of the class
362+
teacher: z.string(), // teacher code for the teacher
363+
fullTeacher: z.string(), // full name of the teacher
364+
room: z.string().nullish(), // roll class room
365+
}),
366+
advisor: z.string(), // year adviser
367367
});

0 commit comments

Comments
 (0)