Skip to content

Pass entitlement covered extra

Purpose

TBD by human

Identity & key fields

  • Primary key: id (uuid, default gen_random_uuid()).
  • entitlementTemplateId (uuid, NOT NULL, FK → passes.pass_entitlement_template.id, on-delete restrict).
  • extraId (uuid, NOT NULL, FK → activities.activity_extras.id, on-delete restrict).
  • quantity (integer, NOT NULL) — per-booking cap, ≥ 1.

business meaning: TBD by human

Invariants

  • CHECK constraint pass_entitlement_covered_extras_quantity_checkquantity >= 1 (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/passes.schema.ts).
  • UNIQUE constraint pass_entitlement_covered_extras_template_extra_unique on (entitlementTemplateId, extraId) — same extra can’t be configured twice for one entitlement (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/passes.schema.ts).
  • Both FKs ON DELETE RESTRICT (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/passes.schema.ts).
  • Indexes on (entitlementTemplateId) and (extraId) (enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/passes.schema.ts).

business invariants: TBD by human

Lifecycle

No explicit lifecycle.

Relationships

  • Pass entitlement template (ENT-031) — entitlementTemplateIdpasses.pass_entitlement_template.id, on-delete restrict. N:1.
  • Activity extra (ENT-006) — extraIdactivities.activity_extras.id, on-delete restrict. N:1.

API surfaces

SurfaceExposedNotes
clientno — surfaces only through booking-time coverage (CoveredExtraClientDto)
businessyes — CoveredExtraTemplateDto; managed inline via CreatePassEntitlementDto, UpdatePassEntitlementDtoSwagger UI
super-adminno

Known gotchas / open questions

  • The schema comment (D1) explicitly notes that (entitlement_template_id, extra_id) uniqueness exists so per-booking quantity can’t be double-counted under one entitlement.
  • ON DELETE RESTRICT on both sides means archiving an extra requires explicit cleanup of coverage rows first.