Assignment Tracking Service
Component Detail
Service Layer
high complexity
backendmobile
0
Dependencies
0
Dependents
3
Entities
0
Integrations
Description
Core business logic service managing the assignment finite state machine. Enforces valid state transitions, records each transition as an immutable row in the dispatch history table, and coordinates real-time state propagation to coordinator views via Supabase Realtime subscriptions.
assignment-tracking-service
Responsibilities
- Validate and execute assignment state transitions
- Record immutable transition events in assignment_dispatches
- Stream real-time state updates to coordinator clients
- Provide role-scoped assignment queries for peer mentor and coordinator views
Interfaces
transitionState(assignmentId, newState, actorId)
getAssignmentsByScope(roleScope, scopeId)
getAssignmentStateHistory(assignmentId)
subscribeToStateChanges(scopeId, callback)
unsubscribeFromStateChanges(subscriptionId)
getOpenAssignments(coordinatorId)
getOverdueAssignments(thresholdDays)
escalateAssignment(assignmentId, reason)
closeAssignment(assignmentId, resolution)
getAssignmentSummary(organizationId)
Sub-Components (1)
Assignment State Machine
component
medium
Encapsulates the finite state machine logic for assignment lifecycle with valid transition guards.
- Define valid states: dispatched, delivered, read, accepted, in_progress, completed, escalated, closed
- Enforce allowed transitions and reject invalid ones
- Emit transition events for audit logging
Related Data Entities (3)
Data entities managed by this component