feat: teacher get, post en delete route
This commit is contained in:
parent
b8db32161f
commit
6b87722469
6 changed files with 166 additions and 24 deletions
36
backend/src/interfaces/teacher.ts
Normal file
36
backend/src/interfaces/teacher.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { Teacher } from "../entities/users/teacher.entity.js";
|
||||
|
||||
/**
|
||||
* Teacher Data Transfer Object
|
||||
*/
|
||||
export interface TeacherDTO {
|
||||
username: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
endpoints?: {
|
||||
self: string;
|
||||
classes: string;
|
||||
questions: string;
|
||||
invitations: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a Teacher entity to a TeacherDTO
|
||||
*/
|
||||
export function mapToTeacherDTO(teacher: Teacher): TeacherDTO {
|
||||
return {
|
||||
username: teacher.username,
|
||||
firstName: teacher.firstName,
|
||||
lastName: teacher.lastName,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapToTeacher(teacherData: TeacherDTO): Teacher {
|
||||
const teacher = new Teacher();
|
||||
teacher.username = teacherData.username;
|
||||
teacher.firstName = teacherData.firstName;
|
||||
teacher.lastName = teacherData.lastName;
|
||||
|
||||
return teacher;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue