fix relations

This commit is contained in:
Anika Raemer 2025-10-10 19:41:34 +02:00
parent 58ef7fbc00
commit 0587153829
8 changed files with 64 additions and 79 deletions

View file

@ -41,11 +41,11 @@ export class RecipeHandler {
}
var savedEntity: RecipeEntity;
const recipeId = dto.id
if(recipeId === undefined){
if(recipeId === undefined || recipeId.length === 0){
// create new recipe
const recipeEntity = this.mapper.toEntity(dto)
delete (recipeEntity as any).id;
savedEntity = await this.recipeRepository.create(recipeEntity);
throw new ValidationError("Trying to update recipe without ID!")
} else {
// save existing Recipe
// First: Load current version of recipe from database