feat: service en controller laag voor getStudent geimplementeerd
This commit is contained in:
parent
8c22b72b22
commit
f5b6a5a604
5 changed files with 459 additions and 2917 deletions
18
backend/src/services/students.ts
Normal file
18
backend/src/services/students.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { getStudentRepository } from "../data/repositories";
|
||||
import { StudentDTO } from "../interfaces/students";
|
||||
|
||||
export async function getStudentById(username: string): Promise<StudentDTO | null> {
|
||||
const studentRepository = getStudentRepository();
|
||||
const student = await studentRepository.findByUsername(username);
|
||||
|
||||
if (!student) return null;
|
||||
else {
|
||||
return {
|
||||
id: student.username,
|
||||
username: student.username,
|
||||
firstName: student.firstName,
|
||||
lastName: student.lastName,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in a new issue