update
All checks were successful
Deploy to Production / deploy (push) Successful in 20s

This commit is contained in:
Ken
2026-02-27 09:38:39 +07:00
parent 9af45a7875
commit 6287a019e3
16 changed files with 2032 additions and 18 deletions

View File

@@ -386,4 +386,100 @@ router.put('/:id', storyController.updateStory);
*/
router.delete('/:id', storyController.deleteStory);
// ============ Nested Lesson Routes ============
/**
* @swagger
* /api/stories/{storyId}/lessons:
* get:
* tags: [Stories]
* summary: Lấy danh sách lessons sử dụng story này
* parameters:
* - in: path
* name: storyId
* required: true
* schema:
* type: string
* format: uuid
* - in: query
* name: page
* schema:
* type: integer
* default: 1
* - in: query
* name: limit
* schema:
* type: integer
* default: 20
* responses:
* 200:
* description: Danh sách lessons sử dụng story
*/
router.get('/:storyId/lessons', storyController.getLessonsByStory);
/**
* @swagger
* /api/stories/{storyId}/lessons:
* post:
* tags: [Stories]
* summary: Thêm lesson vào story (alternative way)
* security:
* - bearerAuth: []
* parameters:
* - in: path
* name: storyId
* required: true
* schema:
* type: string
* format: uuid
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - lesson_id
* properties:
* lesson_id:
* type: string
* format: uuid
* display_order:
* type: integer
* default: 0
* is_required:
* type: boolean
* default: true
* responses:
* 201:
* description: Lesson đã được thêm vào story
*/
router.post('/:storyId/lessons', storyController.addLessonToStory);
/**
* @swagger
* /api/stories/{storyId}/lessons/{lessonId}:
* delete:
* tags: [Stories]
* summary: Xóa lesson khỏi story
* security:
* - bearerAuth: []
* parameters:
* - in: path
* name: storyId
* required: true
* schema:
* type: string
* format: uuid
* - in: path
* name: lessonId
* required: true
* schema:
* type: string
* format: uuid
* responses:
* 200:
* description: Lesson đã được xóa khỏi story
*/
router.delete('/:storyId/lessons/:lessonId', storyController.removeLessonFromStory);
module.exports = router;