Data Layer medium complexity backend
0
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Data access layer for reading and writing peer mentor status records and their history. It persists current status, pause reason, timestamps, and a full audit trail of all status transitions for a mentor. All queries are scoped by mentor ID to prevent cross-mentor data leakage.

Feature: Pause Function

peer-mentor-status-repository

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

  • Read current status record for a given mentor
  • Write status updates with reason, actor, and timestamp
  • Append entries to the status history audit log
  • Query all mentors in paused state for coordinator dashboard views
  • Remove or restore mentor ID from the active assignment queue table

Interfaces

findStatusByMentorId(mentorId: string): Promise<MentorStatusRecord | null>
upsertStatus(record: MentorStatusRecord): Promise<void>
insertHistoryEntry(entry: StatusHistoryEntry): Promise<void>
findAllPaused(): Promise<MentorStatusRecord[]>
removeFromActiveQueue(mentorId: string): Promise<void>
restoreToActiveQueue(mentorId: string): Promise<void>

Related Data Entities (2)

Data entities managed by this component