Timetable Management
Weekly class schedules with conflict detection, teacher and room assignment, and role-scoped views.
Admins build the timetable; all other roles see their own view. Students see their class schedule. Teachers see their teaching schedule across all classes. Parents see their child's timetable.
Slot Types
Timetable Structure
- One timetable per class/section per term per academic year
- Days: Monday (1) to Saturday (6) — no Sunday slots
- Up to 8 periods per day, each with start/end time in HH:mm format
- Each Subject slot assigns: course, teacher, and room number
- Break, Assembly, Free, Lab, Sports slots don't require course/teacher
- One timetable can be marked as Active — only the active timetable shows to students
- Slots can optionally link to an auto-created Session for live class tracking
Conflict Detection
When creating or updating a slot, the backend checks for:
- Teacher double-booking — same teacher assigned to two classes at the same time
- Room double-booking — same room assigned to two classes at the same time
- Overlapping periods within the same timetable
API Routes
/api/timetablesAdmin creates a timetable for a class
/api/timetables/myRole-scoped: teacher → teaching schedule, student → class schedule
/api/timetables/:idFull timetable with all slots
/api/timetables/:id/slotsAdd a slot to the timetable
/api/timetables/:id/slots/:slotIdUpdate a slot (time, teacher, room)
/api/timetables/:id/slots/:slotIdRemove a slot
/api/timetables/:id/activateSet this timetable as the active one for the class
/api/timetables/:id/deactivateDeactivate a timetable
/api/timetablesList timetables (admin, teacher, student)
/api/timetables/student/:studentIdA student's timetable for a parent or admin
/api/timetables/:idUpdate a timetable (admin)
/api/timetables/:idDelete a timetable (admin)
/api/timetables/:id/slots/bulkAdd many slots in one request
/api/timetables/:id/slots/check-conflictsCheck teacher, room and class clashes before saving
/api/timetables/:id/periods/:periodNumberRemove a whole period from every day
Frontend Pages
/dashboard/admin/timetableAll timetables for all classes/dashboard/admin/timetable/createCreate timetable and add slots/dashboard/admin/timetable/[id]View/edit timetable with drag-drop slot builder/dashboard/teacher/timetableTeacher's weekly teaching schedule/dashboard/student/timetableStudent's class timetable/dashboard/parent/timetableChild's timetable view