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:
Adriaan Jacquet 2025-03-08 20:16:57 +01:00
parent cfd0cce2df
commit baf43e91de
6 changed files with 92 additions and 11 deletions

View 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,
};
}

View 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,
};
}