This commit is contained in:
@@ -51,6 +51,32 @@ const { authenticateToken } = require('../middleware/auth');
|
||||
*/
|
||||
router.get('/', lessonController.getAllLessons);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/lessons/chapter/{chapter_id}:
|
||||
* get:
|
||||
* tags: [Lessons]
|
||||
* summary: Lấy tất cả bài học trong một chapter
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: chapter_id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* format: uuid
|
||||
* description: UUID của chapter
|
||||
* - in: query
|
||||
* name: include_unpublished
|
||||
* schema:
|
||||
* type: boolean
|
||||
* default: false
|
||||
* description: Bao gồm cả bài chưa publish
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Danh sách bài học trong chapter
|
||||
*/
|
||||
router.get('/chapter/:chapter_id', lessonController.getLessonsByChapter);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/lessons/{id}:
|
||||
@@ -138,7 +164,7 @@ router.get('/:id/games', lessonController.getMatchingGames);
|
||||
* 201:
|
||||
* description: Tạo bài học thành công
|
||||
*/
|
||||
router.post('/', authenticateToken, lessonController.createLesson);
|
||||
router.post('/', lessonController.createLesson);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
@@ -165,7 +191,7 @@ router.post('/', authenticateToken, lessonController.createLesson);
|
||||
* 200:
|
||||
* description: Cập nhật thành công
|
||||
*/
|
||||
router.put('/:id', authenticateToken, lessonController.updateLesson);
|
||||
router.put('/:id', lessonController.updateLesson);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
@@ -186,7 +212,7 @@ router.put('/:id', authenticateToken, lessonController.updateLesson);
|
||||
* 200:
|
||||
* description: Xóa thành công
|
||||
*/
|
||||
router.delete('/:id', authenticateToken, lessonController.deleteLesson);
|
||||
router.delete('/:id', lessonController.deleteLesson);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
@@ -219,6 +245,6 @@ router.delete('/:id', authenticateToken, lessonController.deleteLesson);
|
||||
* 200:
|
||||
* description: Hoàn thành bài học
|
||||
*/
|
||||
router.post('/:id/complete', authenticateToken, lessonController.completeLesson);
|
||||
router.post('/:id/complete', lessonController.completeLesson);
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user