2024-09-13 13:03:35 +00:00
|
|
|
import express from "express";
|
2024-09-30 02:18:18 +00:00
|
|
|
import { getTopics, getTopicById, getTopicBySectionId, createTopic, updateTopicById, deleteTopicById, getCompletedTopicsBySection } from "../../controllers/contentControllers/topic.js";
|
2024-09-13 13:03:35 +00:00
|
|
|
import { verifyLoginUser, adminOnly } from "../../middlewares/User/authUser.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const router = express.Router();
|
|
|
|
|
|
|
|
|
|
router.get("/topic", verifyLoginUser, getTopics);
|
|
|
|
|
|
2024-09-30 02:18:18 +00:00
|
|
|
router.get("/topic/complete", verifyLoginUser, getCompletedTopicsBySection);
|
2024-09-19 10:04:18 +00:00
|
|
|
|
|
|
|
|
router.get("/topic/section/:sectionId", verifyLoginUser, getTopicBySectionId);
|
|
|
|
|
|
2024-09-13 13:03:35 +00:00
|
|
|
router.get("/topic/:id", verifyLoginUser, getTopicById);
|
|
|
|
|
|
|
|
|
|
router.post("/topic", verifyLoginUser, adminOnly, createTopic);
|
|
|
|
|
|
|
|
|
|
router.put("/topic/:id", verifyLoginUser, adminOnly, updateTopicById);
|
|
|
|
|
|
|
|
|
|
router.delete("/topic/:id", verifyLoginUser, adminOnly, deleteTopicById);
|
|
|
|
|
|
|
|
|
|
export default router
|