@@ -301,15 +301,15 @@ export const daySchema = z.record(
301301 } )
302302) ;
303303
304- const timetableSchema = z . object ( {
304+ export const timetableSchema = z . object ( {
305305 student : z . object ( {
306306 surname : z . string ( ) ,
307307 givenname : z . string ( ) ,
308- sex : z . string ( ) , // "M"/"B" for male
309- DOB : z . string ( ) , // date of birth. Unix timestamp
310- roll : z . coerce . number ( ) , // index of roll class
311- lines : z . record ( z . coerce . number ( ) ) ,
312- extraLines : z . record ( z . coerce . number ( ) ) ,
308+ sex : z . string ( ) . nullish ( ) , // "M"/"B" for male
309+ DOB : z . string ( ) . nullish ( ) , // date of birth. Unix timestamp
310+ roll : z . coerce . string ( ) . nullish ( ) , // index of roll class
311+ lines : z . record ( z . coerce . number ( ) ) . nullish ( ) ,
312+ extraLines : z . record ( z . coerce . number ( ) ) . nullish ( ) ,
313313 BoSNumber : z . coerce . number ( ) , // Board of Studies number. 0 if not available
314314 studentId : z . string ( ) , // Student ID number
315315 year : z . string ( ) , // student's [primary] year group
@@ -322,39 +322,41 @@ const timetableSchema = z.object({
322322 rollcall : z . object ( {
323323 // roll call info for this day
324324 title : z . string ( ) , // name of roll class
325- teacher : z . string ( ) , // teacher code for roll class
326- room : z . string ( ) , // room for roll call
325+ teacher : z . string ( ) . nullish ( ) , // teacher code for roll class
326+ room : z . string ( ) . nullish ( ) , // room for roll call
327327 } ) ,
328328 periods : z . record (
329329 z . object ( {
330330 // corresponds to routine
331331 title : z . string ( ) , // short name for class
332- teacher : z . string ( ) , // teacher code for class
333- room : z . string ( ) , // room for class
334- year : z . string ( ) , // year for class (Note [1])
332+ teacher : z . string ( ) . nullish ( ) , // teacher code for class
333+ room : z . string ( ) . nullish ( ) , // room for class
334+ year : z . string ( ) . nullish ( ) , // year for class (Note [1])
335335 } )
336336 ) ,
337337 } )
338338 ) ,
339- subjects : z . record (
339+ subjects : z . array (
340340 z . object ( {
341341 title : z . string ( ) , // title of the class
342342 shortTitle : z . string ( ) , // corresponds to period.title
343343 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])
347- } )
348- ) ,
349- extraSubjects : z . record (
350- z . object ( {
351- // these subjects have no timetable classes
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
344+ teacher : z . string ( ) . nullish ( ) , // teacher code for the class teacher
345+ fullTeacher : z . string ( ) . nullish ( ) , // full name of the teacher
346+ year : z . coerce . string ( ) . nullish ( ) , // year for the class (Note [1])
356347 } )
357348 ) ,
349+ extraSubjects : z
350+ . record (
351+ z . object ( {
352+ // these subjects have no timetable classes
353+ title : z . string ( ) , // title of the class
354+ shortTitle : z . string ( ) , // corresponds to period.title
355+ teacher : z . string ( ) . nullish ( ) , // teacher code for the class teacher
356+ fullTeacher : z . string ( ) . nullish ( ) , // full name of the teacher
357+ } )
358+ )
359+ . nullish ( ) ,
358360
359361 rollcall : z . object ( {
360362 // roll class details
0 commit comments