fix(backend): Merge-conflicten opgelost.

This commit is contained in:
Gerald Schmittinger 2025-04-09 19:51:15 +02:00
parent 8c387d6811
commit fb3c37ce5a
8 changed files with 79 additions and 49 deletions

View file

@ -1,13 +1,15 @@
import express from 'express';
import { createGroupHandler, getAllGroupsHandler, getGroupHandler, getGroupSubmissionsHandler } from '../controllers/groups.js';
import {onlyAllowIfHasAccessToGroup} from "../middleware/auth/checks/group-auth-checker";
import {teachersOnly} from "../middleware/auth/checks/auth-checks";
import {onlyAllowIfHasAccessToAssignment} from "../middleware/auth/checks/assignment-auth-checks";
const router = express.Router({ mergeParams: true });
// Root endpoint used to search objects
router.get('/', getAllGroupsHandler);
router.get('/', onlyAllowIfHasAccessToAssignment, getAllGroupsHandler);
router.post('/', createGroupHandler);
router.post('/', teachersOnly, onlyAllowIfHasAccessToAssignment, createGroupHandler);
// Information about a group (members, ... [TODO DOC])
router.get('/:groupid', onlyAllowIfHasAccessToGroup, getGroupHandler);

View file

@ -3,6 +3,7 @@ import { getAllLearningObjects, getAttachment, getLearningObject, getLearningObj
import submissionRoutes from './submissions.js';
import questionRoutes from './questions.js';
import {authenticatedOnly} from "../middleware/auth/checks/auth-checks";
const router = express.Router();
@ -16,13 +17,13 @@ const router = express.Router();
// Route 2: list of object data
// Example 2: http://localhost:3000/learningObject?full=true&hruid=un_artificiele_intelligentie
router.get('/', getAllLearningObjects);
router.get('/', authenticatedOnly, getAllLearningObjects);
// Parameter: hruid of learning object
// Query: language
// Route to fetch data of one learning object based on its hruid
// Example: http://localhost:3000/learningObject/un_ai7
router.get('/:hruid', getLearningObject);
router.get('/:hruid', authenticatedOnly, getLearningObject);
router.use('/:hruid/submissions', submissionRoutes);
@ -32,12 +33,12 @@ router.use('/:hruid/:version/questions', questionRoutes);
// Query: language, version (optional)
// Route to fetch the HTML rendering of one learning object based on its hruid.
// Example: http://localhost:3000/learningObject/un_ai7/html
router.get('/:hruid/html', getLearningObjectHTML);
router.get('/:hruid/html', authenticatedOnly, getLearningObjectHTML);
// Parameter: hruid of learning object, name of attachment.
// Query: language, version (optional).
// Route to get the raw data of the attachment for one learning object based on its hruid.
// Example: http://localhost:3000/learningObject/u_test/attachment/testimage.png
router.get('/:hruid/html/:attachmentName', getAttachment);
router.get('/:hruid/html/:attachmentName', authenticatedOnly, getAttachment);
export default router;

View file

@ -1,5 +1,6 @@
import express from 'express';
import { getLearningPaths } from '../controllers/learning-paths.js';
import {authenticatedOnly} from "../middleware/auth/checks/auth-checks";
const router = express.Router();
@ -22,6 +23,6 @@ const router = express.Router();
// Route to fetch learning paths based on a theme
// Example: http://localhost:3000/learningPath?theme=kiks
router.get('/', getLearningPaths);
router.get('/', authenticatedOnly, getLearningPaths);
export default router;