fix: mikrORM fix voor questions

This commit is contained in:
Timo De Meyst 2025-05-13 10:12:32 +02:00
parent 50cfcb69a6
commit c8d1112db2
2 changed files with 11 additions and 7 deletions

View file

@ -18,13 +18,14 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
content: question.content,
timestamp: new Date(),
});
await this.insert(questionEntity);
questionEntity.learningObjectHruid = question.loId.hruid;
questionEntity.learningObjectLanguage = question.loId.language;
questionEntity.learningObjectVersion = question.loId.version;
questionEntity.author = question.author;
questionEntity.inGroup = question.inGroup;
questionEntity.content = question.content;
return await this.insert(questionEntity);
return questionEntity;
}
public async findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise<Question[]> {
return this.findAll({

View file

@ -139,12 +139,15 @@
(assignment) => assignment.learningPath === props.hruid && assignment.language === props.language,
);
});
const loID: ComputedRef<LearningObjectIdentifierDTO> = computed(() => {
return {
hruid: props.learningObjectHruid as string,
language: props.language,
version: currentNode.value?.version
};
});
const loID: LearningObjectIdentifierDTO = {
hruid: props.learningObjectHruid as string,
language: props.language,
};
const createQuestionMutation = useCreateQuestionMutation(loID);
const createQuestionMutation = useCreateQuestionMutation(loID.value);
const groupsQueryResult = useStudentGroupsQuery(authService.authState.user?.profile.preferred_username);
const questionInput = ref("");
@ -159,7 +162,7 @@
const questionData: QuestionData = {
author: authService.authState.user?.profile.preferred_username,
content: questionInput.value,
inGroup: group, //TODO: POST response zegt dat dit null is???
inGroup: group,
};
if (questionInput.value !== "") {
createQuestionMutation.mutate(questionData, {