From 71bb6d03ed053c56ebe6a4284505b8a5e660f554 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Mon, 29 Dec 2025 14:00:06 +0100 Subject: [PATCH] fix(client): server utils setting related IDs to null --- client/src/main/java/client/utils/ServerUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/main/java/client/utils/ServerUtils.java b/client/src/main/java/client/utils/ServerUtils.java index 9894c80..736b4cd 100644 --- a/client/src/main/java/client/utils/ServerUtils.java +++ b/client/src/main/java/client/utils/ServerUtils.java @@ -146,7 +146,9 @@ public class ServerUtils { Recipe recipe = objectMapper.readValue(response.body(), Recipe.class); 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); }