Location
Purpose
TBD by human
Identity & key fields
- Primary key:
id(uuid, defaultgen_random_uuid()). companyId(uuid, NOT NULL) — no DB-level FK declared (application-side only).parentId(nullable uuid, self-FK →activities.locations.id, on-delete cascade) — hierarchy (e.g. building → hall).name(text, NOT NULL),address(nullable text).capacity(nullable integer),seatingConfig(nullable jsonb).
business meaning: TBD by human
Invariants
companyIdNOT NULL — no DB-level FK (cross-schema reference:activities.locations→companies.companies). Application-level integrity only. See ADR cross-schema-references-without-fk.parentIdself-FK with ON DELETE CASCADE — deleting a parent location cascades to children (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/activities.schema.ts).nameNOT NULL (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/activities.schema.ts).
business invariants: TBD by human
Lifecycle
No explicit lifecycle.
Relationships
- Company (ENT-016) —
companyId(no DB FK). N:1. - Location (self) —
parentId→activities.locations.id, on-delete cascade. N:1 hierarchical. - Session (ENT-012) — referenced by
sessions.location_id(nullable). 1:N. - Time slot (ENT-013) — referenced by
time_slots.location_id(nullable). 1:N.
API surfaces
| Surface | Exposed | Notes |
|---|---|---|
| client | embedded only — surfaces inside session/activity DTOs as nested location data; no top-level /locations resource | Swagger UI |
| business | embedded only — managed inline via activity/session create-update endpoints; no top-level /locations resource (intentional — locations are not a standalone admin entity) | Swagger UI |
| super-admin | no | — |
Known gotchas / open questions
- Locations are intentionally embedded-only — there is no top-level
/locationsresource on either surface. They are managed inline through activity/session create-update endpoints. seatingConfigis free-form JSONB — schema TBD by human.