Skip to content

. Add DELETE /api/v1/admin/courses/:id/modules/:moduleId with cascade #329

Closed

Description

@DeFiVC

What: Ensure that deleting a course module also cleans up associated quizzes and submissions.

Why: When an admin removes a module from a course, orphaned quiz records and submissions remain in the database, causing data inconsistency.

Scope: In the module deletion logic, delete all quizzes for the module and their submissions. Use database transaction to ensure atomicity. Log the cleanup action.

Acceptance criteria:

  • Deleting a module removes associated quizzes
  • Submissions for deleted quizzes are removed
  • Operation is atomic (all or nothing)
  • Cleanup is logged in audit logs

Technical context: src/database/schema.ts:88-109 — quizzes table. src/database/schema.ts:113-142 — quizSubmissions.


Activity

  1. timilehin01010-byte commented on Aug 31, 2026

    @timilehin01010-byte

    @timilehin01010-byte has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi, can I work on this and deliver PR asap

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @timilehin01010-byte to this issue.

  2. vijay11149 commented on Aug 31, 2026

    @vijay11149

    @vijay11149 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    i will like to work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @vijay11149 to this issue.

  3. poaspergillus commented on Aug 31, 2026

    @poaspergillus

    @poaspergillus has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    I can take this one I can add the transactional cleanup for quizzes and submissions and cover the deletion flow with tests

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @poaspergillus to this issue.

  4. davidishere1 commented on Aug 31, 2026

    @davidishere1
    Contributor

    @davidishere1 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    i will like to work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @davidishere1 to this issue.

  5. drips-wave commented on Aug 31, 2026

    @drips-wave

    Congratulations, @davidishere1! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @davidishere1: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  6. davidishere1 commented on Sep 1, 2026

    @davidishere1
    Contributor

    Already fully implemented and correct: `CourseService.deleteModule` (`src/modules/courses/course.service.ts`) runs in a DB transaction, deletes the module's quizzes, relies on the existing `quiz_submissions.quiz_id` foreign key's `ON DELETE CASCADE` to clean up submissions, and calls `auditLog("course.module.deleted", ...)`. The route already matches what's asked for: `DELETE /api/v1/admin/courses/:id/modules/:moduleId`.

    Not raising a PR for it specifically — it's correct as-is, just currently unbuildable because it lives in `course.service.ts`, which has unrelated breakage from a bad merge (PR #450, see #455 for the two syntax errors I did fix from that). Once that file's other issues (missing `courseShares`/`courseReviews` schema exports, missing controller methods) are sorted out, this should just work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions