diff --git a/backend/src/routes/assignment.ts b/backend/src/routes/assignment.ts index 95116243..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({ @@ -9,8 +19,36 @@ router.get('/:id', (req, res) => { description: 'Een korte beschrijving', groups: [ '0' ], learningPath: '0', - class: '0' + class: '0', + links: { + self: `${req.baseUrl}/${req.params.id}`, + submissions: `${req.baseUrl}/${req.params.id}`, + }, }); }) +router.get('/:id/submissions', (req, res) => { + res.json({ + submissions: [ + '0' + ], + }); +}); + +router.get('/:id/groups', (req, res) => { + res.json({ + groups: [ + '0' + ], + }); +}); + +router.get('/:id/questions', (req, res) => { + res.json({ + questions: [ + '0' + ], + }); +}); + export default router \ No newline at end of file diff --git a/backend/src/routes/class.ts b/backend/src/routes/class.ts index c9fe4259..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({ @@ -8,9 +18,37 @@ router.get('/:id', (req, res) => { displayName: 'Klas 4B', teachers: [ '0' ], students: [ '0' ], - assignments: [ '0' ], joinRequests: [ '0' ], - invitations: [ '0' ], + links: { + self: `${req.baseUrl}/${req.params.id}`, + classes: `${req.baseUrl}/${req.params.id}/invitations`, + questions: `${req.baseUrl}/${req.params.id}/assignments`, + students: `${req.baseUrl}/${req.params.id}/students`, + } + }); +}) + +router.get('/:id/invitations', (req, res) => { + res.json({ + invitations: [ + '0' + ], + }); +}) + +router.get('/:id/assignments', (req, res) => { + res.json({ + assignments: [ + '0' + ], + }); +}) + +router.get('/:id/students', (req, res) => { + res.json({ + students: [ + '0' + ], }); }) 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 2218abf9..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({ @@ -9,9 +19,20 @@ router.get('/:id', (req, res) => { group: '0', time: new Date(2025, 1, 1), content: 'Zijn alle gehele getallen groter dan 2 gelijk aan de som van 2 priemgetallen????', - answers: [ '0' ], - learningObject: [ '0' ], + learningObject: '0', + links: { + self: `${req.baseUrl}/${req.params.id}`, + answers: `${req.baseUrl}/${req.params.id}/answers`, + } }); }) +router.get('/:id/answers', (req, res) => { + res.json({ + answers: [ + '0' + ], + }) +}) + export default router \ No newline at end of file diff --git a/backend/src/routes/student.ts b/backend/src/routes/student.ts index 3c8cd16c..a11c1fbc 100644 --- a/backend/src/routes/student.ts +++ b/backend/src/routes/student.ts @@ -1,6 +1,32 @@ 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({ + id: req.params.id, + firstName: 'Jimmy', + lastName: 'Faster', + username: 'JimmyFaster2', + endpoints: { + classes: `/student/${req.params.id}/classes`, + questions: `/student/${req.params.id}/submissions`, + invitations: `/student/${req.params.id}/assignments`, + groups: `/student/${req.params.id}/groups`, + }, + }); +}); + // the list of classes a student is in router.get('/:id/classes', (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 new file mode 100644 index 00000000..37b3b04b --- /dev/null +++ b/backend/src/routes/teacher.ts @@ -0,0 +1,58 @@ +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) => { + res.json({ + id: req.params.id, + firstName: 'John', + lastName: 'Doe', + username: 'JohnDoe1', + links: { + self: `${req.baseUrl}/${req.params.id}`, + classes: `${req.baseUrl}/${req.params.id}/classes`, + questions: `${req.baseUrl}/${req.params.id}/questions`, + invitations: `${req.baseUrl}/${req.params.id}/invitations`, + }, + }); +}) + +// the questions students asked a teacher +router.get('/:id/questions', (req, res) => { + res.json({ + questions: [ + '0' + ], + }); +}); + +// invitations to other classes a teacher received +router.get('/:id/invitations', (req, res) => { + res.json({ + invitations: [ + '0' + ], + }); +}); + +// a list with ids of classes a teacher is in +router.get('/:id/classes', (req, res) => { + res.json({ + classes: [ + '0' + ], + }); +}); + + +export default router \ No newline at end of file