Ubiquitous language
The Eriga API uses a small, consistent vocabulary. The same words appear in request paths, payload fields, and error messages — this page lists them in one place.
For the formal schema of each aggregate (fields, relations, invariants) see Domain model.
Aggregates
Section titled “Aggregates”Billing entity and data isolation boundary. Represents a company, a consulting practice, or any organization using Eriga. Every other entity belongs to exactly one Space. The ability to operate depends on the subscription status, not on the Space status.
A tag that labels Resources inside a Space. Units are logical groupings — sites, teams, cost centers — not a structured org chart. There is no hierarchy between Units. A Resource can carry multiple Unit tags.
Resource
Section titled “Resource”A person or asset registered in a Space. Resources can exist without any Unit
assignment. The type field is immutable after creation and determines which
Actions can apply.
Action
Section titled “Action”A compliance requirement defined at Space level. Describes a recurring
obligation that some Resources must fulfill (a training course, a medical
check, an equipment inspection). Optionally associated with Units to limit
scope. The targetResourceType is immutable after creation.
Certificate
Section titled “Certificate”Proof of fulfillment linking a Resource to an Action. Carries an explicit
expiresAt — expired certificates do not count as coverage. If a real-world
document fulfills multiple Actions, one Certificate per Action is issued.
Attachment
Section titled “Attachment”Embedded value object on a Certificate. Holds an opaque URL pointing to an external store (Google Drive, Dropbox, SharePoint, etc.) plus a descriptive label. Eriga never stores the file itself.
UnitRoleAssignment
Section titled “UnitRoleAssignment”Domain fact: “user X has role Y on Unit Z”. A user has at most one role per Unit; assigning a new one replaces the previous assignment.
UnitRoleInvitation
Section titled “UnitRoleInvitation”Placeholder for a pending role assignment to a user who has not signed up yet.
Keyed by (unitId, email). Consumed into a UnitRoleAssignment when the user
registers.
SpaceAdminAssignment
Section titled “SpaceAdminAssignment”Grants the Admin role at Space level. Only the Space Owner can create or remove Admin assignments.
Compliance
Section titled “Compliance”Conformance state of a Resource with respect to an Action. Never persisted — computed on the fly from the join of Resource → Unit ← Action plus type matching and Certificate validity.
Enumerations
Section titled “Enumerations”SpaceStatus
Section titled “SpaceStatus”| Value | Meaning |
|---|---|
active | Space is operational |
deleted | Tombstone — the Space record remains for historical reference |
Subscription-driven blocks (expired, payment failed, etc.) are not modeled on SpaceStatus — they are checked against the subscription state and apply independently.
ResourceType
Section titled “ResourceType”| Value | Meaning |
|---|---|
person | Employee, consultant, contractor |
equipment | Machine, vehicle, tool |
environment | Laboratory, work area, site |
substance | Chemical, hazardous substance |
ActionType
Section titled “ActionType”| Value | Meaning |
|---|---|
training | Training course |
health | Health surveillance (medical exam) |
check | Inspection or verification |
ppe | Personal protective equipment |
maintenance | Maintenance task |
ValidityPeriod
Section titled “ValidityPeriod”Composite value — how long a Certificate for a given Action stays valid.
value— integer (e.g.4)unit— one ofyear,month,day
UnitRole
Section titled “UnitRole”| Value | Meaning |
|---|---|
operator | Can issue, update, and revoke Certificates on the assigned Unit |
viewer | Read-only access on the assigned Unit |
ComplianceStatus
Section titled “ComplianceStatus”| Value | Meaning |
|---|---|
compliant | A valid Certificate covers the obligation |
expiring | Certificate exists but will expire within the configured threshold |
non_compliant | No valid Certificate for an existing obligation |
Derived concepts
Section titled “Derived concepts”Obligation
Section titled “Obligation”A (Resource, Action) pair is an obligation when:
- the Resource is assigned to at least one Unit, and
- the Action is associated with the same Unit, and
resource.type === action.targetResourceType.
Obligations are never materialized in a table — they are computed via joins at query time.
Fulfillment
Section titled “Fulfillment”An obligation is fulfilled when a valid (non-expired) Certificate exists for
the (Resource, Action) pair.
Compliance gap
Section titled “Compliance gap”An obligation without a valid Certificate. Returned by GetComplianceGaps and
similar queries.
Space isolation
Section titled “Space isolation”Every entity belongs to exactly one Space and no operation ever crosses that boundary. The Space is the unit of security, multi-tenancy, and billing.
Same-Space constraint
Section titled “Same-Space constraint”All associations must stay within one Space:
- a Resource’s Units must belong to the Resource’s Space
- an Action’s Units must belong to the Action’s Space
- a Certificate’s Resource and Action must share the same Space
Type matching
Section titled “Type matching”An Action applies to a Resource only when action.targetResourceType === resource.type.
Pairs that do not match on type do not produce an obligation and are rejected
when issuing a Certificate.