fix(backend): preventOverwrite terug toegevoegd nadat ik het per ongeluk verwijderd heb
This commit is contained in:
parent
f7029ad25b
commit
034582e4c7
3 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import {
|
import {
|
||||||
createClassJoinRequest,
|
createClassJoinRequest,
|
||||||
createOrUpdateStudent,
|
createStudent,
|
||||||
deleteClassJoinRequest,
|
deleteClassJoinRequest,
|
||||||
deleteStudent,
|
deleteStudent,
|
||||||
getAllStudents,
|
getAllStudents,
|
||||||
|
@ -42,7 +42,7 @@ export async function createStudentHandler(req: Request, res: Response): Promise
|
||||||
|
|
||||||
const userData = req.body as StudentDTO;
|
const userData = req.body as StudentDTO;
|
||||||
|
|
||||||
const student = await createOrUpdateStudent(userData);
|
const student = await createStudent(userData);
|
||||||
res.json({ student });
|
res.json({ student });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ export async function createStudent(userData: StudentDTO): Promise<StudentDTO> {
|
||||||
const studentRepository = getStudentRepository();
|
const studentRepository = getStudentRepository();
|
||||||
|
|
||||||
const newStudent = mapToStudent(userData);
|
const newStudent = mapToStudent(userData);
|
||||||
await studentRepository.save(newStudent);
|
await studentRepository.save(newStudent, { preventOverwrite: true });
|
||||||
|
|
||||||
return userData;
|
return userData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ export async function createTeacher(userData: TeacherDTO): Promise<TeacherDTO> {
|
||||||
const teacherRepository: TeacherRepository = getTeacherRepository();
|
const teacherRepository: TeacherRepository = getTeacherRepository();
|
||||||
|
|
||||||
const newTeacher = mapToTeacher(userData);
|
const newTeacher = mapToTeacher(userData);
|
||||||
await teacherRepository.save(newTeacher);
|
await teacherRepository.save(newTeacher, { preventOverwrite: true });
|
||||||
|
|
||||||
return mapToTeacherDTO(newTeacher);
|
return mapToTeacherDTO(newTeacher);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue