Skip to content

feat: add POST /api/v1/admin/courses/:id/archive endpoint - #443

Merged
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
joelpeace48-cell:fix/issues-363-362-360-358
Aug 31, 2026
Merged

feat: add POST /api/v1/admin/courses/:id/archive endpoint#443
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
joelpeace48-cell:fix/issues-363-362-360-358

Conversation

@joelpeace48-cell

Copy link
Copy Markdown
Contributor

Summary

Adds an admin-only endpoint to archive a course: hides it from public listings while preserving its data so enrolled users keep access and credentials stay intact.

Changes:

  • src/database/migrations/0020_courses_archived_at.sql — adds nullable archived_at column to courses
  • src/database/schema.ts — adds archivedAt to the courses Drizzle schema
  • src/modules/courses/course.service.tsarchiveCourse(courseId): sets isActive = false and archivedAt = now(), invalidates course caches, and writes a course.archived audit log entry (mirrors the existing deleteCourse/publishCourse pattern)
  • src/modules/courses/admin-course.controller.tsarchive controller action
  • src/modules/courses/admin-course.routes.tsPOST /:id/archive route, admin-guarded like the other admin course routes

Acceptance criteria:

  • ✅ Archived course is hidden from public listings (existing idx_courses_is_active / isActive = true listing query already excludes it)
  • ✅ Enrolled users can still access the course (enrollment/course-detail lookups aren't gated on isActive, only the public listing is)
  • ✅ Archive action is logged via auditLog("course.archived", { courseId })
  • ✅ Course data is preserved — this is an update, not a delete

Closes #358
Closes #363
Closes #362
Closes #360

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@joelpeace48-cell Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@DeFiVC
DeFiVC merged commit 9178298 into ChainLearnOfficial:main Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants