Assignment Status Log
Data Entity
Description
An immutable log of status transitions for an assignment — dispatched, delivered, read, acknowledged, completed, cancelled. Each record captures the transition actor and timestamp, providing a full audit trail of assignment lifecycle events including read confirmation by the peer mentor.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key — immutable unique identifier for this log entry | PKrequiredunique |
assignment_id |
uuid |
Foreign key referencing the assignments table. Every log entry belongs to exactly one assignment. | required |
status |
enum |
The assignment status recorded at this transition point. Represents the new state the assignment entered. | required |
previous_status |
enum |
The assignment status immediately before this transition. NULL for the initial dispatched entry. | - |
actor_id |
uuid |
Foreign key referencing users. The user who triggered this status transition — coordinator for dispatch/cancel, peer mentor for read/acknowledged/completed, or system for delivered. | - |
actor_role |
enum |
The role the actor held at the time of this transition, captured for audit purposes in case role changes later. | - |
note |
text |
Optional free-text note attached to this transition. Used for cancellation reasons or coordinator comments. | - |
device_info |
json |
Optional JSON snapshot of device metadata at the time of read/acknowledged transitions — platform, app version. Useful for Blindeforbundet audit trails. | - |
created_at |
datetime |
Timestamp when this log entry was created (UTC). Immutable after insert — represents the exact moment of the status transition. | required |
Database Indexes
idx_assignment_status_log_assignment_id
Columns: assignment_id
idx_assignment_status_log_assignment_id_created_at
Columns: assignment_id, created_at
idx_assignment_status_log_actor_id
Columns: actor_id
idx_assignment_status_log_status
Columns: status
idx_assignment_status_log_created_at
Columns: created_at
idx_assignment_status_log_assignment_status
Columns: assignment_id, status
Validation Rules
assignment_id_exists
error
Validation failed
actor_id_exists_when_provided
error
Validation failed
status_enum_value
error
Validation failed
previous_status_matches_current_assignment_state
error
Validation failed
created_at_not_in_future
error
Validation failed
note_max_length
error
Validation failed
device_info_valid_json
warning
Validation failed
Business Rules
immutable_log_entries
Log entries are append-only. No UPDATE or DELETE operations are permitted on any row once inserted. The table enforces a complete, tamper-proof audit trail for Blindeforbundet's compliance requirements.
valid_status_transition
Only legal state transitions are permitted: dispatched → delivered → read → acknowledged → completed, or any state → cancelled. Skipping states (e.g., dispatched → completed directly) is rejected.
dispatched_is_first_entry
The first log entry for any assignment MUST have status='dispatched' and previous_status=NULL. Any other status as the first entry is invalid.
read_requires_peer_mentor_actor
A 'read' status transition MUST have an actor_id that resolves to the peer mentor who is the assignment recipient. A coordinator cannot mark an assignment as read on behalf of the peer mentor.
explicit_read_confirmation_required
The 'read' status transition must be triggered by a deliberate user action via the Read Confirmation Widget — passive scrolling does not count. This satisfies Blindeforbundet's requirement for explicit delivery acknowledgement.
no_transitions_after_terminal_state
No new log entries may be created for an assignment once it has reached a terminal state (completed or cancelled).
cancelled_requires_actor_and_note
A cancellation transition must record the actor_id of the coordinator or admin who cancelled, and a non-empty note explaining the reason.
threshold_trigger_on_completion
When a 'completed' log entry is created, the Threshold Tracking Service must be notified to increment the peer mentor's assignment counter for honorarium threshold evaluation.
threshold_decrement_on_cancellation
When a 'cancelled' log entry is created for an assignment that was previously 'completed', the Threshold Tracking Service must be notified to decrement the assignment counter.
CRUD Operations
Storage Configuration
Entity Relationships
An assignment has an immutable log of all status transitions from dispatch through completion