Course Enrollment Service
Component Detail
Description
Manages the full enrollment lifecycle - fetching the org-filtered catalog from the REST API, submitting enrollment POSTs to create course_enrollments records, applying optimistic state with Riverpod, and triggering Drift cache sync on success. Server-side certification status is updated automatically when all required courses for a certification type are completed.
course-enrollment-service
Sources & reasoning
Centralizes all enrollment business logic and API communication so UI components remain stateless. Riverpod providers consume this service to deliver optimistic UX and consistent rollback behavior without scattering API concerns across screens.
No source references — this artifact was included based on reasoning alone (see above).
Responsibilities
- Fetch course catalog filtered by organization and module configuration
- POST course_enrollments on enrollment and handle 4xx/5xx rollback
- Apply optimistic enrollment state via Riverpod providers
- Sync Drift cache after successful remote mutation
- Expose enrollment status query for UI layer
Interfaces
getCourses(String orgId)
enrollInCourse(String courseId, String userId)
withdrawFromCourse(String courseId, String userId)
getEnrollmentStatus(String courseId, String userId)
syncCatalog()
Related Data Entities (3)
Data entities managed by this component