Merge remote-tracking branch 'origin/dev' into fix/class-join-request

# Conflicts:
#	backend/src/controllers/classes.ts
#	backend/src/data/questions/question-repository.ts
#	backend/tests/controllers/students.test.ts
#	backend/tests/controllers/teachers.test.ts
This commit is contained in:
Gabriellvl 2025-04-09 12:13:42 +02:00
commit 0a0857deb9
58 changed files with 2058 additions and 277 deletions

View file

@ -1,14 +1,14 @@
import { mapToUserDTO } from './user.js';
import { mapToQuestionDTO, mapToQuestionDTOId } from './question.js';
import { Answer } from '../entities/questions/answer.entity.js';
import { AnswerDTO, AnswerId } from '@dwengo-1/common/interfaces/answer';
import { mapToTeacherDTO } from './teacher.js';
/**
* Convert a Question entity to a DTO format.
*/
export function mapToAnswerDTO(answer: Answer): AnswerDTO {
return {
author: mapToUserDTO(answer.author),
author: mapToTeacherDTO(answer.author),
toQuestion: mapToQuestionDTO(answer.toQuestion),
sequenceNumber: answer.sequenceNumber!,
timestamp: answer.timestamp.toISOString(),

View file

@ -1,9 +1,10 @@
import { Question } from '../entities/questions/question.entity.js';
import { mapToStudentDTO } from './student.js';
import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question';
import { LearningObjectIdentifier } from '@dwengo-1/common/interfaces/learning-content';
import { LearningObjectIdentifierDTO } from '@dwengo-1/common/interfaces/learning-content';
import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js';
function getLearningObjectIdentifier(question: Question): LearningObjectIdentifier {
function getLearningObjectIdentifier(question: Question): LearningObjectIdentifierDTO {
return {
hruid: question.learningObjectHruid,
language: question.learningObjectLanguage,
@ -11,6 +12,14 @@ function getLearningObjectIdentifier(question: Question): LearningObjectIdentifi
};
}
export function mapToLearningObjectID(loID: LearningObjectIdentifierDTO): LearningObjectIdentifier {
return {
hruid: loID.hruid,
language: loID.language,
version: loID.version ?? 1,
};
}
/**
* Convert a Question entity to a DTO format.
*/