API operations
Data model
Attributes
Relationships
System-computed
- check_id is generated by PostgreSQL gen_random_uuid() on INSERT and exposed as the public identifier; the internal auto-increment pk is never surfaced in API responses.
- created_at is set automatically by the MikroORM onCreate lifecycle hook on INSERT.
- updated_at is set by both onCreate and onUpdate lifecycle hooks, reflecting the timestamp of the most recent write.
- deleted_at is managed by application-layer soft-delete logic; Hasura select_permissions for the user role enforce deleted_at IS NULL at the query layer so soft-deleted checks are never returned to end users.
- The company / people mutual-exclusion constraint (checkholder is either a Company OR a Person, not both) is a business-rule invariant documented in the entity source; no DB-level CHECK enforces it — enforcement is at the service/application layer.
- Workspace scoping is enforced by Hasura RLS: the user-role filter requires workspace.workspace_id = X-Hasura-Workspace-Id (direct) or workspace.workspace.workspace_id = X-Hasura-Workspace-Id (child workspace), with workspace_group membership paths for consolidated-view contexts.
- The composite_checks_list composite (used when Check appears as a relation on Company or People records pages) is defined in composites.yml and surfaces check_id, check_number, and issue_date as source_fields with display_type: relation_list and is editable.
- On Company and People records roots the Check appears as a composite_checks_list array field sorted by checks_aggregate.min.check_number.
- On the checks records root, company and people checkholder composites (company.composite_logo_name, people.composite_avatar_fullname) and workspace composites are defined in composites.yml, along with composite_payment_means_list.
Example
apps/api/src/database/entities/Check.ts · domain: financial-graph · tier: Supporting