feat(backend): Validatie bestemming overgangen
This commit is contained in:
		
							parent
							
								
									226c9786dd
								
							
						
					
					
						commit
						300c0b721d
					
				
					 1 changed files with 3 additions and 4 deletions
				
			
		|  | @ -13,6 +13,7 @@ import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | ||||||
| import { mapToTeacher } from '../../interfaces/teacher.js'; | import { mapToTeacher } from '../../interfaces/teacher.js'; | ||||||
| import { Collection } from '@mikro-orm/core'; | import { Collection } from '@mikro-orm/core'; | ||||||
| import { NotFoundException } from '../../exceptions/not-found-exception.js'; | import { NotFoundException } from '../../exceptions/not-found-exception.js'; | ||||||
|  | import { BadRequestException } from '../../exceptions/bad-request-exception.js'; | ||||||
| 
 | 
 | ||||||
| const userContentPrefix = getEnvVar(envVars.UserContentPrefix); | const userContentPrefix = getEnvVar(envVars.UserContentPrefix); | ||||||
| const allProviders = [dwengoApiLearningPathProvider, databaseLearningPathProvider]; | const allProviders = [dwengoApiLearningPathProvider, databaseLearningPathProvider]; | ||||||
|  | @ -61,10 +62,8 @@ export function mapToLearningPath(dto: LearningPath, adminsDto: TeacherDTO[]): L | ||||||
|                         condition: transDto.condition ?? 'true', |                         condition: transDto.condition ?? 'true', | ||||||
|                     }); |                     }); | ||||||
|                 } |                 } | ||||||
|                 return undefined; |                 throw new BadRequestException(`Invalid transition destination: ${JSON.stringify(transDto.next)}: This learning object does not exist in this learning path.`); | ||||||
|             }) |             }); | ||||||
|             .filter((it) => it) |  | ||||||
|             .map((it) => it!); |  | ||||||
| 
 | 
 | ||||||
|         fromNode.transitions = new Collection<LearningPathTransition>(fromNode, transitions); |         fromNode.transitions = new Collection<LearningPathTransition>(fromNode, transitions); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Gerald Schmittinger
						Gerald Schmittinger