feat(admin): DELETE /admin/courses/:id/modules/:moduleId/quizzes/:quizId (#414) - #461
Open
ZacLou wants to merge 1 commit into
Open
feat(admin): DELETE /admin/courses/:id/modules/:moduleId/quizzes/:quizId (#414)#461ZacLou wants to merge 1 commit into
ZacLou wants to merge 1 commit into
Conversation
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.
What
Adds
DELETE /api/v1/admin/courses/:id/modules/:moduleId/quizzes/:quizId(#414): removes a quiz together with all its submissions atomically, in one DB transaction.Implementation
QuizService.deleteQuizByAdmin(courseId, moduleId, quizId)— runs underwithLock(quiz-delete:<id>):tx.delete(quizzes)— quizSubmissions and quizFeedback are removed by the FK cascades in the same commitquiz.deleted_by_adminevent carryingcourseId / moduleId / quizId / total(submission count).quizzes:stats:*pattern plus the course-scoped and global stats keys. Per-user progress/module keys are short-TTL (30s) and tied to unenumerable per-user IDs, so they age out on their own — the same policyretryQuizalready follows.admin-course.routes(authGuard + adminGuard), Fastify swagger schema with uuid params.Note on testing
tests/unit/quizzes/admin-delete-quiz.test.ts— 4 cases: happy path with audit payload, missing-quiz 404, cross-course/module guard (delete never reached), stats-cache invalidation. All 4 pass.Repository-wide
tsc --noEmitcarries pre-existing errors on main (verified against a clean worktree of 4765abb — 151 errors, zero introduced by this PR; theadmin-course.controllererrors listed there exist on stock main too).Closes #414