Summary
DigiScript currently creates a ShowSession the instant "Start" is pressed. This feature adds the ability to schedule sessions ahead of time (with a date, time, and script revision), so that upcoming performances exist as first-class objects before they go live. Sessions can then be prepared (casting assigned, mics reviewed) before show day. The existing "Start Ad-hoc Session" path is preserved.
Part 1 of 3 for issue #792. Must be completed before #1113 (casting matrix) and #1114 (mic re-runs).
Note: Performance categorisation (Preview, Press Night, etc.) is handled via the existing user-defined SessionTag system — no new session_type field is needed. The "Schedule Session" modal includes a tag picker so tags can be assigned at creation time.
Backend changes
ShowSession model (server/models/session.py):
- Add
scheduled_date_time: Mapped[datetime | None] — when set and start_date_time is null, the session is in "scheduled" state
Alembic migration: alembic revision --autogenerate -m "add_scheduled_session_fields" — adds scheduled_date_time column to showsession.
Schema (server/schemas/schemas.py): add scheduled_date_time to ShowSessionSchema.
New/updated controllers (server/controllers/api/show/session/):
| Method |
Path |
Role |
Description |
POST |
/api/v1/show/sessions/schedule |
EXECUTE |
Create a scheduled session. Body: {scheduled_date_time, tag_ids, script_revision_id}. start_date_time left null. tag_ids assigns existing SessionTags at creation time. |
PATCH |
/api/v1/show/sessions/{id} |
EXECUTE |
Update scheduled_date_time, script_revision_id, or tags. Returns 409 if session already started. |
DELETE |
/api/v1/show/sessions/{id} |
EXECUTE |
Delete a scheduled session. Returns 409 if already started. |
Update SessionStartController (POST /show/sessions/start):
- Accept optional
show_session_id in request body
- If present: find that
ShowSession, set start_date_time, client_internal_id, user_id (no new row created)
- If absent: existing ad-hoc behaviour unchanged
Frontend changes (client-v3/)
ConfigSessions.vue — significant update:
- Add "+ Schedule Session" button →
ScheduleSessionModal.vue
- Keep "Start Ad-hoc Session" button (existing flow)
- Update table columns:
Date · Time | Tags | Revision | Status | Actions
- Status badges: Scheduled (blue) / Next Up (green) / In Progress (green) / Complete (grey)
- Per-row actions:
[Edit] [Delete] [Start] for scheduled; [Stop] for live; [View Log] for complete
New ScheduleSessionModal.vue (components/show/config/sessions/):
- Fields: datetime-local picker, tags multi-select (from existing
SessionTags), script revision select
- Calls
POST /api/v1/show/sessions/schedule
StartSessionConfirmModal.vue — extend to accept show_session_id for starting a pre-scheduled session; show session date/time + tags in header.
stores/show.ts additions:
- New actions:
scheduleSession(data), updateScheduledSession(id, data), deleteScheduledSession(id)
- New getter:
scheduledSessions — sessions where start_date_time is null, sorted by scheduled_date_time
src/types/api/session.ts: add scheduled_date_time: string | null to ShowSession.
E2E tests
Update client-v3/e2e/tests/12-show-config-sessions.spec.ts:
- Schedule a session → verify "Scheduled" row appears
- Edit → verify table updates
- Delete → verify row removed
- Start scheduled session → confirm modal → "In Progress" status
Verification
pytest — all existing tests pass + new tests for schedule/edit/delete/start-scheduled endpoints
npm run typecheck + npm run lint in client-v3/
npm run test:e2e — full suite
Summary
DigiScript currently creates a
ShowSessionthe instant "Start" is pressed. This feature adds the ability to schedule sessions ahead of time (with a date, time, and script revision), so that upcoming performances exist as first-class objects before they go live. Sessions can then be prepared (casting assigned, mics reviewed) before show day. The existing "Start Ad-hoc Session" path is preserved.Part 1 of 3 for issue #792. Must be completed before #1113 (casting matrix) and #1114 (mic re-runs).
Backend changes
ShowSessionmodel (server/models/session.py):scheduled_date_time: Mapped[datetime | None]— when set andstart_date_timeis null, the session is in "scheduled" stateAlembic migration:
alembic revision --autogenerate -m "add_scheduled_session_fields"— addsscheduled_date_timecolumn toshowsession.Schema (
server/schemas/schemas.py): addscheduled_date_timetoShowSessionSchema.New/updated controllers (
server/controllers/api/show/session/):POST/api/v1/show/sessions/schedule{scheduled_date_time, tag_ids, script_revision_id}.start_date_timeleft null.tag_idsassigns existingSessionTags at creation time.PATCH/api/v1/show/sessions/{id}scheduled_date_time,script_revision_id, or tags. Returns 409 if session already started.DELETE/api/v1/show/sessions/{id}Update
SessionStartController(POST /show/sessions/start):show_session_idin request bodyShowSession, setstart_date_time,client_internal_id,user_id(no new row created)Frontend changes (
client-v3/)ConfigSessions.vue— significant update:ScheduleSessionModal.vueDate · Time | Tags | Revision | Status | Actions[Edit] [Delete] [Start]for scheduled;[Stop]for live;[View Log]for completeNew
ScheduleSessionModal.vue(components/show/config/sessions/):SessionTags), script revision selectPOST /api/v1/show/sessions/scheduleStartSessionConfirmModal.vue— extend to acceptshow_session_idfor starting a pre-scheduled session; show session date/time + tags in header.stores/show.tsadditions:scheduleSession(data),updateScheduledSession(id, data),deleteScheduledSession(id)scheduledSessions— sessions wherestart_date_timeis null, sorted byscheduled_date_timesrc/types/api/session.ts: addscheduled_date_time: string | nulltoShowSession.E2E tests
Update
client-v3/e2e/tests/12-show-config-sessions.spec.ts:Verification
pytest— all existing tests pass + new tests for schedule/edit/delete/start-scheduled endpointsnpm run typecheck+npm run lintinclient-v3/npm run test:e2e— full suite