Skip to content

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

ModelTable NameDescription
AllocationPlanallocation.AllocationPlanTop-level plan owned by an Organizer
AllocationLayoutallocation.AllocationLayoutLayout configuration within a plan
AllocationZoneallocation.AllocationZoneLogical grouping of units within a layout
AllocationUnitallocation.AllocationUnitIndividual allocatable unit (seat, table, etc.)

Hierarchy

AllocationPlan

Top-level container owned by an Organizer. Represents a venue or event configuration.

ColumnTypeConstraintsDescription
statustextNOT NULL, DEFAULT UNKNOWNPlan status
namejsonb (i18n)NOT NULLInternationalized name
stylejsonbVisual styling configuration
organizer_idtextNOT NULLFK to Organizer
+ common columnsid, createdAt, modifiedAt, deletedAt, metadata

AllocationLayout

A specific layout configuration within a plan. Links to a plan via planId.

ColumnTypeConstraintsDescription
statustextNOT NULL, DEFAULT UNKNOWNLayout status
namejsonb (i18n)NOT NULLInternationalized name
stylejsonbLayout styling (background, dimensions)
plan_idtextNOT NULLFK to AllocationPlan
+ common columns

AllocationZone

A logical grouping of units within a layout. Represents sections, areas, or categories.

ColumnTypeConstraintsDescription
statustextNOT NULL, DEFAULT UNKNOWNZone status
namejsonb (i18n)NOT NULLInternationalized name
stylejsonbZone styling (color, border)
layout_idtextNOT NULLFK to AllocationLayout
+ common columns

AllocationUnit

An individual allocatable unit (seat, table, parking spot, etc.) with flexible placement support.

ColumnTypeConstraintsDescription
statustextNOT NULL, DEFAULT UNKNOWNUnit status
namejsonb (i18n)NOT NULLInternationalized name (e.g., "Seat A1")
placementjsonbNOT NULLPosition data (see Placement Types below)
stylejsonbUnit styling (icon, color, dimensions)
zone_idtextNOT NULLFK to AllocationZone
+ common columns

Placement Types

AllocationUnit supports multiple placement strategies via a discriminated union:

typescript
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:

json
{ "type": "grid", "value": { "row": "A", "column": 1 } }

Absolute

For precise XY positioning on a canvas:

json
{ "type": "absolute", "value": { "x": 150, "y": 200, "z": 1 } }

Identifier

Simple named position:

json
{ "type": "identifier", "value": "VIP-BOX-1" }

Geolocation

For outdoor or GPS-based allocation:

json
{ "type": "geolocation", "value": { "latitude": 10.762622, "longitude": 106.660172, "accuracy": 5 } }

Relative

Positioned relative to another unit:

json
{ "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 ColumnFK Target
allocation_plan_idAllocationPlan
allocation_layout_idAllocationLayout
allocation_zone_idAllocationZone
allocation_unit_idAllocationUnit

This allows ticket products to be tied to specific seats, zones, or layouts.

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.