feat: teacher invitation backend
This commit is contained in:
parent
a91e4b2a73
commit
311e76149c
7 changed files with 151 additions and 5 deletions
17
backend/src/routes/teacher-invitations.ts
Normal file
17
backend/src/routes/teacher-invitations.ts
Normal 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;
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue