diff --git a/backend/package.json b/backend/package.json index 85a4d255..8aae346d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -14,9 +14,10 @@ "test:unit": "vitest --run" }, "dependencies": { - "@mikro-orm/core": "^6.4.6", - "@mikro-orm/postgresql": "^6.4.6", - "@mikro-orm/reflection": "^6.4.6", + "@mikro-orm/core": "6.4.6", + "@mikro-orm/postgresql": "6.4.6", + "@mikro-orm/sqlite": "6.4.6", + "@mikro-orm/reflection": "6.4.6", "dotenv": "^16.4.7", "express": "^5.0.1" }, diff --git a/backend/src/app.ts b/backend/src/app.ts index 532f7734..b21ca26b 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -1,5 +1,5 @@ import express, { Express, Response } from 'express'; -import initORM from './orm.js'; +import { initORM } from './orm.js'; import studentRouter from './routes/student'; import groupRouter from './routes/group'; @@ -30,7 +30,7 @@ app.use('/login', loginRouter); async function startServer() { - await initORM(); + //await initORM(); app.listen(port, () => { console.log(`Server is running at http://localhost:${port}`); diff --git a/backend/src/routes/assignment.ts b/backend/src/routes/assignment.ts index 0a3b4c02..95116243 100644 --- a/backend/src/routes/assignment.ts +++ b/backend/src/routes/assignment.ts @@ -3,7 +3,14 @@ const router = express.Router(); // information about an assignment with id 'id' router.get('/:id', (req, res) => { - res.send('assignment'); + res.json({ + id: req.params.id, + title: 'Dit is een test assignment', + description: 'Een korte beschrijving', + groups: [ '0' ], + learningPath: '0', + class: '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 746e8662..c9fe4259 100644 --- a/backend/src/routes/class.ts +++ b/backend/src/routes/class.ts @@ -3,7 +3,15 @@ const router = express.Router(); // information about an class with id 'id' router.get('/:id', (req, res) => { - res.send('class'); + res.json({ + id: req.params.id, + displayName: 'Klas 4B', + teachers: [ '0' ], + students: [ '0' ], + assignments: [ '0' ], + joinRequests: [ '0' ], + invitations: [ '0' ], + }); }) export default router \ No newline at end of file diff --git a/backend/src/routes/group.ts b/backend/src/routes/group.ts index 36e0be6e..bca20889 100644 --- a/backend/src/routes/group.ts +++ b/backend/src/routes/group.ts @@ -3,12 +3,22 @@ const router = express.Router(); // information about a group (members, ... [TODO DOC]) router.get('/:id', (req, res) => { - res.send('group'); + res.json({ + id: req.params.id, + assignment: '0', + students: [ '0' ], + submissions: [ '0' ], + // reference to other endpoint + // should be less hardcoded + questions: `/group/${req.params.id}/question`, + }); }) // the list of questions a group has made router.get('/:id/question', (req, res) => { - res.send('questions'); + res.json({ + questions: [ '0' ], + }); }) export default router \ No newline at end of file diff --git a/backend/src/routes/login.ts b/backend/src/routes/login.ts index 691a860c..550e6d93 100644 --- a/backend/src/routes/login.ts +++ b/backend/src/routes/login.ts @@ -3,7 +3,12 @@ const router = express.Router(); // returns login paths for IDP router.get('/', (req, res) => { - res.send('login route'); + res.json({ + // dummy variables, needs to be changed + // with IDP endpoints + leerkracht: '/login-leerkracht', + leerling: '/login-leerling', + }); }) export default router \ No newline at end of file diff --git a/backend/src/routes/question.ts b/backend/src/routes/question.ts index 1de0ae42..2218abf9 100644 --- a/backend/src/routes/question.ts +++ b/backend/src/routes/question.ts @@ -3,7 +3,15 @@ const router = express.Router(); // information about an question with id 'id' router.get('/:id', (req, res) => { - res.send('question'); + res.json({ + id: req.params.id, + student: '0', + 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' ], + }); }) export default router \ No newline at end of file diff --git a/backend/src/routes/student.ts b/backend/src/routes/student.ts index 55582992..3c8cd16c 100644 --- a/backend/src/routes/student.ts +++ b/backend/src/routes/student.ts @@ -2,24 +2,32 @@ import express from 'express' const router = express.Router(); // the list of classes a student is in -router.get('/:id/class', (req, res) => { - res.send('classes'); +router.get('/:id/classes', (req, res) => { + res.json({ + classes: [ '0' ], + }); }) // the list of submissions a student has made -router.get('/:id/submission', (req, res) => { - res.send('submissions'); +router.get('/:id/submissions', (req, res) => { + res.json({ + submissions: [ '0' ], + }); }) // the list of assignments a student has -router.get('/:id/assignment', (req, res) => { - res.send('assignments'); +router.get('/:id/assignments', (req, res) => { + res.json({ + assignments: [ '0' ], + }); }) // the list of groups a student is in -router.get('/:id/group', (req, res) => { - res.send('groups'); +router.get('/:id/groups', (req, res) => { + res.json({ + groups: [ '0' ], + }); }) export default router \ No newline at end of file diff --git a/backend/src/routes/submission.ts b/backend/src/routes/submission.ts index dbec9c8b..b830af8b 100644 --- a/backend/src/routes/submission.ts +++ b/backend/src/routes/submission.ts @@ -3,7 +3,14 @@ const router = express.Router(); // information about an submission with id 'id' router.get('/:id', (req, res) => { - res.send('submission'); + res.json({ + id: req.params.id, + student: '0', + group: '0', + time: new Date(2025, 1, 1), + content: 'Wortel 2 is rationeel', + learningObject: '0', + }); }) export default router \ No newline at end of file