diff options
Diffstat (limited to 'order-service/app/api/v1')
| -rw-r--r-- | order-service/app/api/v1/endpoints/orders.py | 21 |
1 files changed, 21 insertions, 0 deletions
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.", ) + + [email protected]("/{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.", + ) |
