style: fix linting issues met Prettier

This commit is contained in:
Lint Action 2025-04-06 21:41:42 +00:00
parent 7ddde18d6c
commit 9136ff0313
11 changed files with 60 additions and 78 deletions

View file

@ -1,11 +1,11 @@
import {getAnswerRepository} from "../data/repositories";
import {Answer} from "../entities/questions/answer.entity";
import {mapToAnswerDTO, mapToAnswerDTOId} from "../interfaces/answer";
import {fetchTeacher} from "./teachers";
import {fetchQuestion} from "./questions";
import {QuestionId} from "@dwengo-1/common/interfaces/question";
import {AnswerData, AnswerDTO, AnswerId} from "@dwengo-1/common/interfaces/answer";
import {NotFoundException} from "../exceptions/not-found-exception";
import { getAnswerRepository } from '../data/repositories';
import { Answer } from '../entities/questions/answer.entity';
import { mapToAnswerDTO, mapToAnswerDTOId } from '../interfaces/answer';
import { fetchTeacher } from './teachers';
import { fetchQuestion } from './questions';
import { QuestionId } from '@dwengo-1/common/interfaces/question';
import { AnswerData, AnswerDTO, AnswerId } from '@dwengo-1/common/interfaces/answer';
import { NotFoundException } from '../exceptions/not-found-exception';
export async function getAnswersByQuestion(questionId: QuestionId, full: boolean): Promise<AnswerDTO[] | AnswerId[]> {
const answerRepository = getAnswerRepository();
@ -27,7 +27,9 @@ export async function createAnswer(questionId: QuestionId, answerData: AnswerDat
const content = answerData.content;
const answer = await answerRepository.createAnswer({
toQuestion, author, content
toQuestion,
author,
content,
});
return mapToAnswerDTO(answer);
}
@ -37,7 +39,7 @@ async function fetchAnswer(questionId: QuestionId, sequenceNumber: number): Prom
const question = await fetchQuestion(questionId);
const answer = await answerRepository.findAnswer(question, sequenceNumber);
if (!answer){
if (!answer) {
throw new NotFoundException('Answer with questionID and sequence number not found');
}
@ -59,7 +61,7 @@ export async function deleteAnswer(questionId: QuestionId, sequenceNumber: numbe
return mapToAnswerDTO(answer);
}
export async function updateAnswer(questionId: QuestionId, sequenceNumber: number, answerData: AnswerData){
export async function updateAnswer(questionId: QuestionId, sequenceNumber: number, answerData: AnswerData) {
const answerRepository = getAnswerRepository();
const answer = await fetchAnswer(questionId, sequenceNumber);

View file

@ -1,12 +1,12 @@
import { getQuestionRepository } from '../data/repositories.js';
import {mapToLearningObjectID, mapToQuestionDTO, mapToQuestionDTOId} from '../interfaces/question.js';
import { mapToLearningObjectID, mapToQuestionDTO, mapToQuestionDTOId } from '../interfaces/question.js';
import { Question } from '../entities/questions/question.entity.js';
import { QuestionRepository } from '../data/questions/question-repository.js';
import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js';
import {QuestionData, QuestionDTO, QuestionId} from '@dwengo-1/common/interfaces/question';
import {NotFoundException} from "../exceptions/not-found-exception";
import {FALLBACK_VERSION_NUM} from "../config";
import {fetchStudent} from "./students";
import { QuestionData, QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question';
import { NotFoundException } from '../exceptions/not-found-exception';
import { FALLBACK_VERSION_NUM } from '../config';
import { fetchStudent } from './students';
export async function getAllQuestions(id: LearningObjectIdentifier, full: boolean): Promise<QuestionDTO[] | QuestionId[]> {
const questionRepository: QuestionRepository = getQuestionRepository();
@ -26,7 +26,7 @@ export async function fetchQuestion(questionId: QuestionId): Promise<Question> {
questionId.sequenceNumber
);
if (!question){
if (!question) {
throw new NotFoundException('Question with loID and sequence number not found');
}
@ -44,7 +44,9 @@ export async function createQuestion(loId: LearningObjectIdentifier, questionDat
const content = questionData.content;
const question = await questionRepository.createQuestion({
loId, author, content
loId,
author,
content,
});
return mapToQuestionDTO(question);
@ -70,5 +72,3 @@ export async function updateQuestion(questionId: QuestionId, questionData: Quest
const newQuestion = await questionRepository.updateContent(question, questionData.content);
return mapToQuestionDTO(newQuestion);
}