feat(backend): '/auth/hello' endpoint toegevoegd

This commit is contained in:
Gerald Schmittinger 2025-04-19 11:27:51 +02:00
parent c2f3a6169a
commit 2b3f6b5e7a
6 changed files with 40 additions and 7 deletions

View file

@ -53,14 +53,18 @@ export async function getStudent(username: string): Promise<StudentDTO> {
return mapToStudentDTO(user);
}
export async function createStudent(userData: StudentDTO): Promise<StudentDTO> {
export async function createOrUpdateStudent(userData: StudentDTO, options?: { preventOverwrite: boolean}): Promise<StudentDTO> {
const studentRepository = getStudentRepository();
const newStudent = mapToStudent(userData);
await studentRepository.save(newStudent, { preventOverwrite: true });
await studentRepository.save(newStudent, { preventOverwrite: options?.preventOverwrite ?? true });
return userData;
}
export async function createStudent(userData: StudentDTO): Promise<StudentDTO> {
return createOrUpdateStudent(userData, { preventOverwrite: true });
}
export async function deleteStudent(username: string): Promise<StudentDTO> {
const studentRepository = getStudentRepository();