Merge branch 'dev' into docs/swagger-autogen
This commit is contained in:
commit
d020c68600
79 changed files with 2795 additions and 494 deletions
|
@ -1,45 +0,0 @@
|
|||
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({
|
||||
id: req.params.id,
|
||||
title: 'Dit is een test assignment',
|
||||
description: 'Een korte beschrijving',
|
||||
groups: ['0'],
|
||||
learningPath: '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;
|
30
backend/src/routes/assignments.ts
Normal file
30
backend/src/routes/assignments.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import express from 'express';
|
||||
import {
|
||||
createAssignmentHandler,
|
||||
getAllAssignmentsHandler,
|
||||
getAssignmentHandler,
|
||||
getAssignmentsSubmissionsHandler,
|
||||
} from '../controllers/assignments.js';
|
||||
import groupRouter from './groups.js';
|
||||
|
||||
const router = express.Router({ mergeParams: true });
|
||||
|
||||
// Root endpoint used to search objects
|
||||
router.get('/', getAllAssignmentsHandler);
|
||||
|
||||
router.post('/', createAssignmentHandler);
|
||||
|
||||
// Information about an assignment with id 'id'
|
||||
router.get('/:id', getAssignmentHandler);
|
||||
|
||||
router.get('/:id/submissions', getAssignmentsSubmissionsHandler);
|
||||
|
||||
router.get('/:id/questions', (req, res) => {
|
||||
res.json({
|
||||
questions: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
router.use('/:assignmentid/groups', groupRouter);
|
||||
|
||||
export default router;
|
|
@ -1,46 +0,0 @@
|
|||
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({
|
||||
id: req.params.id,
|
||||
displayName: 'Klas 4B',
|
||||
teachers: ['0'],
|
||||
students: ['0'],
|
||||
joinRequests: ['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'],
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
27
backend/src/routes/classes.ts
Normal file
27
backend/src/routes/classes.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import express from 'express';
|
||||
import {
|
||||
createClassHandler,
|
||||
getAllClassesHandler,
|
||||
getClassHandler,
|
||||
getClassStudentsHandler,
|
||||
getTeacherInvitationsHandler,
|
||||
} from '../controllers/classes.js';
|
||||
import assignmentRouter from './assignments.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// Root endpoint used to search objects
|
||||
router.get('/', getAllClassesHandler);
|
||||
|
||||
router.post('/', createClassHandler);
|
||||
|
||||
// Information about an class with id 'id'
|
||||
router.get('/:id', getClassHandler);
|
||||
|
||||
router.get('/:id/teacher-invitations', getTeacherInvitationsHandler);
|
||||
|
||||
router.get('/:id/students', getClassStudentsHandler);
|
||||
|
||||
router.use('/:classid/assignments', assignmentRouter);
|
||||
|
||||
export default router;
|
|
@ -1,31 +0,0 @@
|
|||
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({
|
||||
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.json({
|
||||
questions: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
23
backend/src/routes/groups.ts
Normal file
23
backend/src/routes/groups.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import express from 'express';
|
||||
import { createGroupHandler, getAllGroupsHandler, getGroupHandler, getGroupSubmissionsHandler } from '../controllers/groups.js';
|
||||
|
||||
const router = express.Router({ mergeParams: true });
|
||||
|
||||
// Root endpoint used to search objects
|
||||
router.get('/', getAllGroupsHandler);
|
||||
|
||||
router.post('/', createGroupHandler);
|
||||
|
||||
// Information about a group (members, ... [TODO DOC])
|
||||
router.get('/:groupid', getGroupHandler);
|
||||
|
||||
router.get('/:groupid', getGroupSubmissionsHandler);
|
||||
|
||||
// The list of questions a group has made
|
||||
router.get('/:id/questions', (req, res) => {
|
||||
res.json({
|
||||
questions: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
|
@ -1,6 +1,9 @@
|
|||
import express from 'express';
|
||||
import { getAllLearningObjects, getAttachment, getLearningObject, getLearningObjectHTML } from '../controllers/learning-objects.js';
|
||||
|
||||
import submissionRoutes from './submissions.js';
|
||||
import questionRoutes from './questions.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// DWENGO learning objects
|
||||
|
@ -21,6 +24,10 @@ router.get('/', getAllLearningObjects);
|
|||
// Example: http://localhost:3000/learningObject/un_ai7
|
||||
router.get('/:hruid', getLearningObject);
|
||||
|
||||
router.use('/:hruid/submissions', submissionRoutes);
|
||||
|
||||
router.use('/:hruid/:version/questions', questionRoutes);
|
||||
|
||||
// Parameter: hruid of learning object
|
||||
// Query: language, version (optional)
|
||||
// Route to fetch the HTML rendering of one learning object based on its hruid.
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
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({
|
||||
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????',
|
||||
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;
|
25
backend/src/routes/questions.ts
Normal file
25
backend/src/routes/questions.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import express from 'express';
|
||||
import {
|
||||
createQuestionHandler,
|
||||
deleteQuestionHandler,
|
||||
getAllQuestionsHandler,
|
||||
getQuestionAnswersHandler,
|
||||
getQuestionHandler,
|
||||
} from '../controllers/questions.js';
|
||||
const router = express.Router({ mergeParams: true });
|
||||
|
||||
// Query language
|
||||
|
||||
// Root endpoint used to search objects
|
||||
router.get('/', getAllQuestionsHandler);
|
||||
|
||||
router.post('/', createQuestionHandler);
|
||||
|
||||
router.delete('/:seq', deleteQuestionHandler);
|
||||
|
||||
// Information about a question with id
|
||||
router.get('/:seq', getQuestionHandler);
|
||||
|
||||
router.get('/answers/:seq', getQuestionAnswersHandler);
|
||||
|
||||
export default router;
|
|
@ -1,55 +0,0 @@
|
|||
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({
|
||||
classes: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
// The list of submissions a student has made
|
||||
router.get('/:id/submissions', (req, res) => {
|
||||
res.json({
|
||||
submissions: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
// The list of assignments a student has
|
||||
router.get('/:id/assignments', (req, res) => {
|
||||
res.json({
|
||||
assignments: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
// The list of groups a student is in
|
||||
router.get('/:id/groups', (req, res) => {
|
||||
res.json({
|
||||
groups: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
46
backend/src/routes/students.ts
Normal file
46
backend/src/routes/students.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import express from 'express';
|
||||
import {
|
||||
createStudentHandler,
|
||||
deleteStudentHandler,
|
||||
getAllStudentsHandler,
|
||||
getStudentAssignmentsHandler,
|
||||
getStudentClassesHandler,
|
||||
getStudentGroupsHandler,
|
||||
getStudentHandler,
|
||||
getStudentSubmissionsHandler,
|
||||
} from '../controllers/students.js';
|
||||
import { getStudentGroups } from '../services/students.js';
|
||||
const router = express.Router();
|
||||
|
||||
// Root endpoint used to search objects
|
||||
router.get('/', getAllStudentsHandler);
|
||||
|
||||
router.post('/', createStudentHandler);
|
||||
|
||||
router.delete('/', deleteStudentHandler);
|
||||
|
||||
router.delete('/:username', deleteStudentHandler);
|
||||
|
||||
// Information about a student's profile
|
||||
router.get('/:username', getStudentHandler);
|
||||
|
||||
// The list of classes a student is in
|
||||
router.get('/:id/classes', getStudentClassesHandler);
|
||||
|
||||
// The list of submissions a student has made
|
||||
router.get('/:id/submissions', getStudentSubmissionsHandler);
|
||||
|
||||
// The list of assignments a student has
|
||||
router.get('/:id/assignments', getStudentAssignmentsHandler);
|
||||
|
||||
// The list of groups a student is in
|
||||
router.get('/:id/groups', getStudentGroupsHandler);
|
||||
|
||||
// A list of questions a user has created
|
||||
router.get('/:id/questions', (req, res) => {
|
||||
res.json({
|
||||
questions: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
|
@ -1,23 +0,0 @@
|
|||
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({
|
||||
id: req.params.id,
|
||||
student: '0',
|
||||
group: '0',
|
||||
time: new Date(2025, 1, 1),
|
||||
content: 'Wortel 2 is rationeel',
|
||||
learningObject: '0',
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
19
backend/src/routes/submissions.ts
Normal file
19
backend/src/routes/submissions.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import express from 'express';
|
||||
import { createSubmissionHandler, deleteSubmissionHandler, getSubmissionHandler } from '../controllers/submissions.js';
|
||||
const router = express.Router({ mergeParams: true });
|
||||
|
||||
// Root endpoint used to search objects
|
||||
router.get('/', (req, res) => {
|
||||
res.json({
|
||||
submissions: ['0', '1'],
|
||||
});
|
||||
});
|
||||
|
||||
router.post('/:id', createSubmissionHandler);
|
||||
|
||||
// Information about an submission with id 'id'
|
||||
router.get('/:id', getSubmissionHandler);
|
||||
|
||||
router.delete('/:id', deleteSubmissionHandler);
|
||||
|
||||
export default router;
|
|
@ -1,48 +0,0 @@
|
|||
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;
|
37
backend/src/routes/teachers.ts
Normal file
37
backend/src/routes/teachers.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import express from 'express';
|
||||
import {
|
||||
createTeacherHandler,
|
||||
deleteTeacherHandler,
|
||||
getAllTeachersHandler,
|
||||
getTeacherClassHandler,
|
||||
getTeacherHandler,
|
||||
getTeacherQuestionHandler,
|
||||
getTeacherStudentHandler,
|
||||
} from '../controllers/teachers.js';
|
||||
const router = express.Router();
|
||||
|
||||
// Root endpoint used to search objects
|
||||
router.get('/', getAllTeachersHandler);
|
||||
|
||||
router.post('/', createTeacherHandler);
|
||||
|
||||
router.delete('/', deleteTeacherHandler);
|
||||
|
||||
router.get('/:username', getTeacherHandler);
|
||||
|
||||
router.delete('/:username', deleteTeacherHandler);
|
||||
|
||||
router.get('/:username/classes', getTeacherClassHandler);
|
||||
|
||||
router.get('/:username/students', getTeacherStudentHandler);
|
||||
|
||||
router.get('/:username/questions', getTeacherQuestionHandler);
|
||||
|
||||
// Invitations to other classes a teacher received
|
||||
router.get('/:id/invitations', (req, res) => {
|
||||
res.json({
|
||||
invitations: ['0'],
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
Loading…
Add table
Add a link
Reference in a new issue