fix: import errors van gabe gefixt, teacher en student abstractie weggedaan
This commit is contained in:
parent
6404335040
commit
b5390258e3
36 changed files with 9754 additions and 180 deletions
|
@ -17,7 +17,7 @@ export function mapToAnswerDTO(answer: Answer): AnswerDTO {
|
|||
return {
|
||||
author: mapToUserDTO(answer.author),
|
||||
toQuestion: mapToQuestionDTO(answer.toQuestion),
|
||||
sequenceNumber: answer.sequenceNumber,
|
||||
sequenceNumber: answer.sequenceNumber!,
|
||||
timestamp: answer.timestamp.toISOString(),
|
||||
content: answer.content,
|
||||
};
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import { Question } from '../entities/questions/question.entity.js';
|
||||
import {UserDTO} from "./user.js";
|
||||
import {LearningObjectIdentifier} from "../entities/content/learning-object-identifier.js";
|
||||
import { mapToStudentDTO, StudentDTO } from './student.js';
|
||||
import { TeacherDTO } from './teacher.js';
|
||||
|
||||
export interface QuestionDTO {
|
||||
learningObjectIdentifier: LearningObjectIdentifier;
|
||||
sequenceNumber?: number;
|
||||
author: UserDTO;
|
||||
author: StudentDTO;
|
||||
timestamp?: string;
|
||||
content: string;
|
||||
}
|
||||
|
@ -23,7 +25,7 @@ export function mapToQuestionDTO(question: Question): QuestionDTO {
|
|||
return {
|
||||
learningObjectIdentifier,
|
||||
sequenceNumber: question.sequenceNumber!,
|
||||
author: question.author,
|
||||
author: mapToStudentDTO(question.author),
|
||||
timestamp: question.timestamp.toISOString(),
|
||||
content: question.content,
|
||||
};
|
||||
|
|
|
@ -23,10 +23,11 @@ export function mapToStudentDTO(student: Student): StudentDTO {
|
|||
}
|
||||
|
||||
export function mapToStudent(studentData: StudentDTO): Student {
|
||||
const student = new Student();
|
||||
student.username = studentData.username;
|
||||
student.firstName = studentData.firstName;
|
||||
student.lastName = studentData.lastName;
|
||||
const student = new Student(
|
||||
studentData.username,
|
||||
studentData.firstName,
|
||||
studentData.lastName,
|
||||
);
|
||||
|
||||
return student;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import {Student} from "../entities/users/student.entity";
|
|||
export interface SubmissionDTO {
|
||||
learningObjectHruid: string,
|
||||
learningObjectLanguage: Language,
|
||||
learningObjectVersion: string,
|
||||
learningObjectVersion: number,
|
||||
|
||||
submissionNumber?: number,
|
||||
submitter: StudentDTO,
|
||||
|
|
33
backend/src/interfaces/teacher.ts
Normal file
33
backend/src/interfaces/teacher.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { Teacher } from '../entities/users/teacher.entity.js';
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapToTeacher(TeacherData: TeacherDTO): Teacher {
|
||||
const teacher = new Teacher(
|
||||
TeacherData.username,
|
||||
TeacherData.firstName,
|
||||
TeacherData.lastName,
|
||||
);
|
||||
|
||||
return teacher;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue