separating fields from other constants

This commit is contained in:
2025-10-27 18:34:10 +01:00
parent cbec6cc856
commit 25f41cf66b
15 changed files with 255 additions and 281 deletions

View File

@@ -5,6 +5,7 @@ import static de.srsoftware.tools.Optionals.is0;
import static de.srsoftware.tools.Optionals.nullIfEmpty;
import static de.srsoftware.umbrella.core.ConnectionProvider.connect;
import static de.srsoftware.umbrella.core.Constants.*;
import static de.srsoftware.umbrella.core.Field.ITEM;
import static de.srsoftware.umbrella.core.ModuleRegistry.companyService;
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
@@ -311,7 +312,7 @@ public class StockModule extends BaseHandler implements StockService {
private boolean postProperty(UmbrellaUser user, HttpExchange ex) throws IOException {
var json = json(ex);
if (!(json.get(FIELD_ITEM) instanceof JSONObject itemData)) throw missingFieldException(FIELD_ITEM);
if (!(json.get(ITEM) instanceof JSONObject itemData)) throw missingFieldException(ITEM);
if (!(itemData.get(ID) instanceof Number itemId)) throw missingFieldException(ID);
if (!(json.get("add_prop") instanceof JSONObject propData)) throw missingFieldException("add_prop");
if (!propData.has(VALUE)) throw missingFieldException(VALUE);