Allocation Schema
The allocation schema contains 4 models that manage space and resource allocation for venues, events, and seating arrangements. It supports a hierarchical structure from plans down to individual allocatable units.
Source: packages/core/src/models/schemas/allocation/
Models Overview
| Model | Table Name | Description |
|---|---|---|
| AllocationPlan | allocation.AllocationPlan | Top-level plan owned by an Organizer |
| AllocationLayout | allocation.AllocationLayout | Layout configuration within a plan |
| AllocationZone | allocation.AllocationZone | Logical grouping of units within a layout |
| AllocationUnit | allocation.AllocationUnit | Individual allocatable unit (seat, table, etc.) |
Hierarchy
AllocationPlan
Top-level container owned by an Organizer. Represents a venue or event configuration.
| Column | Type | Constraints | Description |
|---|---|---|---|
status | text | NOT NULL, DEFAULT UNKNOWN | Plan status |
name | jsonb (i18n) | NOT NULL | Internationalized name |
style | jsonb | Visual styling configuration | |
organizer_id | text | NOT NULL | FK to Organizer |
| + common columns | id, createdAt, modifiedAt, deletedAt, metadata |
AllocationLayout
A specific layout configuration within a plan. Links to a plan via planId.
| Column | Type | Constraints | Description |
|---|---|---|---|
status | text | NOT NULL, DEFAULT UNKNOWN | Layout status |
name | jsonb (i18n) | NOT NULL | Internationalized name |
style | jsonb | Layout styling (background, dimensions) | |
plan_id | text | NOT NULL | FK to AllocationPlan |
| + common columns |
AllocationZone
A logical grouping of units within a layout. Represents sections, areas, or categories.
| Column | Type | Constraints | Description |
|---|---|---|---|
status | text | NOT NULL, DEFAULT UNKNOWN | Zone status |
name | jsonb (i18n) | NOT NULL | Internationalized name |
style | jsonb | Zone styling (color, border) | |
layout_id | text | NOT NULL | FK to AllocationLayout |
| + common columns |
AllocationUnit
An individual allocatable unit (seat, table, parking spot, etc.) with flexible placement support.
| Column | Type | Constraints | Description |
|---|---|---|---|
status | text | NOT NULL, DEFAULT UNKNOWN | Unit status |
name | jsonb (i18n) | NOT NULL | Internationalized name (e.g., "Seat A1") |
placement | jsonb | NOT NULL | Position data (see Placement Types below) |
style | jsonb | Unit styling (icon, color, dimensions) | |
zone_id | text | NOT NULL | FK to AllocationZone |
| + common columns |
Placement Types
AllocationUnit supports multiple placement strategies via a discriminated union:
type TAllocationUnitPlacement =
| { type: 'grid'; value: TPlacementGrid }
| { type: 'absolute'; value: TPlacementAbsolute }
| { type: 'identifier'; value: TPlacementIdentifier }
| { type: 'geolocation'; value: TPlacementGeolocation }
| { type: 'relative'; value: TPlacementRelative };Grid
For traditional row/column seating:
{ "type": "grid", "value": { "row": "A", "column": 1 } }Absolute
For precise XY positioning on a canvas:
{ "type": "absolute", "value": { "x": 150, "y": 200, "z": 1 } }Identifier
Simple named position:
{ "type": "identifier", "value": "VIP-BOX-1" }Geolocation
For outdoor or GPS-based allocation:
{ "type": "geolocation", "value": { "latitude": 10.762622, "longitude": 106.660172, "accuracy": 5 } }Relative
Positioned relative to another unit:
{ "type": "relative", "value": { "relativeTo": "unit-123", "offsetX": 50, "offsetY": 0 } }Entity Relationships
Integration with Products
ProductVariant can link to allocation entities for seat-specific products:
| ProductVariant Column | FK Target |
|---|---|
allocation_plan_id | AllocationPlan |
allocation_layout_id | AllocationLayout |
allocation_zone_id | AllocationZone |
allocation_unit_id | AllocationUnit |
This allows ticket products to be tied to specific seats, zones, or layouts.
Related Documentation
- Database Overview -- Schema summary, common columns, shared types
- Entity Relationship Diagram -- Comprehensive ERD for all 55 models
- Public Schema -- 30 models in the public schema
- Pricing Schema -- 7 pricing models
- Sale Schema -- 2 sale order models
- Inventory Schema -- 8 inventory models
- Finance Schema -- 3 finance models
- Payment Schema -- 1 webhook config model
- Migrations -- DDL migrations and seed data framework