add changes
This commit is contained in:
35
backend/routes/admin.routes.js
Normal file
35
backend/routes/admin.routes.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const questionController = require('../controllers/question.controller');
|
||||
const { verifyToken, isAdmin } = require('../middleware/auth.middleware');
|
||||
|
||||
/**
|
||||
* @route POST /api/admin/questions
|
||||
* @desc Create a new question (Admin only)
|
||||
* @access Admin
|
||||
* @body {
|
||||
* questionText, questionType, options, correctAnswer,
|
||||
* difficulty, points, explanation, categoryId, tags, keywords
|
||||
* }
|
||||
*/
|
||||
router.post('/questions', verifyToken, isAdmin, questionController.createQuestion);
|
||||
|
||||
/**
|
||||
* @route PUT /api/admin/questions/:id
|
||||
* @desc Update a question (Admin only)
|
||||
* @access Admin
|
||||
* @body {
|
||||
* questionText?, questionType?, options?, correctAnswer?,
|
||||
* difficulty?, points?, explanation?, categoryId?, tags?, keywords?, isActive?
|
||||
* }
|
||||
*/
|
||||
router.put('/questions/:id', verifyToken, isAdmin, questionController.updateQuestion);
|
||||
|
||||
/**
|
||||
* @route DELETE /api/admin/questions/:id
|
||||
* @desc Delete a question - soft delete (Admin only)
|
||||
* @access Admin
|
||||
*/
|
||||
router.delete('/questions/:id', verifyToken, isAdmin, questionController.deleteQuestion);
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user