Domain Model
The asset model tracks identity, custody, tags, lifecycle events, documents, compliance, and maintenance.
Core Entities
| Entity | Purpose |
|---|---|
app_user | Person using the system |
role / permission | Authorization model |
department | Owning organizational unit |
location | Physical asset location |
party | User, department, or vendor in a handoff |
asset | Current asset read model derived from events |
asset_tag | Tag history for an asset |
asset_event | Append-only action log |
handoff_transaction | Two-sided custody transfer |
handoff_line | Assets included in a handoff |
discrepancy | Mismatch between record and reality |
approval | Maker-checker decision |
financial_profile | Asset financial view |
compliance_item | Warranty, certificate, maintenance due date, lease end |
document | Asset file attachment |
work_order | Maintenance job |
Entity Relationships
erDiagram
app_user ||--o{ user_role : has
role ||--o{ user_role : assigned
role ||--o{ role_permission : grants
permission ||--o{ role_permission : included
department ||--o{ asset : owns
location ||--o{ asset : contains
app_user ||--o{ asset : custodian
asset ||--o{ asset_tag : tagged_by
asset ||--o{ asset_event : has
party ||--o{ handoff_transaction : from
party ||--o{ handoff_transaction : to
handoff_transaction ||--o{ handoff_line : contains
asset ||--o{ handoff_line : moved
asset ||--o{ discrepancy : reports
asset ||--o{ financial_profile : has
asset ||--o{ compliance_item : tracks
asset ||--o{ document : attaches
asset ||--o{ work_order : maintains
Invariants
- Asset history is append-only.
- Current asset state is derived from events.
- A correction points to an earlier event; it does not overwrite it.
- A handoff closes only when the receiver confirms.
- Maker and checker must differ for approvals.
- Tags are globally unique while active.
- Missing or temporary tags create follow-up work, not blocked receiving.
Mobile POC Domain Mapping
The current POC uses simplified Dart models in reference/mobile_app_demo/lib/models/:
| Dart model | Concept |
|---|---|
Grn | Delivery work list |
GrnLineItem | Physical unit expected or received |
AssetEvent | Local event queued for backend sync |
OnboardedAsset | In-memory current view |
See Data Model Reference for table-level fields.