Skip to content

Activity extra

Purpose

TBD by human

Identity & key fields

  • Primary key: id (uuid, default gen_random_uuid()).
  • activityId (uuid, FK → activities.activities.id, on-delete cascade).
  • name, description, imageUrl.
  • price (decimal 10,2, default '0').
  • isActive (boolean, default true).
  • order (integer, default 0).

business meaning: TBD by human

Invariants

  • activityId ON DELETE CASCADE — extras vanish with the activity (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/activities.schema.ts).
  • name, price, isActive, order 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 state machine — soft-deactivated via isActive.

Relationships

  • Activity (ENT-005) — activityIdactivities.activities.id, on-delete cascade. N:1.
  • Booking extra (ENT-004) — referenced by bookings.booking_extras.extra_id with on-delete restrict (cannot delete an extra while booking snapshots exist).
  • Pass entitlement covered extra (ENT-030) — referenced by passes.pass_entitlement_covered_extras.extra_id with on-delete restrict.

API surfaces

SurfaceExposedNotes
clientyes — ActivityExtraClientDto referenced from activity detailSwagger UI
businessno — not separately exposed as a DTO; managed via activity create/updateSwagger UI
super-adminno

Known gotchas / open questions

  • ON DELETE RESTRICT from booking_extras and pass_entitlement_covered_extras means extras cannot be hard-deleted while history exists — use isActive=false instead.
  • OPEN: business surface management of extras — is it inline via activity DTOs only, or is there a dedicated endpoint missing from the contract?