3a. Domain Model (REL – Data Mapper)
The multi-user functional goals translate into the following entities.
REL maps these structs onto SQLite tables; the domain types live in
pkgs/bigfred/server/domain/ and contain no persistence tags beyond the few
hints REL needs, so the controller layer (LocoApp and the services)
stays free of any ORM imports.
Entities
User, Vehicle, Train, Lease, Interlocking, CommandStation, Layout, Function, Template, Script, AuditLog, …
REL repository – Data Mapper in practice
Invariants enforced by services + DB constraints
Layout-and-command station addressing rules
Audit log
Vehicle functions and template inheritance (copy-on-write)
Unified dcc_functions table.
Server-side scripts (Goja sandbox in a sibling executor process)
Function icon catalogue
Closed FunctionIcon list with Polish labels.