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
SubjectBreakAssemblyFree PeriodLabSports
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
POST
/api/timetableAdmin creates a timetable for a class
GET
/api/timetable/myRole-scoped: teacher → teaching schedule, student → class schedule
GET
/api/timetable/:idFull timetable with all slots
POST
/api/timetable/:id/slotsAdd a slot to the timetable
PATCH
/api/timetable/:id/slots/:slotIdUpdate a slot (time, teacher, room)
DELETE
/api/timetable/:id/slots/:slotIdRemove a slot
PATCH
/api/timetable/:id/activateSet this timetable as the active one for the class
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