feat: Mechanisme voor automatische aanmaak en update van accounts aangemaakt.
This commit is contained in:
parent
6cb8a1b98f
commit
9339eca9cf
9 changed files with 84 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue