Schedules — events
Per-module slice of docs/events-catalog.md (auto-generated). Update both files when adding or removing events.
Published
This module does not publish any events. Occupancy data is exposed via GET /api/v1/schedules/analytics/* endpoints, not events.
Subscribed
| Event | Handler | Effect |
|---|---|---|
appointment.scheduled | events.py:on_appointment_scheduled | Recompute occupancy aggregates for the affected (professional, day). |
appointment.updated | events.py:on_appointment_updated | Same — slot or duration may have moved. |
appointment.cancelled | events.py:on_appointment_cancelled | Free the slot in the occupancy aggregates. |
The handlers must remain idempotent; agenda may re-publish on retry.
Adding a new event
Schedules does not publish events today. If a future feature needs to broadcast a state change:
- Add the constant to
backend/app/core/events/types.py(EventType). - Publish from the relevant service method, after the DB commit.
- Add the row to the Published table above.
- Run
python backend/scripts/generate_catalogs.pyto refresh the global catalog.