Threshold Tracking Service
Component Detail
Service Layer
high complexity
backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Backend service responsible for evaluating threshold rules against confirmed-read assignment counts, detecting milestone crossings, and enqueuing notifications and audit entries. Runs in the assignment-completion handler after a read receipt is persisted.
threshold-tracking-service
Responsibilities
- Query confirmed-read assignment count per user scoped to organization after each read receipt
- Evaluate count against organization's JSON rule set stored in module_configurations
- Detect threshold crossings and prevent duplicate milestone records via idempotency check
- Enqueue push notifications to peer mentor and coordinator when a milestone is crossed
- Write audit log entry for each milestone event
Interfaces
evaluateThresholds(userId: string, organizationId: string) → Promise<ThresholdEvaluationResult>
getThresholdRules(organizationId: string) → Promise<ThresholdRule[]>
getMentorAssignmentCount(userId: string, organizationId: string) → Promise<number>
recordMilestoneIfNew(userId: string, thresholdCount: number, organizationId: string) → Promise<boolean>
getMentorThresholdSummaries(organizationId: string, page: number, pageSize: number) → Promise<PaginatedMentorThresholdSummary>