# Learning hierarchy Learning content uses **course → chapter → lesson**. Quizzes belong to a chapter; they cannot attach to a course, lesson, multiple chapters, or no chapter. The admin content screen at `/new-content/courses` manages this hierarchy without Exam Prep, Learn English, IELTS, or Duolingo category selection. ## API Learner routes use `/api/v1`; administrative routes use `/api/v1/admin`. | Resource | Collection | Item | | --- | --- | --- | | Courses | `/courses` | `/courses/:id` | | Chapters | `/courses/:courseId/chapters` | `/chapters/:id` | | Lessons | `/chapters/:chapterId/lessons` | `/lessons/:id` | | Quizzes | `/chapters/:chapterId/quizzes` | `/quizzes/:id` | Admins can create, update, delete, and publish content. Course, chapter, and lesson collections support `PUT /reorder` with `ordered_ids` containing every sibling ID. Lists use `limit` and `offset` and return the collection plus `total_count`. Chapter JSON uses `course_id`; lesson JSON uses `chapter_id`. Course categories and the intermediate module level are absent from these APIs. Create a question set with `set_type: "QUIZ"`, then create its chapter quiz with `question_set_id` and an optional `title`. Omit parent fields: the chapter URL determines placement. Both the quiz and its question set must be published for learner visibility. Learners read questions at `/quizzes/:id/questions` and submit completion at `POST /progress/quizzes/:id/complete`. Existing subscription and content access rules still apply. ## Admin integration and Swagger Swagger UI is available at `/swagger/admin/index.html` and `/swagger/client/index.html`. Their specifications are served at `/swagger/admin/doc.json` and `/swagger/client/doc.json`. Regenerate the checked-in Go, JSON, and YAML artifacts with `swag init -g cmd/main.go` after changing handler annotations. `go test ./internal/web_server/... ./internal/apidocs/...` checks registered routes, security, path and body parameters, public hierarchy schemas, and artifact synchronization. The admin uses its configured API root with `/admin` appended exactly once. Its Courses screen loads courses, their chapters, and chapter lessons/quizzes. Reordering is available within those collections; the old category and module screens are no longer navigation targets. Practice location pickers use `COURSE`, `CHAPTER`, and `LESSON`, resolving titles directly by ID. Quiz titles and publication use `PUT /quizzes/:id/full` with both `practice` and `question_set` patches. Omit `questions` when changing metadata to preserve quiz membership; an explicit empty `questions` array removes every membership. The quiz creation flow creates a draft QUIZ question set and links it to the chapter. If linking fails, it attempts to clean up the unused set. For admin question authoring, `GET /question-sets/:id/questions` returns the questions as the response's `data` array. This differs from the paginated learner quiz endpoint. Removing a question calls `DELETE /question-sets/:id/questions/:questionId`, preserving the shared bank question. Deleting a quiz also preserves its independently managed question set. Admin learner activity consumes `learning.progress.courses[].chapters[].lessons[]` and `learning.completions.courses`. Run `npm run test:learning` and `npm run build` in `RezinaLMS-Admin` to check the integration. ## Database rollout Apply `000003_chapters_and_quizzes` before running the updated backend. It removes public category distinctions, flattens existing module lessons into chapters in their original order, and preserves module publication and premium restrictions on the moved lessons. IDs remain stable, preserving lesson and practice history. It also enforces chapter-only quiz placement and deletes quizzes when their chapter or containing course is deleted. Question sets remain independently managed authoring resources. The `exam_prep` schema, internal unit/module names, permission identifiers, and historical progress discriminators remain storage details for compatibility. Public practice parents serialize as `COURSE`, `CHAPTER`, or `LESSON`. Migration backup tables preserve original category and lesson placement for a rollback; newly authored lessons stay in their chapter containers on rollback.