From b85374afa8f59f8749ae966d472b69fb918f22cd Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Thu, 27 Feb 2025 16:30:55 +0100 Subject: [PATCH] feat: root paden toegevoegd aan endpoints --- backend/src/routes/assignment.ts | 10 ++++++++++ backend/src/routes/class.ts | 10 ++++++++++ backend/src/routes/group.ts | 10 ++++++++++ backend/src/routes/question.ts | 10 ++++++++++ backend/src/routes/student.ts | 10 ++++++++++ backend/src/routes/submission.ts | 10 ++++++++++ backend/src/routes/teacher.ts | 12 +++++++++++- 7 files changed, 71 insertions(+), 1 deletion(-) diff --git a/backend/src/routes/assignment.ts b/backend/src/routes/assignment.ts index 38fffe29..fcb6e9da 100644 --- a/backend/src/routes/assignment.ts +++ b/backend/src/routes/assignment.ts @@ -1,6 +1,16 @@ import express from 'express' const router = express.Router(); +// root endpoint used to search objects +router.get('/', (req, res) => { + res.json({ + assignments: [ + '0', + '1', + ] + }); +}); + // information about an assignment with id 'id' router.get('/:id', (req, res) => { res.json({ diff --git a/backend/src/routes/class.ts b/backend/src/routes/class.ts index 4d031587..e554a7f2 100644 --- a/backend/src/routes/class.ts +++ b/backend/src/routes/class.ts @@ -1,6 +1,16 @@ import express from 'express' const router = express.Router(); +// root endpoint used to search objects +router.get('/', (req, res) => { + res.json({ + classes: [ + '0', + '1', + ] + }); +}); + // information about an class with id 'id' router.get('/:id', (req, res) => { res.json({ diff --git a/backend/src/routes/group.ts b/backend/src/routes/group.ts index bca20889..e55dddd1 100644 --- a/backend/src/routes/group.ts +++ b/backend/src/routes/group.ts @@ -1,6 +1,16 @@ import express from 'express' const router = express.Router(); +// root endpoint used to search objects +router.get('/', (req, res) => { + res.json({ + groups: [ + '0', + '1', + ] + }); +}); + // information about a group (members, ... [TODO DOC]) router.get('/:id', (req, res) => { res.json({ diff --git a/backend/src/routes/question.ts b/backend/src/routes/question.ts index 16b1a484..25d168b7 100644 --- a/backend/src/routes/question.ts +++ b/backend/src/routes/question.ts @@ -1,6 +1,16 @@ import express from 'express' const router = express.Router(); +// root endpoint used to search objects +router.get('/', (req, res) => { + res.json({ + questions: [ + '0', + '1', + ] + }); +}); + // information about an question with id 'id' router.get('/:id', (req, res) => { res.json({ diff --git a/backend/src/routes/student.ts b/backend/src/routes/student.ts index b799e6aa..a11c1fbc 100644 --- a/backend/src/routes/student.ts +++ b/backend/src/routes/student.ts @@ -1,6 +1,16 @@ import express from 'express' const router = express.Router(); +// root endpoint used to search objects +router.get('/', (req, res) => { + res.json({ + students: [ + '0', + '1', + ] + }); +}); + // information about a student's profile router.get('/:id', (req, res) => { res.json({ diff --git a/backend/src/routes/submission.ts b/backend/src/routes/submission.ts index b830af8b..8d09cf8e 100644 --- a/backend/src/routes/submission.ts +++ b/backend/src/routes/submission.ts @@ -1,6 +1,16 @@ import express from 'express' const router = express.Router(); +// root endpoint used to search objects +router.get('/', (req, res) => { + res.json({ + submissions: [ + '0', + '1', + ] + }); +}); + // information about an submission with id 'id' router.get('/:id', (req, res) => { res.json({ diff --git a/backend/src/routes/teacher.ts b/backend/src/routes/teacher.ts index 06ab320b..37b3b04b 100644 --- a/backend/src/routes/teacher.ts +++ b/backend/src/routes/teacher.ts @@ -1,8 +1,18 @@ import express from 'express' const router = express.Router(); +// root endpoint used to search objects +router.get('/', (req, res) => { + res.json({ + teachers: [ + '0', + '1', + ] + }); +}); + // information about a teacher -router.get('/:id/', (req, res) => { +router.get('/:id', (req, res) => { res.json({ id: req.params.id, firstName: 'John',