diff options
| author | alex <[email protected]> | 2026-07-16 15:11:25 +0200 |
|---|---|---|
| committer | alex <[email protected]> | 2026-07-16 15:11:25 +0200 |
| commit | 99f71757e2ec8d7cb1b36b0963c4ada3014b3f98 (patch) | |
| tree | c784abf595a226d845f69c60bf02cc68cb60cb42 /order-service | |
| parent | 4bc19be227f95ec06d33bca1b19bfa60afef99c6 (diff) | |
| download | order-inventory-system-99f71757e2ec8d7cb1b36b0963c4ada3014b3f98.tar.xz order-inventory-system-99f71757e2ec8d7cb1b36b0963c4ada3014b3f98.zip | |
added get for orders path
Diffstat (limited to 'order-service')
| -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.", + ) |
