feat: teacher invitation databank api verbinding aangemaakt, bug in data repo waar teacher invitation repo niet juist werd teruggegeven gefixt
This commit is contained in:
parent
cfd0cce2df
commit
baf43e91de
6 changed files with 92 additions and 11 deletions
25
backend/src/interfaces/teacher-invitation.ts
Normal file
25
backend/src/interfaces/teacher-invitation.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { TeacherInvitation } from "../entities/classes/teacher-invitation.entity";
|
||||
import { ClassDTO, mapToClassDTO } from "./classes";
|
||||
import { mapToTeacherDTO, TeacherDTO } from "./teacher";
|
||||
|
||||
export interface TeacherInvitationDTO {
|
||||
sender: string | TeacherDTO,
|
||||
receiver: string | TeacherDTO,
|
||||
class: string | ClassDTO,
|
||||
}
|
||||
|
||||
export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO {
|
||||
return {
|
||||
sender: mapToTeacherDTO(invitation.sender),
|
||||
receiver: mapToTeacherDTO(invitation.receiver),
|
||||
class: mapToClassDTO(invitation.class),
|
||||
};
|
||||
}
|
||||
|
||||
export function mapToTeacherInvitationDTOIds(invitation: TeacherInvitation): TeacherInvitationDTO {
|
||||
return {
|
||||
sender: invitation.sender.username,
|
||||
receiver: invitation.receiver.username,
|
||||
class: invitation.class.classId,
|
||||
};
|
||||
}
|
23
backend/src/interfaces/teacher.ts
Normal file
23
backend/src/interfaces/teacher.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Teacher } from "../entities/users/teacher.entity";
|
||||
|
||||
export interface TeacherDTO {
|
||||
id: string;
|
||||
username: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
endpoints?: {
|
||||
classes: string;
|
||||
questions: string;
|
||||
invitations: string;
|
||||
groups: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function mapToTeacherDTO(teacher: Teacher): TeacherDTO {
|
||||
return {
|
||||
id: teacher.username,
|
||||
username: teacher.username,
|
||||
firstName: teacher.firstName,
|
||||
lastName: teacher.lastName,
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue