feat(courses,users): add enrollment-status, progress, quiz-attempts, module-reorder & learning-stats endpoints (#374, #381, #383, #385, #393) - #458
Merged
DeFiVC merged 5 commits intoSep 2, 2026
Conversation
This was referenced Sep 2, 2026
added 2 commits
September 2, 2026 21:26
…LearnOfficial#381, ChainLearnOfficial#385, ChainLearnOfficial#393) - GET /api/v1/courses/:id/enrollment-status (ChainLearnOfficial#381): detailed enrollment status with module-by-module progress, quiz count, average score - GET /api/v1/courses/:id/progress (ChainLearnOfficial#385): user's detailed progress in a course with module completion, quiz scores, completion percentage - GET /api/v1/courses/:id/modules/:moduleId/quiz-attempts (ChainLearnOfficial#393): all quiz attempts for a module ordered oldest-first with score/percentage/pass - POST /api/v1/admin/courses/:id/modules/reorder (ChainLearnOfficial#374): admin endpoint to reorder course modules atomically with audit logging All endpoints follow the established controller→service→routes→types pattern, use Redis caching (30s for course endpoints), and include proper validation via zod schemas.
…earnOfficial#383) Comprehensive learning statistics for the authenticated user: total courses completed, quizzes taken, average score (percentage), credits earned, credentials earned, learning streak (consecutive days), estimated total study time, and learning velocity (quizzes in last 7 days). Cached for 5 minutes. Follows the established controller→service→routes→types pattern.
ZacLou
force-pushed
the
feat/multiple-course-user-endpoints
branch
from
September 2, 2026 13:27
b7ce7b4 to
3e1de33
Compare
added 3 commits
September 2, 2026 22:11
- course.routes.ts: add missing ');' closing enrolledUsers route - course.service.ts: add missing '}' closing reorderModules method - course.types.ts: remove broken empty EnrolledUserEntry interface and duplicate 'users' field declaration in EnrolledUsersResult - course.controller.ts: drop unused ReorderModulesBody import Fixes CI Lint & Typecheck failures (3 parsing errors) reported on 3e1de33.
course-waitlist.test.ts had the same reference line twice, which tripped the @typescript-eslint/triple-slash-reference rule and kept Lint red.
The file already imports describe/it/expect/beforeAll/afterAll from "vitest" directly, matching every other test in the repo. This was the last file in tests/ still using the triple-slash form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds 5 new API endpoints across the courses and users modules, addressing issues #374, #381, #383, #385, and #393.
New Endpoints
GET /api/v1/courses/:id/enrollment-statusGET /api/v1/courses/:id/progressGET /api/v1/courses/:id/modules/:moduleId/quiz-attemptsPOST /api/v1/admin/courses/:id/modules/reorder{moduleIds: string[]}, validates all IDs belong to the course, updates order atomically viawithLock, logs to audit trail.GET /api/v1/users/me/learning-statsImplementation Details
controller → service → routes → typesmodule patternvalidate()middleware)cacheGet/cacheSet/cacheKeyauthGuardon all user-facing endpoints,adminGuardon the reorder endpointNotFoundErrorfor non-existent/inactive courses (404)courses.modulesjsonb definitions, falling back to quiz-derivedmoduleIdgroups (matchinggetCourseDetail's pattern)withLockfor atomic module reordering (matchingcreateModule/updateModule's pattern)auditLog()for the admin reorder actionCloses #374, closes #381, closes #383, closes #385, closes #393