fix: DELETE en POST endpoints toegevoegd

This commit is contained in:
Adriaan Jacquet 2025-03-13 19:27:34 +01:00
parent 400a955850
commit 8c7d5e965c
6 changed files with 17 additions and 5 deletions

8
backend/config.js Normal file
View file

@ -0,0 +1,8 @@
// Can be placed in dotenv but found it redundant
// Import dotenv from "dotenv";
// Load .env file
// Dotenv.config();
export const DWENGO_API_BASE = 'https://dwengo.org/backend/api';
export const FALLBACK_LANG = 'nl';
export const FALLBACK_SEQ_NUM = 1;

View file

@ -6,6 +6,7 @@ import learningPathRoutes from './routes/learning-paths.js';
import learningObjectRoutes from './routes/learning-objects.js';
import studentRouter from './routes/students.js';
import teacherRouter from './routes/teachers.js';
import groupRouter from './routes/groups.js';
import assignmentRouter from './routes/assignments.js';
import submissionRouter from './routes/submissions.js';
@ -38,6 +39,7 @@ app.get('/', (_, res: Response) => {
});
app.use('/student', studentRouter);
app.use('/teacher', teacherRouter);
app.use('/group', groupRouter);
app.use('/assignment', assignmentRouter);
app.use('/submission', submissionRouter);

View file

@ -26,7 +26,7 @@ export async function createAssignmentHandler(req: Request<AssignmentParams>, re
if (!assignmentData.description || !assignmentData.language || !assignmentData.learningPath || !assignmentData.title) {
res.status(400).json({
error: 'Missing one or more required fields: title, description, learningPath, title',
error: 'Missing one or more required fields: title, description, learningPath, language',
});
return;
}

View file

@ -2,6 +2,7 @@ import { Request, Response } from 'express';
import {
createStudent,
deleteStudent,
getAllStudents,
getStudent,
getStudentAssignments,
getStudentClasses,
@ -142,7 +143,4 @@ export async function getStudentSubmissionsHandler(req: Request, res: Response):
res.json({
submissions: submissions,
});
}
function getAllStudents(): StudentDTO[] | string[] | PromiseLike<StudentDTO[] | string[]> {
throw new Error('Function not implemented.');
}
}

View file

@ -17,6 +17,8 @@ router.get('/', getAllStudentsHandler);
router.post('/', createStudentHandler);
router.delete('/', deleteStudentHandler);
router.delete('/:username', deleteStudentHandler);
// Information about a student's profile

View file

@ -15,6 +15,8 @@ router.get('/', getAllTeachersHandler);
router.post('/', createTeacherHandler);
router.delete('/', deleteTeacherHandler);
router.get('/:username', getTeacherHandler);
router.delete('/:username', deleteTeacherHandler);