can now return the dewar to its slot

This commit is contained in:
GotthardG 2024-11-28 10:32:00 +01:00
parent a42124a56f
commit 99bc808ca1

View File

@ -38,6 +38,11 @@ async def return_to_storage(data: LogisticsEventCreate, db: Session = Depends(ge
logger.error(f"Dewar not found for unique ID: {data.dewar_qr_code}")
raise HTTPException(status_code=404, detail="Dewar not found")
original_slot = db.query(SlotModel).filter(SlotModel.dewar_unique_id == data.dewar_qr_code).first()
if original_slot and original_slot.qr_code != data.location_qr_code:
logger.error(f"Dewar {data.dewar_qr_code} is associated with slot {original_slot.qr_code}")
raise HTTPException(status_code=400, detail=f"Dewar {data.dewar_qr_code} is associated with a different slot {original_slot.qr_code}.")
slot = db.query(SlotModel).filter(SlotModel.qr_code == data.location_qr_code).first()
if not slot:
logger.error(f"Slot not found for QR code: {data.location_qr_code}")