feat: Mechanisme voor automatische aanmaak en update van accounts aangemaakt.

This commit is contained in:
Gerald Schmittinger 2025-04-08 14:24:57 +02:00
parent 6cb8a1b98f
commit 9339eca9cf
9 changed files with 84 additions and 23 deletions

View file

@ -52,11 +52,11 @@ export async function getStudent(username: string): Promise<StudentDTO> {
return mapToStudentDTO(user);
}
export async function createStudent(userData: StudentDTO): Promise<StudentDTO> {
export async function createStudent(userData: StudentDTO, allowUpdate: boolean = false): Promise<StudentDTO> {
const studentRepository = getStudentRepository();
const newStudent = mapToStudent(userData);
await studentRepository.save(newStudent, { preventOverwrite: true });
await studentRepository.save(newStudent, { preventOverwrite: !allowUpdate });
return userData;
}