Service Layer medium complexity backend
0
Dependencies
0
Dependents
4
Entities
0
Integrations

Description

Business logic layer responsible for managing peer mentor active/paused status transitions. It validates that the requesting user is the mentor themselves or an authorized coordinator, persists the status change, removes the mentor from active assignment queues, and triggers coordinator notifications. It enforces all rules around valid status transitions.

Feature: Pause Function

peer-mentor-status-service

Sources & reasoning

Lines 79-80 directly define this feature; the priority matrix at line 150 classifies it SHOULD HAVE Fase 2. Ordinal mapping: Fase 2 = v1.0. Three of four organizations confirmed the need.

  • Likepersoner skal kunne sette seg på pause (midlertidig deaktivering) uten å melde seg ut. Koordinator må varsles.
  • Pausefunksjon for likepersoner | ✓ | ✓ | - | ✓ | ✓ | SHOULD HAVE | 2

Responsibilities

  • Validate authorization before allowing a status change
  • Transition mentor status between active and paused states
  • Remove or restore mentor from active assignment queues on pause/resume
  • Trigger email notification to the mentor's coordinator on pause initiation
  • Emit status-change events for downstream consumers

Interfaces

pauseMentor(mentorId: string, reason?: string, actorId: string): Promise<MentorStatus>
resumeMentor(mentorId: string, actorId: string): Promise<MentorStatus>
getStatus(mentorId: string): Promise<MentorStatus>
getStatusHistory(mentorId: string): Promise<StatusHistoryEntry[]>