Skip to main content

Calendar integration

info

This page covers the Google Calendar integration including OAuth connection, event sync, privacy masking for personal events, and linking calendar events to learning activities and study units.

School Platform series

  1. School Platform
  2. Architecture
  3. AI features
  4. Calendar integration - You are here
  5. Deployment

Why calendar integration

Scheduling school activities alongside family life is easier when everything is on the same calendar. The platform connects to a Google Calendar account to display family events alongside school activities, create and manage school-specific events, link events to activities and study units, and protect personal event details from non-admin viewers.

Architecture

OAuth flow

  1. Admin clicks "Connect Google Calendar" on the Admin page
  2. App redirects to Google OAuth with calendar.events and userinfo.email scopes
  3. User authorises the app with Google
  4. Callback exchanges the code for tokens, fetches the user email, and upserts a GoogleCalendarConnection record
  5. Admin is redirected back to the Admin page

Tokens are stored in a single database record (single-user model) and are automatically refreshed when within 5 minutes of expiry.

Event sync

The sync function pulls events from Google Calendar for a configurable date range (default: 3 months back, 6 months forward). Each event is upserted by its Google event ID into the local CalendarEvent table. Cancelled events on Google are deleted locally. All synced events have source: "sync".

TriggerHow
ManualAdmin clicks "Sync" on Admin page
APIPOST /api/admin/calendar/sync (admin auth required)
CronJobExists but not deployed (manual sync preferred)

Privacy masking

Synced Google Calendar events may contain personal information. The public events API masks these for non-admin users:

FieldAdmin viewNon-admin view (synced events)
TitleFull title"Busy"
DescriptionFull textHidden
LocationFull textHidden
ColourGreyGrey
Delete buttonShownHidden

Events created locally in the school platform always show full details to everyone, displayed in teal.

Event typeBackgroundBorder
Synced (from Google)GreyGrey
Local (school event)TealTeal

FullCalendar showing synced and local events with colour distinction.

Activity and study unit linking

Calendar events can be linked to activities and study units when created. The add event dialog includes optional dropdowns for linking to a recent activity and linking to a study unit.

Schedule from study units

Each activity card on the study unit detail page has a calendar icon button. Clicking it opens the add event dialog pre-filled with the activity title, description, activity ID, and study unit ID. The user picks a date and time and the linked event is created.

The event detail dialog shows linked items as clickable badges. Linked events also appear under each activity card on the study unit detail page with the date and time in Australian format and a link to the calendar page. The study unit page auto-refreshes after creating an event so the link appears immediately.

Add event dialog with activity and study unit linking dropdowns.

Event creation

All users can create events (local network trust model). Events are written to both Google Calendar and the local database with source: "local". The "Show as" dropdown allows choosing Busy (opaque, blocks the time slot) or Free (transparent, time remains available), which maps to the Google Calendar transparency field.

Only admins can delete events.

FullCalendar configuration

SettingValue
Localeen-AU (Australian date format, day/month)
Default viewDay view
Slot range9:00 AM to 5:00 PM
Views availableDay, Week, Month, List
First day of weekMonday
Time format24-hour
Now indicatorEnabled