Merge remote-tracking branch 'origin/dev' into feat/endpoints-beschermen-met-authenticatie-#105
# Conflicts: # backend/src/controllers/questions.ts # backend/src/data/questions/question-repository.ts # backend/src/interfaces/question.ts # backend/src/services/questions.ts # common/src/interfaces/question.ts
This commit is contained in:
commit
8c387d6811
59 changed files with 2100 additions and 292 deletions
|
@ -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(),
|
||||
|
|
|
@ -3,8 +3,9 @@ import { mapToStudentDTO } from './student.js';
|
|||
import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question';
|
||||
import { LearningObjectIdentifier } from '@dwengo-1/common/interfaces/learning-content';
|
||||
import { mapToGroupDTOId } from './group';
|
||||
import { LearningObjectIdentifierDTO } from '@dwengo-1/common/interfaces/learning-content';
|
||||
|
||||
function getLearningObjectIdentifier(question: Question): LearningObjectIdentifier {
|
||||
function getLearningObjectIdentifier(question: Question): LearningObjectIdentifierDTO {
|
||||
return {
|
||||
hruid: question.learningObjectHruid,
|
||||
language: question.learningObjectLanguage,
|
||||
|
@ -12,6 +13,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.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue