feat: teacher invitation backend
This commit is contained in:
parent
a91e4b2a73
commit
311e76149c
7 changed files with 151 additions and 5 deletions
|
@ -2,6 +2,9 @@ import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity
|
|||
import { mapToClassDTO } from './class.js';
|
||||
import { mapToUserDTO } from './user.js';
|
||||
import { TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation';
|
||||
import {getTeacherInvitationRepository} from "../data/repositories";
|
||||
import {Teacher} from "../entities/users/teacher.entity";
|
||||
import {Class} from "../entities/classes/class.entity";
|
||||
|
||||
export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO {
|
||||
return {
|
||||
|
@ -18,3 +21,9 @@ export function mapToTeacherInvitationDTOIds(invitation: TeacherInvitation): Tea
|
|||
class: invitation.class.classId!,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapToInvitation(sender: Teacher, receiver: Teacher, cls: Class): TeacherInvitation {
|
||||
return getTeacherInvitationRepository().create({
|
||||
sender, receiver, class: cls
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue