updated models and schemas for shipments and dewars
This commit is contained in:
@ -14,23 +14,23 @@ def get_shipments(db: Session):
|
||||
logging.info(f"Total of {len(shipments)} shipments fetched.")
|
||||
for shipment in shipments:
|
||||
if shipment.proposal_id is None:
|
||||
logging.warning(f"Shipment {shipment.shipment_id} is missing proposal ID.")
|
||||
logging.debug(f"Shipment ID: {shipment.shipment_id}, Shipment Name: {shipment.shipment_name}")
|
||||
logging.warning(f"Shipment {shipment.id} is missing proposal ID.")
|
||||
logging.debug(f"Shipment ID: {shipment.id}, Shipment Name: {shipment.shipment_name}")
|
||||
return shipments
|
||||
|
||||
|
||||
def get_shipment_by_id(db: Session, shipment_id: str):
|
||||
logging.info(f"Fetching shipment with ID: {shipment_id}")
|
||||
def get_shipment_by_id(db: Session, id: int):
|
||||
logging.info(f"Fetching shipment with ID: {id}")
|
||||
shipment = db.query(Shipment).options(
|
||||
joinedload(Shipment.contact_person),
|
||||
joinedload(Shipment.return_address),
|
||||
joinedload(Shipment.proposal),
|
||||
joinedload(Shipment.dewars)
|
||||
).filter(Shipment.shipment_id == shipment_id).first()
|
||||
).filter(Shipment.id == id).first()
|
||||
if shipment:
|
||||
if shipment.proposal_id is None:
|
||||
logging.warning(f"Shipment {shipment.shipment_id} is missing proposal ID.")
|
||||
logging.warning(f"Shipment {shipment.id} is missing proposal ID.")
|
||||
logging.info(f"Shipment found: {shipment}")
|
||||
else:
|
||||
logging.warning(f"Shipment with ID {shipment_id} not found.")
|
||||
logging.warning(f"Shipment with ID {id} not found.")
|
||||
return shipment
|
Reference in New Issue
Block a user