Skip to content

fix: repair broken build from #344-#347 merge - #444

Merged
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
codemagician1949:fix/broken-build-course-admin-user-routes
Aug 31, 2026
Merged

fix: repair broken build from #344-#347 merge#444
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
codemagician1949:fix/broken-build-course-admin-user-routes

Conversation

@codemagician1949

Copy link
Copy Markdown
Contributor

Problem

main currently does not build. fea2b78 ("Add user ban, activity, batch enroll, and learning path endpoints (#344, #345, #346, #347)") left three syntax errors behind:

  • src/modules/courses/course.routes.ts — the POST /enroll/batch route registration is missing its closing );, so the following app.get(...) call for /:id/reviews becomes part of its argument list.
  • src/modules/users/user.routes.ts — same mistake on GET /me/learning-path, missing ); before the next app.get(...) for /me/notifications.
  • src/modules/admin/admin-users.service.ts — an extra } closes AdminUsersService right after listUsers(), so banUser() and getUserActivity() end up declared outside any class body.

Fix

Added the two missing ); and removed the extra } — no behavioral changes, purely restoring valid syntax to what was clearly intended.

Verification

  • npm run build (tsc) — clean, was previously failing to even parse these files.
  • npm run typecheck (tsc --noEmit -p tsconfig.test.json) — the src/ portion is now clean. The remaining errors are pre-existing loosely-typed test mocks in several unrelated test files (stellar, sep10-auth, retry-queue, idempotency, tracing, concurrent-safety) — not touched by fea2b78, not build-blocking, left out of scope for this PR.

Found this while starting on a separate issue batch that touches course.routes.ts — opening standalone since it blocks the build for everyone, not just that work.

…ial#347 merge that blocked the entire build

fea2b78 ("Add user ban, activity, batch enroll, and learning path
endpoints (ChainLearnOfficial#344, ChainLearnOfficial#345, ChainLearnOfficial#346, ChainLearnOfficial#347)") left the codebase in a
non-compiling state — `npm run build` currently fails on `main`:

- src/modules/courses/course.routes.ts: the /enroll/batch route
  registration was missing its closing `);`, so the next app.get(...)
  call became part of its argument list — unparseable.
- src/modules/users/user.routes.ts: same mistake on the
  /me/learning-path route — missing `);` before the next app.get(...).
- src/modules/admin/admin-users.service.ts: an extra `}` closed
  AdminUsersService right after listUsers(), so banUser() and
  getUserActivity() ended up declared as free-floating methods outside
  any class body.

`npm run build` (tsc) and `npm run typecheck` (tsc --noEmit -p
tsconfig.test.json, src/ portion) both pass clean after this. The
remaining tsconfig.test.json errors are pre-existing loosely-typed
test mocks scattered across several unrelated test files (stellar,
sep10-auth, retry-queue, idempotency, tracing, concurrent-safety) —
untouched by fea2b78, not build-blocking, and out of scope here.
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

Hey @codemagician1949! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#354 . Add GET /api/v1/courses/:id/prerequisites endpoint Link to this issue
#353 . Add POST /api/v1/admin/announcements endpoint Link to this issue
#366 . Add POST /api/v1/admin/courses/:id/import endpoint Link to this issue
#367 . Add GET /api/v1/admin/dashboard endpoint Link to this issue

ℹ️ Learn more about linking PRs to issues

@DeFiVC
DeFiVC merged commit 3641c62 into ChainLearnOfficial:main Aug 31, 2026
3 of 5 checks passed
DeFiVC pushed a commit that referenced this pull request Aug 31, 2026
…port

#354 — GET /api/v1/courses/:id/prerequisites
- courses.prerequisites: jsonb string[] column (migration 0020),
  admin-configurable via existing POST/PUT /admin/courses (self-reference
  filtered out on update)
- CourseService.getCoursePrerequisites(): resolves configured prerequisite
  courses, annotates each with the caller's completion status
  (enrollments.completedAt IS NOT NULL), returns an overall met flag.
  Anonymous callers see every prerequisite as incomplete.

#353 — POST/GET/PUT/DELETE /api/v1/admin/announcements + GET /api/v1/announcements
- New announcements table (migration 0021): title, message,
  priority (normal/high/urgent), active, createdAt, expiresAt
- New module (src/modules/announcements/): full admin CRUD
  (authGuard+adminGuard) plus a public GET that filters to
  active && (no expiry || expiry in the future)

#367 — GET /api/v1/admin/dashboard
- New module (src/modules/admin/dashboard.*): total users, new users
  (today/week/month), total enrollments, quiz completion rate (graded /
  total submissions), total credentials, total rewards claimed
  (SUM(rewardAmount) where claimed), plus week-over-week trend
  comparisons for new users and enrollments. Cached 5 minutes via the
  existing cache/index.ts helpers. Admin only.

#366 — POST /api/v1/admin/courses/import
- Accepts multipart/form-data with one JSON file part (reuses the
  already-registered @fastify/multipart), validates against a Zod schema
  (core course fields + an optional modules array), creates the course via
  the existing createCourse() path, then creates each module via the
  existing createModule() so IDs/locking/audit/cache-invalidation all
  match a manually-created module. Returns { courseId, modulesCreated }.
  Note: the issue's literal route was /admin/courses/:id/import, but its
  own scope/acceptance-criteria describe creating a *new* course from the
  file ("creates the course... returns the created course ID") — a
  target :id doesn't fit that, so implemented as the collection-level
  /admin/courses/import instead. Flagged for review below.

Also included: a standalone build fix (see PR #444) this branch is based
on top of, since course.routes.ts (one of the files #354/#366 touch) had
a syntax error blocking the whole build.

Verification: npm run build (tsc) is clean. Did not add new automated
tests for these four endpoints given time constraints — flagging that
honestly rather than claiming coverage that isn't there. Existing
courses/admin test suites still reference the same service methods
these changes extend (createCourse, createModule, toAdminCourse), so a
schema/behavior regression there would likely surface on the existing
suite even without new tests, but the new logic itself (prerequisite
resolution, announcement active-filtering, dashboard aggregates, import
parsing) has no dedicated coverage yet.

Closes #354
Closes #353
Closes #367
Closes #366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants