Summary
Add read-only API endpoints for browsing the live Moodle category hierarchy and course listings, enabling admins to see what already exists in Moodle before provisioning.
Endpoints
GET /moodle/provision/tree — Fetch the full Moodle category tree (nested structure built from flat API response using O(n) three-pass algorithm)
GET /moodle/provision/tree/:categoryId/courses — Fetch courses for a specific Moodle category
Details
- Both endpoints are protected with
@UseJwtGuard(UserRole.SUPER_ADMIN)
- Categories are fetched live from Moodle using the master key (no local caching)
- Tree is sorted by Moodle's
sortorder field (preserves admin-configured ordering)
- Error handling maps
MoodleConnectivityError → 502 and generic errors → 503
- Response DTOs with full Swagger documentation
- Unit tests for tree building (nesting, sort order, field mapping, empty state) and course mapping
Summary
Add read-only API endpoints for browsing the live Moodle category hierarchy and course listings, enabling admins to see what already exists in Moodle before provisioning.
Endpoints
GET /moodle/provision/tree— Fetch the full Moodle category tree (nested structure built from flat API response using O(n) three-pass algorithm)GET /moodle/provision/tree/:categoryId/courses— Fetch courses for a specific Moodle categoryDetails
@UseJwtGuard(UserRole.SUPER_ADMIN)sortorderfield (preserves admin-configured ordering)MoodleConnectivityError→ 502 and generic errors → 503