style: fix linting issues met Prettier
This commit is contained in:
parent
e78849f568
commit
400a955850
40 changed files with 321 additions and 700 deletions
|
@ -1,6 +1,6 @@
|
|||
import {mapToUserDTO, UserDTO} from "./user.js";
|
||||
import {mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId} from "./question.js";
|
||||
import {Answer} from "../entities/questions/answer.entity.js";
|
||||
import { mapToUserDTO, UserDTO } from './user.js';
|
||||
import { mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId } from './question.js';
|
||||
import { Answer } from '../entities/questions/answer.entity.js';
|
||||
|
||||
export interface AnswerDTO {
|
||||
author: UserDTO;
|
||||
|
@ -33,6 +33,6 @@ export function mapToAnswerId(answer: AnswerDTO): AnswerId {
|
|||
return {
|
||||
author: answer.author.username,
|
||||
toQuestion: mapToQuestionId(answer.toQuestion),
|
||||
sequenceNumber: answer.sequenceNumber
|
||||
}
|
||||
sequenceNumber: answer.sequenceNumber,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -27,15 +27,11 @@ export function mapToClassDTO(cls: Class): ClassDTO {
|
|||
};
|
||||
}
|
||||
|
||||
export function mapToClass(
|
||||
classData: ClassDTO,
|
||||
students: Collection<Student>,
|
||||
teachers: Collection<Teacher>
|
||||
): Class {
|
||||
export function mapToClass(classData: ClassDTO, students: Collection<Student>, teachers: Collection<Teacher>): Class {
|
||||
const cls = new Class();
|
||||
cls.displayName = classData.displayName;
|
||||
cls.students = students;
|
||||
cls.teachers = teachers;
|
||||
|
||||
|
||||
return cls;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Question } from '../entities/questions/question.entity.js';
|
||||
import {UserDTO} from "./user.js";
|
||||
import {LearningObjectIdentifier} from "../entities/content/learning-object-identifier.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';
|
||||
|
||||
|
@ -19,8 +19,8 @@ export function mapToQuestionDTO(question: Question): QuestionDTO {
|
|||
const learningObjectIdentifier = {
|
||||
hruid: question.learningObjectHruid,
|
||||
language: question.learningObjectLanguage,
|
||||
version: question.learningObjectVersion
|
||||
}
|
||||
version: question.learningObjectVersion,
|
||||
};
|
||||
|
||||
return {
|
||||
learningObjectIdentifier,
|
||||
|
@ -42,4 +42,3 @@ export function mapToQuestionId(question: QuestionDTO): QuestionId {
|
|||
sequenceNumber: question.sequenceNumber!,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,7 @@ export function mapToStudentDTO(student: Student): StudentDTO {
|
|||
}
|
||||
|
||||
export function mapToStudent(studentData: StudentDTO): Student {
|
||||
const student = new Student(
|
||||
studentData.username,
|
||||
studentData.firstName,
|
||||
studentData.lastName,
|
||||
);
|
||||
const student = new Student(studentData.username, studentData.firstName, studentData.lastName);
|
||||
|
||||
return student;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import { Submission } from "../entities/assignments/submission.entity.js";
|
||||
import { Language } from "../entities/content/language.js";
|
||||
import { GroupDTO, mapToGroupDTO } from "./group.js";
|
||||
import {mapToStudent, mapToStudentDTO, StudentDTO} from "./student.js";
|
||||
import {mapToUser} from "./user";
|
||||
import {Student} from "../entities/users/student.entity";
|
||||
import { Submission } from '../entities/assignments/submission.entity.js';
|
||||
import { Language } from '../entities/content/language.js';
|
||||
import { GroupDTO, mapToGroupDTO } from './group.js';
|
||||
import { mapToStudent, mapToStudentDTO, StudentDTO } from './student.js';
|
||||
import { mapToUser } from './user';
|
||||
import { Student } from '../entities/users/student.entity';
|
||||
|
||||
export interface SubmissionDTO {
|
||||
learningObjectHruid: string,
|
||||
learningObjectLanguage: Language,
|
||||
learningObjectVersion: number,
|
||||
learningObjectHruid: string;
|
||||
learningObjectLanguage: Language;
|
||||
learningObjectVersion: number;
|
||||
|
||||
submissionNumber?: number,
|
||||
submitter: StudentDTO,
|
||||
time?: Date,
|
||||
group?: GroupDTO,
|
||||
content: string,
|
||||
submissionNumber?: number;
|
||||
submitter: StudentDTO;
|
||||
time?: Date;
|
||||
group?: GroupDTO;
|
||||
content: string;
|
||||
}
|
||||
|
||||
export function mapToSubmissionDTO(submission: Submission): SubmissionDTO {
|
||||
|
@ -28,7 +28,7 @@ export function mapToSubmissionDTO(submission: Submission): SubmissionDTO {
|
|||
time: submission.submissionTime,
|
||||
group: submission.onBehalfOf ? mapToGroupDTO(submission.onBehalfOf) : undefined,
|
||||
content: submission.content,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function mapToSubmission(submissionDTO: SubmissionDTO): Submission {
|
||||
|
@ -37,7 +37,7 @@ export function mapToSubmission(submissionDTO: SubmissionDTO): Submission {
|
|||
submission.learningObjectLanguage = submissionDTO.learningObjectLanguage;
|
||||
submission.learningObjectVersion = submissionDTO.learningObjectVersion;
|
||||
// Submission.submissionNumber = submissionDTO.submissionNumber;
|
||||
submission.submitter = mapToStudent(submissionDTO.submitter) ;
|
||||
submission.submitter = mapToStudent(submissionDTO.submitter);
|
||||
// Submission.submissionTime = submissionDTO.time;
|
||||
// Submission.onBehalfOf = submissionDTO.group!;
|
||||
// TODO fix group
|
||||
|
|
|
@ -8,9 +8,7 @@ export interface TeacherInvitationDTO {
|
|||
class: string | ClassDTO;
|
||||
}
|
||||
|
||||
export function mapToTeacherInvitationDTO(
|
||||
invitation: TeacherInvitation
|
||||
): TeacherInvitationDTO {
|
||||
export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO {
|
||||
return {
|
||||
sender: mapToUserDTO(invitation.sender),
|
||||
receiver: mapToUserDTO(invitation.receiver),
|
||||
|
@ -18,9 +16,7 @@ export function mapToTeacherInvitationDTO(
|
|||
};
|
||||
}
|
||||
|
||||
export function mapToTeacherInvitationDTOIds(
|
||||
invitation: TeacherInvitation
|
||||
): TeacherInvitationDTO {
|
||||
export function mapToTeacherInvitationDTOIds(invitation: TeacherInvitation): TeacherInvitationDTO {
|
||||
return {
|
||||
sender: invitation.sender.username,
|
||||
receiver: invitation.receiver.username,
|
||||
|
|
|
@ -23,11 +23,7 @@ export function mapToTeacherDTO(teacher: Teacher): TeacherDTO {
|
|||
}
|
||||
|
||||
export function mapToTeacher(TeacherData: TeacherDTO): Teacher {
|
||||
const teacher = new Teacher(
|
||||
TeacherData.username,
|
||||
TeacherData.firstName,
|
||||
TeacherData.lastName,
|
||||
);
|
||||
const teacher = new Teacher(TeacherData.username, TeacherData.firstName, TeacherData.lastName);
|
||||
|
||||
return teacher;
|
||||
}
|
||||
|
|
|
@ -22,10 +22,7 @@ export function mapToUserDTO(user: User): UserDTO {
|
|||
};
|
||||
}
|
||||
|
||||
export function mapToUser<T extends User>(
|
||||
userData: UserDTO,
|
||||
userInstance: T
|
||||
): T {
|
||||
export function mapToUser<T extends User>(userData: UserDTO, userInstance: T): T {
|
||||
userInstance.username = userData.username;
|
||||
userInstance.firstName = userData.firstName;
|
||||
userInstance.lastName = userData.lastName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue