This commit is contained in:
@@ -247,4 +247,137 @@ router.delete('/:id', lessonController.deleteLesson);
|
||||
*/
|
||||
router.post('/:id/complete', lessonController.completeLesson);
|
||||
|
||||
// ============ Nested Story Routes ============
|
||||
/**
|
||||
* @swagger
|
||||
* /api/lessons/{lessonId}/stories:
|
||||
* get:
|
||||
* tags: [Lessons]
|
||||
* summary: Lấy danh sách stories trong một lesson
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: lessonId
|
||||
* 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 stories trong lesson
|
||||
*/
|
||||
router.get('/:lessonId/stories', lessonController.getStoriesByLesson);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/lessons/{lessonId}/stories:
|
||||
* post:
|
||||
* tags: [Lessons]
|
||||
* summary: Thêm story vào lesson
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: lessonId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* format: uuid
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - story_id
|
||||
* properties:
|
||||
* story_id:
|
||||
* type: string
|
||||
* format: uuid
|
||||
* display_order:
|
||||
* type: integer
|
||||
* default: 0
|
||||
* is_required:
|
||||
* type: boolean
|
||||
* default: true
|
||||
* responses:
|
||||
* 201:
|
||||
* description: Story đã được thêm vào lesson
|
||||
*/
|
||||
router.post('/:lessonId/stories', lessonController.addStoryToLesson);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/lessons/{lessonId}/stories/{storyId}:
|
||||
* put:
|
||||
* tags: [Lessons]
|
||||
* summary: Cập nhật story trong lesson (display_order, is_required)
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: lessonId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* format: uuid
|
||||
* - in: path
|
||||
* name: storyId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* format: uuid
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* display_order:
|
||||
* type: integer
|
||||
* is_required:
|
||||
* type: boolean
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Cập nhật thành công
|
||||
*/
|
||||
router.put('/:lessonId/stories/:storyId', lessonController.updateStoryInLesson);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/lessons/{lessonId}/stories/{storyId}:
|
||||
* delete:
|
||||
* tags: [Lessons]
|
||||
* summary: Xóa story khỏi lesson
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: lessonId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* format: uuid
|
||||
* - in: path
|
||||
* name: storyId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* format: uuid
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Story đã được xóa khỏi lesson
|
||||
*/
|
||||
router.delete('/:lessonId/stories/:storyId', lessonController.removeStoryFromLesson);
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user