2020-10-12 17:51:35 +02:00
|
|
|
const express = require("express");
|
|
|
|
const router = express.Router();
|
|
|
|
|
2020-10-22 17:47:05 +02:00
|
|
|
const auth = require("../middleware/auth");
|
|
|
|
const authAdmin = require("../middleware/authAdmin");
|
2020-10-12 17:51:35 +02:00
|
|
|
|
2020-10-22 17:47:05 +02:00
|
|
|
const answerCtrl = require("../controllers/answer");
|
2020-10-12 17:51:35 +02:00
|
|
|
const groupCtrl = require("../controllers/group");
|
|
|
|
|
2020-10-22 17:47:05 +02:00
|
|
|
router.post("/search", authAdmin, groupCtrl.searchGroups);
|
|
|
|
router.post("/", authAdmin, groupCtrl.create);
|
|
|
|
router.get("/stats", authAdmin, groupCtrl.getStatsGroups);
|
|
|
|
router.put("/:id", authAdmin, groupCtrl.modify);
|
|
|
|
router.delete("/:id", authAdmin, groupCtrl.delete);
|
|
|
|
router.get("/get/:id", authAdmin, groupCtrl.getOneById);
|
2020-10-20 11:01:52 +02:00
|
|
|
router.get("/preview/:id/:token", groupCtrl.showOneGroupById);// prévisualisation HTML, même si groupe "incomplet"
|
2020-10-12 17:51:35 +02:00
|
|
|
|
2020-10-22 17:47:05 +02:00
|
|
|
router.post("/answer/", auth, answerCtrl.createInGroup);
|
|
|
|
router.get("/user/answers/:userId/:groupId", auth, answerCtrl.getAnswersByGroup);
|
|
|
|
|
2020-10-12 17:51:35 +02:00
|
|
|
module.exports = router;
|