Skip to content

Data Model

How the key entities in VBIC relate to each other.

Entity overview

Organisation
└── CardLayout (one or more per org)
    └── CardLayoutVersion (immutable snapshots, v1 v2 v3 …)
└── Template (one or more per org)
    ├── references a CardLayoutVersion
    └── cards: InspectionCardDef[]
        └── boxes: BoxMap  (field ID → BoxConfig)
└── TemplateAuditEntry (audit trail)
└── TemplateShareInvite (outgoing share codes)
└── TemplateShare (active cross-org grants)

Organisation

The top-level tenant. Every user belongs to one organisation.

FieldTypeDescription
namestringDisplay name (e.g. Acme Wind Services)
codestringShort unique code, stored uppercase
statusstringactive | archived | deleted
tierstringSubscription tier (e.g. free)
maxUsersintegerUser seat limit (optional)
maxTemplatesintegerTemplate limit (optional)

CardLayout

Represents a named layout definition. The layout itself doesn't store the rows and cells directly — those live in CardLayoutVersion.

FieldTypeDescription
ownerOrgIdstring | nullOwning org. null = public/platform-owned
namestringe.g. Vestas V164 Standard
currentVersionintegerThe latest published version number
isPublicbooleanIf true, visible to all organisations

CardLayoutVersion

An immutable snapshot of a layout's row/cell structure. Layouts are versioned so templates can pin to a specific version while a newer version is being developed.

FieldTypeDescription
layoutIdstringParent CardLayout ID
ownerOrgIdstringCopied from the parent for authorisation
versionintegerVersion number (1, 2, 3 …)
layoutDefinitionJSONThe LayoutDefinition object (rows + cells)

LayoutDefinition

ts
{
  rows: LayoutRow[];
  rowSpanTotal: number;    // must equal 6 (the grid column count)
  labelFontSize?: number;  // px, default 8
  valueFontSize?: number;  // px, default 12
}

Each LayoutRow contains an array of LayoutCell objects. See Cell types reference.

Template

A named set of inspection cards.

FieldTypeDescription
ownerOrgIdstringOwning organisation
namestringe.g. V164 Internal Blade Q1
tagsstring[]Optional filter tags
isPublicbooleanIf true, appears in the Public Library for all orgs
layoutIdstringReferences a CardLayout
layoutVersionintegerPinned version of the layout
cardsJSONArray of InspectionCardDef
statusstringdraft | published | archived

Template status lifecycle

draft  →  published  →  draft (unpublish)
draft  →  archived   →  draft (restore)

Technicians can only see and run published templates.

InspectionCardDef

One card within a template.

FieldTypeDescription
idstringStable UUID for this card
boxesBoxMapMap of cell ID → BoxConfig

BoxConfig (field mode)

Each data cell on a card has a BoxConfig that controls how its value is determined.

ModeShapeMeaning
fixed{ mode: 'fixed', value: string }Value is baked in at template-build time
editable{ mode: 'editable' }Value is entered live by the technician during the inspection
fromSetup{ mode: 'fromSetup' }Value is entered once on the Setup screen and appears on every card

TemplateShareInvite

An invite code generated by the sharing org.

FieldTypeDescription
codestring8-character unique code
templateIdstringThe template being shared
createdByOrgIdstringSharing org
expiresAtdatetimeWhen the code stops being redeemable
redeemedByOrgIdstring?Set once redeemed

TemplateShare

An active grant — one row per {templateId, sharedWithOrgId} pair.

FieldTypeDescription
templateIdstringThe shared template
sharedByOrgIdstringOrg that shared
sharedWithOrgIdstringOrg that received access

TemplateAuditEntry

An immutable audit log record.

FieldTypeDescription
orgIdstringOrganisation the action occurred in
templateIdstringTemplate that was acted on
templateNamestring?Name at the time of the action
actionstringcreated | updated | deleted | published | unpublished | archived | restored | inspection_started
userEmailstring?Email of the user who triggered the action
occurredAtstring?ISO datetime

VBIC — Virtual Blade Inspection Card