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/timetable

Admin creates a timetable for a class

GET/api/timetable/my

Role-scoped: teacher → teaching schedule, student → class schedule

GET/api/timetable/:id

Full timetable with all slots

POST/api/timetable/:id/slots

Add a slot to the timetable

PATCH/api/timetable/:id/slots/:slotId

Update a slot (time, teacher, room)

DELETE/api/timetable/:id/slots/:slotId

Remove a slot

PATCH/api/timetable/:id/activate

Set 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