Skip to content

Location

Purpose

TBD by human

Identity & key fields

  • Primary key: id (uuid, default gen_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

  • companyId NOT NULL — no DB-level FK (cross-schema reference: activities.locationscompanies.companies). Application-level integrity only. See ADR cross-schema-references-without-fk.
  • parentId self-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).
  • name NOT 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)parentIdactivities.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

SurfaceExposedNotes
clientembedded only — surfaces inside session/activity DTOs as nested location data; no top-level /locations resourceSwagger UI
businessembedded 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-adminno

Known gotchas / open questions

  • Locations are intentionally embedded-only — there is no top-level /locations resource on either surface. They are managed inline through activity/session create-update endpoints.
  • seatingConfig is free-form JSONB — schema TBD by human.