From 96976c47b01728517b098ea3a9ede84833358155 Mon Sep 17 00:00:00 2001 From: hanfi <ccc@spahan.ch> Date: Fri, 15 Sep 2023 20:24:00 +0200 Subject: [PATCH] check delviery and storage on item checkin --- backend/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/main.py b/backend/main.py index db47efe..d9a8d30 100644 --- a/backend/main.py +++ b/backend/main.py @@ -150,8 +150,12 @@ def add_item( db: Session = Depends(get_db), ): check_token(token, None) - print(item) - + delivery = utils.get_delivery_by_uuid(db, item.delivery_uuid) + storage = utils.get_storage_by_name(db, item.storage_name) + if not delivery: + raise HTTPException(status_code=404, detail="Delivery not found") + if not storage: + raise HTTPException(status_code=404, detail="Storage not found") return utils.add_item_for_delivery_at_storage( db, item.delivery_uuid, item.storage_name ) -- GitLab