fix: duplicate insertion
This commit is contained in:
		
							parent
							
								
									844cc6a1a1
								
							
						
					
					
						commit
						8f113d02b4
					
				
					 2 changed files with 10 additions and 1 deletions
				
			
		|  | @ -1,10 +1,13 @@ | ||||||
| import { EntityManager } from '@mikro-orm/core'; | import { EntityManager } from '@mikro-orm/core'; | ||||||
| import { Attachment } from '../../../src/entities/content/attachment.entity'; | import { Attachment } from '../../../src/entities/content/attachment.entity'; | ||||||
| import { testLearningObject01 } from './learning-objects.testdata'; | import { testLearningObject01 } from './learning-objects.testdata'; | ||||||
|  | import { LearningObject } from '../../../src/entities/content/learning-object.entity'; | ||||||
| 
 | 
 | ||||||
| export function makeTestAttachments(em: EntityManager): Attachment[] { | export function makeTestAttachments(em: EntityManager): Attachment[] { | ||||||
|  |     const lo = em.merge(LearningObject, testLearningObject01); | ||||||
|  | 
 | ||||||
|     attachment01 = em.create(Attachment, { |     attachment01 = em.create(Attachment, { | ||||||
|         learningObject: testLearningObject01, |         learningObject: lo, | ||||||
|         name: 'attachment01', |         name: 'attachment01', | ||||||
|         mimeType: '', |         mimeType: '', | ||||||
|         content: Buffer.from(''), |         content: Buffer.from(''), | ||||||
|  |  | ||||||
|  | @ -75,6 +75,7 @@ export const testLearningObject02: RequiredEntityData<LearningObject> = { | ||||||
|     description: 'second album', |     description: 'second album', | ||||||
|     contentType: DwengoContentType.TEXT_MARKDOWN, |     contentType: DwengoContentType.TEXT_MARKDOWN, | ||||||
|     keywords: [], |     keywords: [], | ||||||
|  |     uuid: v4(), | ||||||
|     teacherExclusive: false, |     teacherExclusive: false, | ||||||
|     skosConcepts: [], |     skosConcepts: [], | ||||||
|     educationalGoals: [], |     educationalGoals: [], | ||||||
|  | @ -99,6 +100,7 @@ export const testLearningObject03: RequiredEntityData<LearningObject> = { | ||||||
|     description: 'third album', |     description: 'third album', | ||||||
|     contentType: DwengoContentType.TEXT_MARKDOWN, |     contentType: DwengoContentType.TEXT_MARKDOWN, | ||||||
|     keywords: [], |     keywords: [], | ||||||
|  |     uuid: v4(), | ||||||
|     teacherExclusive: false, |     teacherExclusive: false, | ||||||
|     skosConcepts: [], |     skosConcepts: [], | ||||||
|     educationalGoals: [], |     educationalGoals: [], | ||||||
|  | @ -126,6 +128,7 @@ export const testLearningObject04: RequiredEntityData<LearningObject> = { | ||||||
|     description: 'fifth album', |     description: 'fifth album', | ||||||
|     contentType: DwengoContentType.TEXT_MARKDOWN, |     contentType: DwengoContentType.TEXT_MARKDOWN, | ||||||
|     keywords: [], |     keywords: [], | ||||||
|  |     uuid: v4(), | ||||||
|     teacherExclusive: false, |     teacherExclusive: false, | ||||||
|     skosConcepts: [], |     skosConcepts: [], | ||||||
|     educationalGoals: [], |     educationalGoals: [], | ||||||
|  | @ -153,6 +156,7 @@ export const testLearningObject05: RequiredEntityData<LearningObject> = { | ||||||
|     description: 'sixth album', |     description: 'sixth album', | ||||||
|     contentType: DwengoContentType.TEXT_MARKDOWN, |     contentType: DwengoContentType.TEXT_MARKDOWN, | ||||||
|     keywords: [], |     keywords: [], | ||||||
|  |     uuid: v4(), | ||||||
|     teacherExclusive: false, |     teacherExclusive: false, | ||||||
|     skosConcepts: [], |     skosConcepts: [], | ||||||
|     educationalGoals: [], |     educationalGoals: [], | ||||||
|  | @ -173,6 +177,7 @@ export const testLearningObjectMultipleChoice: RequiredEntityData<LearningObject | ||||||
|     title: 'Self-evaluation', |     title: 'Self-evaluation', | ||||||
|     description: "Time to evaluate how well you understand what you've learned so far.", |     description: "Time to evaluate how well you understand what you've learned so far.", | ||||||
|     keywords: ['test'], |     keywords: ['test'], | ||||||
|  |     uuid: v4(), | ||||||
|     teacherExclusive: false, |     teacherExclusive: false, | ||||||
|     skosConcepts: [], |     skosConcepts: [], | ||||||
|     educationalGoals: [], |     educationalGoals: [], | ||||||
|  | @ -199,6 +204,7 @@ export const testLearningObjectEssayQuestion: RequiredEntityData<LearningObject> | ||||||
|     title: 'Reflection', |     title: 'Reflection', | ||||||
|     description: 'Reflect on your learning progress.', |     description: 'Reflect on your learning progress.', | ||||||
|     keywords: ['test'], |     keywords: ['test'], | ||||||
|  |     uuid: v4(), | ||||||
|     teacherExclusive: false, |     teacherExclusive: false, | ||||||
|     skosConcepts: [], |     skosConcepts: [], | ||||||
|     educationalGoals: [], |     educationalGoals: [], | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 laurejablonski
						laurejablonski