From 99f71757e2ec8d7cb1b36b0963c4ada3014b3f98 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 16 Jul 2026 15:11:25 +0200 Subject: added get for orders path --- order-service/app/api/v1/endpoints/orders.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'order-service') diff --git a/order-service/app/api/v1/endpoints/orders.py b/order-service/app/api/v1/endpoints/orders.py index dc81835..beff480 100644 --- a/order-service/app/api/v1/endpoints/orders.py +++ b/order-service/app/api/v1/endpoints/orders.py @@ -52,3 +52,24 @@ def create_order(order_in: OrderCreate, db: Session = Depends(deps.get_db)): status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Could not initialize checkout process.", ) + + +@router.get("/{order_id}", response_model=OrderOut) +def read_order(order_id: int, db: Session = Depends(deps.get_db)): + """ + Submit a new customer order. + Returns status code 202 (Accepted) as the order is pending verification. + """ + try: + order = db.query(Order).filter(Order.id == order_id).first() + if not order: + raise HTTPException(status_code=404, detail="Order not found") + return order + + except Exception as e: + db.rollback() + print(e) + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail="Could not read the order.", + ) -- cgit v1.2.3