School calendar
Calendars, events and routines, who sees them, the refusals, and how copies reach Outlook.
Every route needs Feature.CALENDARS and starts with /api/v1/school-calendar. None carry @RequirePermissions: a school-wide calendar and a campus calendar use different resources, so the service checks permission itself.
| Calendar | Managed with |
|---|---|
School-wide (no campusId) | update (or create, delete) on school_calendar |
| Campus | The same action on calendar for that campus |
Anyone else gets You cannot change this calendar. Only staff can manage.
Who sees what
Each calendar and event has a who (groups: staff, students, guardians, guests) and a where (places: campuses, classes).
An event is visible when the viewer manages the calendar, matches both the calendar's and the event's who and where, is a named participant, or is a guardian whose child matches. An event can never widen its calendar. Staff are narrowed by campus only; guests are not narrowed by class.
Calendars
| Route | Who | Does |
|---|---|---|
GET /calendars (listSchoolCalendars) | Staff | First adds any missing defaults: a "School calendar" for everyone, and an academic calendar for each campus |
POST /calendars (createSchoolCalendar) | Staff | The campus must be in this school; a campus calendar can only show to places on its own campus |
PATCH /calendars/:id (updateSchoolCalendar) | Staff | Changing who or where re-syncs every event's Outlook copies |
DELETE /calendars/:id | Staff | Soft-deletes the calendar and its events. Default calendars can't be deleted |
Events and routines
A routine is an event that repeats within one day (a timed slot on chosen weekdays) until an end date, following the campus terms.
| Route | Does |
|---|---|
POST /events (createSchoolCalendarEvent) | Add an event or routine. Staff only |
PATCH /events/:id (updateSchoolCalendarEvent) | Change only the fields sent. An empty location or details clears it |
PUT /events/:id/days/:date (changeSchoolCalendarEventDay) | Change or skip one day of a routine |
DELETE /events/:id/days/:date (restoreSchoolCalendarEventDay) | Bring one day back |
DELETE /events/:id | Delete |
GET /events (listSchoolCalendarEvents) | Staff, guardians, students and guests. Windows over 400 days are refused |
GET /events/featured | Up to 5 featured events that haven't ended. Routines are never featured |
POST /reach (previewSchoolCalendarReach) | Counts who would see a calendar. Writes nothing |
GET /roles (listSchoolCalendarRoles) | Attendee, Supervisor, Invigilator, Speaker, Team member, plus roles the school has typed (not the retired Teacher in charge and Duty teacher) |
Editing a routine that has already started doesn't rewrite the past. A new routine starting today carries the change, and the old one ends yesterday. The new one is saved first, so a failure in between shows days twice rather than losing them. The response has the new id.
Changing one day isn't locked: two people changing days of the same routine at the same moment can lose one change.
Every change publishes CALENDAR_CHANGE and queues Outlook copies.
In the Hub
The student page is /student/school-calendar (SchoolCalendarList). It shows upcoming weeks, with "Up next" on the first event still to come, "Skipped" on skipped days, and Show next week to load more. Tapping opens SchoolEventDialog:
| Viewer | Sees |
|---|---|
| Family (student, guardian) | When, repeat, place, calendar, campus, organiser, details |
| Staff | Also the participant list, with "You" marked |
| Staff who can edit a routine | Change this day and Bring this day back |
On main: add to my calendar
Hub main 2dd88361a1c6ae1509fb913c66cc8a2a6eab340c (merge of PR #468, 25 November 2026, 05:00 GMT) shares tree e599c26b217549696c01a22eb6128a75e593979d with staging 413b5cfe122223ceae33640ef5671fd0bdd800c7. Compare 413b5cfe...2dd88361 changes no files, so this screen from PR #466 (8db705ac) is on Hub main. The three write routes it calls are on API main 6bfb9f6b, which still has the routes promoted from PR #671. Compare d229592a...6bfb9f6b does not change them. Their rules are on School operations. A merge to Hub main is not a running deploy. No screen was opened and no event was saved.
On the staff campus calendar (CalendarPage):
- Add event shows when the person runs a school calendar, or when Outlook is connected (
calendars.connectedis true). With no Outlook connection it opens the school-calendar form. With Outlook connected it opens My calendar. - A person who also runs a school calendar is asked Where does it go? first. My calendar says "Only you and the people you invite". School calendar says "Shared with the people who follow it" and opens the existing school form.
- My calendar has two steps. What and when asks for title, day, all day, from, to, place, and notes. Notes appear only for a new event. Who to invite searches staff, five names at a time, after a 400 millisecond pause, and offers Add a Teams link. Next needs a title, a day, and an end after the start, unless the event is all day or it already spans another day. Save calls
createCalendarEvent, orupdateCalendarEventwhen the grid id carries an Outlook id. - The default calendar with
canEditfalse, or a 409 from the save, shows Allow the Hub to add events and "Outlook needs your say-so once." Allow callsconnectMicrosoftCalendarwith the current page as the return address. The write scope is the API consent already onmain. - Edit and Delete show only when the event's
canEditis true. An Outlook event opens this same form. Delete asks "Delete this event?" and, when someone is already invited, adds that those people will be told. A change sends no notes, so Outlook keeps the ones it has. People taken off the list go out asremoveInvitees. New people go out asinviteeIds. A Teams switch that is already on stays disabled. - The event dialog adds Invited, with Coming, Not coming, Maybe, or No reply yet, and Join when
joinUrlis set.
Outlook copies
Staff and students with a Microsoft mailbox get calendar events in Outlook when Feature.CALENDAR_OUTLOOK is on. Guardians don't.
Queue. Each changed event is queued on SCHOOL_CALENDAR_QUEUE (on the server process: the worker has no Graph client), deduplicated per event. With the feature off, only events that already have copies are queued, so they can be removed. A queue failure is logged; the calendar save still stands.
Pick recipients. Staff and students the event is visible to. Managing the calendar alone doesn't earn a copy.
Write. A one-off event is one meeting per person; the subject adds their role in brackets when they have one. A routine is a repeating meeting per person per term, with day changes applied. Past terms are left alone. Times use the school's zone (Africa/Kampala is sent as E. Africa Standard Time).
Tidy. Copies of deleted or no-longer-visible events are deleted. A meeting already tagged with the event id is adopted, not duplicated. One mailbox failing doesn't stop the others.
A sweep re-queues events at a lower priority than live edits.