Pass entitlement covered extra
Purpose
TBD by human
Identity & key fields
- Primary key:
id(uuid, defaultgen_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_check—quantity >= 1(enforced in tktspace-backend/libs/shared/data-access-db/src/lib/schema/passes.schema.ts). - UNIQUE constraint
pass_entitlement_covered_extras_template_extra_uniqueon(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) —
entitlementTemplateId→passes.pass_entitlement_template.id, on-delete restrict. N:1. - Activity extra (ENT-006) —
extraId→activities.activity_extras.id, on-delete restrict. N:1.
API surfaces
| Surface | Exposed | Notes |
|---|---|---|
| client | no — surfaces only through booking-time coverage (CoveredExtraClientDto) | — |
| business | yes — CoveredExtraTemplateDto; managed inline via CreatePassEntitlementDto, UpdatePassEntitlementDto | Swagger UI |
| super-admin | no | — |
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.