fix: duplicate insertion

This commit is contained in:
laurejablonski 2025-04-27 10:59:04 +02:00
parent 844cc6a1a1
commit 8f113d02b4
2 changed files with 10 additions and 1 deletions

View file

@ -1,10 +1,13 @@
import { EntityManager } from '@mikro-orm/core';
import { Attachment } from '../../../src/entities/content/attachment.entity';
import { testLearningObject01 } from './learning-objects.testdata';
import { LearningObject } from '../../../src/entities/content/learning-object.entity';
export function makeTestAttachments(em: EntityManager): Attachment[] {
const lo = em.merge(LearningObject, testLearningObject01);
attachment01 = em.create(Attachment, {
learningObject: testLearningObject01,
learningObject: lo,
name: 'attachment01',
mimeType: '',
content: Buffer.from(''),

View file

@ -75,6 +75,7 @@ export const testLearningObject02: RequiredEntityData<LearningObject> = {
description: 'second album',
contentType: DwengoContentType.TEXT_MARKDOWN,
keywords: [],
uuid: v4(),
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
@ -99,6 +100,7 @@ export const testLearningObject03: RequiredEntityData<LearningObject> = {
description: 'third album',
contentType: DwengoContentType.TEXT_MARKDOWN,
keywords: [],
uuid: v4(),
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
@ -126,6 +128,7 @@ export const testLearningObject04: RequiredEntityData<LearningObject> = {
description: 'fifth album',
contentType: DwengoContentType.TEXT_MARKDOWN,
keywords: [],
uuid: v4(),
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
@ -153,6 +156,7 @@ export const testLearningObject05: RequiredEntityData<LearningObject> = {
description: 'sixth album',
contentType: DwengoContentType.TEXT_MARKDOWN,
keywords: [],
uuid: v4(),
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
@ -173,6 +177,7 @@ export const testLearningObjectMultipleChoice: RequiredEntityData<LearningObject
title: 'Self-evaluation',
description: "Time to evaluate how well you understand what you've learned so far.",
keywords: ['test'],
uuid: v4(),
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
@ -199,6 +204,7 @@ export const testLearningObjectEssayQuestion: RequiredEntityData<LearningObject>
title: 'Reflection',
description: 'Reflect on your learning progress.',
keywords: ['test'],
uuid: v4(),
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],