Skip to content

FAC-117 feat: add Moodle tree explorer API endpoints #280

@y4nder

Description

@y4nder

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions