fix(backend): preventOverwrite terug toegevoegd nadat ik het per ongeluk verwijderd heb

This commit is contained in:
Gerald Schmittinger 2025-04-19 17:06:13 +02:00
parent f7029ad25b
commit 034582e4c7
3 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
import { Request, Response } from 'express';
import {
createClassJoinRequest,
createOrUpdateStudent,
createStudent,
deleteClassJoinRequest,
deleteStudent,
getAllStudents,
@ -42,7 +42,7 @@ export async function createStudentHandler(req: Request, res: Response): Promise
const userData = req.body as StudentDTO;
const student = await createOrUpdateStudent(userData);
const student = await createStudent(userData);
res.json({ student });
}

View file

@ -62,7 +62,7 @@ export async function createStudent(userData: StudentDTO): Promise<StudentDTO> {
const studentRepository = getStudentRepository();
const newStudent = mapToStudent(userData);
await studentRepository.save(newStudent);
await studentRepository.save(newStudent, { preventOverwrite: true });
return userData;
}

View file

@ -61,7 +61,7 @@ export async function createTeacher(userData: TeacherDTO): Promise<TeacherDTO> {
const teacherRepository: TeacherRepository = getTeacherRepository();
const newTeacher = mapToTeacher(userData);
await teacherRepository.save(newTeacher);
await teacherRepository.save(newTeacher, { preventOverwrite: true });
return mapToTeacherDTO(newTeacher);
}