backend_adaptive_learning/routes/contents/section.js

21 lines
851 B
JavaScript

import express from "express";
import { getSections, getSectionById, getSectionForAdmin, createSection, updateSectionById, deleteSectionById } from "../../controllers/contentControllers/section.js";
import { verifyLoginUser, adminOnly } from "../../middlewares/User/authUser.js";
import handleUpload from '../../middlewares/uploadSection.js';
const router = express.Router();
router.get("/section", verifyLoginUser, getSections);
router.get("/section/admin", verifyLoginUser, getSectionForAdmin);
router.get("/section/:id", verifyLoginUser, getSectionById);
router.post("/section", verifyLoginUser, adminOnly, handleUpload, createSection);
router.put('/section/update/:id', verifyLoginUser, adminOnly, handleUpload, updateSectionById);
router.delete('/section/delete/:id', verifyLoginUser, adminOnly, deleteSectionById);
export default router