fix relations
This commit is contained in:
parent
58ef7fbc00
commit
0587153829
8 changed files with 64 additions and 79 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue