Confirm and Complete Course Enrollment
After tapping the enrollment CTA on the Course Detail Screen, the user is presented with the Enrollment Confirmation Screen, which summarizes the course name, date, and location. A primary AppButton CTA triggers the CourseEnrollmentService, which validates prerequisites and seat availability server-side before writing the enrollment record to the courses and course_enrollments Supabase tables. On success, a confirmation message is displayed in-app and a push notification is dispatched via the Push Notification Gateway. Row-level security in the Course Repository ensures that each user can only enroll themselves unless they hold a coordinator role. The two-step flow (detail → confirmation) prevents accidental enrollments while keeping the process lightweight.
User Story
Acceptance Criteria
- Given a user taps the enrollment CTA on the course detail screen, when the confirmation screen appears, then it displays course name, date, and location for review
- Given a user taps the confirm button on the enrollment confirmation screen, when the CourseEnrollmentService validates successfully, then the enrollment is written to the database and the user sees a success state
- Given enrollment is confirmed successfully, when the success state is shown, then a push notification is also dispatched confirming the enrollment
- Given the course fills up between the detail screen and confirmation, when the CourseEnrollmentService detects no available seats at write time, then an appropriate error state is returned and the user is informed the course is now full
- Given a user confirms enrollment, when the operation completes, then the enrollment is reflected immediately in the course's seat count via real-time subscription
Business Value
The enrollment confirmation is the core value delivery of this feature. For HLF, where certification is a prerequisite for active peer mentor status, every successful in-app enrollment directly increases the pool of qualified mentors without any coordinator involvement. Removing the need to contact a coordinator or navigate a separate portal is the primary friction reduction goal, with the two-step confirmation preventing accidental enrollments that would require administrative correction.