Merge remote-tracking branch 'origin/refactor/common' into feat/user-routes-test-interface-refactor

# Conflicts:
#	backend/src/controllers/students.ts
#	backend/src/controllers/teachers.ts
#	backend/src/interfaces/answer.ts
#	backend/src/interfaces/question.ts
#	backend/src/interfaces/student.ts
#	backend/src/services/classes.ts
#	backend/src/services/questions.ts
#	backend/src/services/students.ts
#	backend/src/services/teachers.ts
This commit is contained in:
Gabriellvl 2025-04-02 10:16:10 +02:00
commit 4ca568e738
57 changed files with 270 additions and 190 deletions

View file

@ -1,14 +1,7 @@
import { mapToUserDTO, UserDTO } from './user.js';
import {mapToQuestionDTO, mapToQuestionDTOId, QuestionDTO, QuestionId} from './question.js';
import { mapToUserDTO } from './user.js';
import { mapToQuestionDTO, mapToQuestionDTOId } from './question.js';
import { Answer } from '../entities/questions/answer.entity.js';
export interface AnswerDTO {
author: UserDTO;
toQuestion: QuestionDTO;
sequenceNumber: number;
timestamp: string;
content: string;
}
import { AnswerDTO, AnswerId } from 'dwengo-1-common/src/interfaces/answer';
/**
* Convert a Question entity to a DTO format.
@ -23,16 +16,10 @@ export function mapToAnswerDTO(answer: Answer): AnswerDTO {
};
}
export interface AnswerId {
author: string;
toQuestion: QuestionId;
sequenceNumber: number;
}
export function mapToAnswerDTOId(answer: Answer): AnswerId {
export function mapToAnswerId(answer: AnswerDTO): AnswerId {
return {
author: answer.author.username,
toQuestion: mapToQuestionDTOId(answer.toQuestion),
sequenceNumber: answer.sequenceNumber!,
sequenceNumber: answer.sequenceNumber,
};
}