fix(backend): Formatting + .env.development.example

npm run format uitgevoerd, .env.development.example toegevoegd.
This commit is contained in:
Gerald Schmittinger 2025-02-26 22:03:53 +01:00
parent 4e883a1a18
commit 48c8ce7c57
36 changed files with 499 additions and 331 deletions

View file

@ -1,10 +1,14 @@
import {DwengoEntityRepository} from "../dwengo-entity-repository";
import {Answer} from "../../entities/questions/answer.entity";
import {Question} from "../../entities/questions/question.entity";
import {Teacher} from "../../entities/users/teacher.entity";
import { DwengoEntityRepository } from '../dwengo-entity-repository';
import { Answer } from '../../entities/questions/answer.entity';
import { Question } from '../../entities/questions/question.entity';
import { Teacher } from '../../entities/users/teacher.entity';
export class AnswerRepository extends DwengoEntityRepository<Answer> {
public createAnswer(answer: {toQuestion: Question, author: Teacher, content: string}): Promise<Answer> {
public createAnswer(answer: {
toQuestion: Question;
author: Teacher;
content: string;
}): Promise<Answer> {
let answerEntity = new Answer();
answerEntity.toQuestion = answer.toQuestion;
answerEntity.author = answer.author;
@ -14,13 +18,16 @@ export class AnswerRepository extends DwengoEntityRepository<Answer> {
public findAllAnswersToQuestion(question: Question): Promise<Answer[]> {
return this.findAll({
where: { toQuestion: question },
orderBy: { sequenceNumber: "ASC" }
orderBy: { sequenceNumber: 'ASC' },
});
}
public removeAnswerByQuestionAndSequenceNumber(question: Question, sequenceNumber: number): Promise<void> {
public removeAnswerByQuestionAndSequenceNumber(
question: Question,
sequenceNumber: number
): Promise<void> {
return this.deleteWhere({
toQuestion: question,
sequenceNumber: sequenceNumber
sequenceNumber: sequenceNumber,
});
}
}

View file

@ -1,10 +1,14 @@
import {DwengoEntityRepository} from "../dwengo-entity-repository";
import {Question} from "../../entities/questions/question.entity";
import {LearningObjectIdentifier} from "../../entities/content/learning-object-identifier";
import {Student} from "../../entities/users/student.entity";
import { DwengoEntityRepository } from '../dwengo-entity-repository';
import { Question } from '../../entities/questions/question.entity';
import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier';
import { Student } from '../../entities/users/student.entity';
export class QuestionRepository extends DwengoEntityRepository<Question> {
public createQuestion(question: {loId: LearningObjectIdentifier, author: Student, content: string}): Promise<Question> {
public createQuestion(question: {
loId: LearningObjectIdentifier;
author: Student;
content: string;
}): Promise<Question> {
let questionEntity = new Question();
questionEntity.learningObjectHruid = question.loId.hruid;
questionEntity.learningObjectLanguage = question.loId.language;
@ -13,24 +17,29 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
questionEntity.content = question.content;
return this.insert(questionEntity);
}
public findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise<Question[]> {
public findAllQuestionsAboutLearningObject(
loId: LearningObjectIdentifier
): Promise<Question[]> {
return this.findAll({
where: {
learningObjectHruid: loId.hruid,
learningObjectLanguage: loId.language,
learningObjectVersion: loId.version
learningObjectVersion: loId.version,
},
orderBy: {
sequenceNumber: "ASC"
}
sequenceNumber: 'ASC',
},
});
}
public removeQuestionByLearningObjectAndSequenceNumber(loId: LearningObjectIdentifier, sequenceNumber: number): Promise<void> {
public removeQuestionByLearningObjectAndSequenceNumber(
loId: LearningObjectIdentifier,
sequenceNumber: number
): Promise<void> {
return this.deleteWhere({
learningObjectHruid: loId.hruid,
learningObjectLanguage: loId.language,
learningObjectVersion: loId.version,
sequenceNumber: sequenceNumber
})
sequenceNumber: sequenceNumber,
});
}
}