fix: Fouten in implementatie van hello-mechanisme opgelost.
This commit is contained in:
parent
59569445c3
commit
57ff2daf6c
5 changed files with 31 additions and 12 deletions
|
@ -53,16 +53,22 @@ export async function getStudent(username: string): Promise<StudentDTO> {
|
|||
return mapToStudentDTO(user);
|
||||
}
|
||||
|
||||
export async function createOrUpdateStudent(userData: StudentDTO, options?: { preventOverwrite: boolean}): Promise<StudentDTO> {
|
||||
export async function createStudent(userData: StudentDTO): Promise<StudentDTO> {
|
||||
const studentRepository = getStudentRepository();
|
||||
|
||||
const newStudent = mapToStudent(userData);
|
||||
await studentRepository.save(newStudent, { preventOverwrite: options?.preventOverwrite ?? true });
|
||||
await studentRepository.save(newStudent);
|
||||
|
||||
return userData;
|
||||
}
|
||||
|
||||
export async function createStudent(userData: StudentDTO): Promise<StudentDTO> {
|
||||
return createOrUpdateStudent(userData, { preventOverwrite: true });
|
||||
export async function createOrUpdateStudent(userData: StudentDTO): Promise<StudentDTO> {
|
||||
await getStudentRepository().upsert({
|
||||
username: userData.username,
|
||||
firstName: userData.firstName,
|
||||
lastName: userData.lastName
|
||||
});
|
||||
return userData;
|
||||
}
|
||||
|
||||
export async function deleteStudent(username: string): Promise<StudentDTO> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue