fix(client): server utils setting related IDs to null
This commit is contained in:
parent
d497ed108e
commit
71bb6d03ed
1 changed files with 3 additions and 1 deletions
|
|
@ -146,7 +146,9 @@ public class ServerUtils {
|
||||||
Recipe recipe = objectMapper.readValue(response.body(), Recipe.class);
|
Recipe recipe = objectMapper.readValue(response.body(), Recipe.class);
|
||||||
|
|
||||||
recipe.setId(null); // otherwise the id is the same as the original, and that's wrong
|
recipe.setId(null); // otherwise the id is the same as the original, and that's wrong
|
||||||
|
// now that each recipeIngredient has its own ID in the database,
|
||||||
|
// we set that to null too to force a new persist value on the server
|
||||||
|
recipe.getIngredients().forEach(ingredient -> ingredient.setId(null));
|
||||||
return addRecipe(recipe);
|
return addRecipe(recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue