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

Description

Manages all persistence operations for courses, enrollments, and completion records. Provides a typed data access layer over the underlying database, abstracting query logic from the service layer. Ensures data integrity for enrollment state and completion linkage used by the certification pipeline.

Feature: Course Registration

course-repository

Sources & reasoning

HLF explicitly requires in-app course registration as part of their certification workflow (line 114), and Barnekreftforeningen shares the need for onboarding and follow-up training (line 123). The priority matrix (line 155) marks this SHOULD Phase 3, confirming v1.1 per third-phase normalization. The feature is foundational to certification-training and directly enables the certificate and renewal reminder features.

  • Kursadministrasjon og sertifisering: Påmelding til kurs i appen, automatisk påminnelse ved utløp, digitale sertifikater. Det fysiske kortet er et «adelsmerke» og skal leve parallelt.
  • Kursadministrasjon (delt med HLF) for opplæring av nye likepersoner og oppfølgingskurs.
  • Kursadministrasjon / sertifisering | ✓ | - | - | ✓ | ✓ | SHOULD (HLF + Barnekreft) | 3

Responsibilities

  • Query and return course records with optional filtering by status or organization
  • Create and update enrollment records tied to user and course identifiers
  • Persist course completion events with timestamps for certification tracking
  • Retrieve enrollment history per user for profile and reporting use cases
  • Enforce uniqueness constraints to prevent duplicate enrollment records

Interfaces

findAllCourses(filter?: CourseFilter): Promise<Course[]>
findCourseById(courseId: string): Promise<Course | null>
createEnrollment(userId: string, courseId: string): Promise<Enrollment>
updateEnrollmentStatus(enrollmentId: string, status: EnrollmentStatus): Promise<void>
recordCompletion(userId: string, courseId: string, completedAt: Date): Promise<Completion>
findEnrollmentsByUser(userId: string): Promise<Enrollment[]>

Related Data Entities (1)

Data entities managed by this component