feat: teacher invitation backend

This commit is contained in:
Gabriellvl 2025-04-12 17:55:39 +02:00
parent a91e4b2a73
commit 311e76149c
7 changed files with 151 additions and 5 deletions

View file

@ -0,0 +1,17 @@
import express from "express";
import {
createInvitationHandler,
deleteInvitationForHandler,
getAllInvitationsHandler
} from "../controllers/teacher-invitations";
const router = express.Router({ mergeParams: true });
router.get('/:username', getAllInvitationsHandler);
router.post('/', createInvitationHandler);
router.delete('/:sender/:receiver/:classId', deleteInvitationForHandler);
export default router;

View file

@ -10,6 +10,8 @@ import {
getTeacherStudentHandler,
updateStudentJoinRequestHandler,
} from '../controllers/teachers.js';
import invitationRouter from './teacher-invitations.js';
const router = express.Router();
// Root endpoint used to search objects
@ -32,10 +34,6 @@ router.get('/:username/joinRequests/:classId', getStudentJoinRequestHandler);
router.put('/:username/joinRequests/:classId/:studentUsername', updateStudentJoinRequestHandler);
// Invitations to other classes a teacher received
router.get('/:id/invitations', (_req, res) => {
res.json({
invitations: ['0'],
});
});
router.get('/invitations', invitationRouter);
export default router;