|
4 | 4 |
|
5 | 5 | from fastapi import APIRouter, HTTPException, Request, status |
6 | 6 | from fastapi.datastructures import URL |
7 | | -from fastapi.responses import Response |
8 | 7 | from returns.maybe import Maybe, Some |
9 | 8 | from returns.result import Failure, Success |
10 | 9 |
|
|
16 | 15 | Order, |
17 | 16 | OrderCollection, |
18 | 17 | OrderStatuses, |
19 | | - OrderStatusPayload, |
20 | 18 | ) |
21 | 19 | from stapi_fastapi.models.product import Product, ProductsCollection |
22 | 20 | from stapi_fastapi.models.root import RootResponse |
@@ -101,14 +99,6 @@ def __init__( |
101 | 99 | tags=["Orders"], |
102 | 100 | ) |
103 | 101 |
|
104 | | - self.add_api_route( |
105 | | - "/orders/{order_id}/statuses", |
106 | | - self.set_order_status, |
107 | | - methods=["POST"], |
108 | | - name=f"{self.name}:set-order-status", |
109 | | - tags=["Orders"], |
110 | | - ) |
111 | | - |
112 | 102 | def get_root(self, request: Request) -> RootResponse: |
113 | 103 | return RootResponse( |
114 | 104 | id="STAPI API", |
@@ -245,24 +235,6 @@ async def get_order_statuses( |
245 | 235 | case _: |
246 | 236 | raise AssertionError("Expected code to be unreachable") |
247 | 237 |
|
248 | | - async def set_order_status( |
249 | | - self, order_id: str, payload: OrderStatusPayload, request: Request |
250 | | - ) -> Response: |
251 | | - match await self.backend.set_order_status(order_id, payload, request): |
252 | | - case Success(_): |
253 | | - return Response(status_code=status.HTTP_202_ACCEPTED) |
254 | | - case Failure(e): |
255 | | - logger.error( |
256 | | - "An error occurred while setting order status: %s", |
257 | | - traceback.format_exception(e), |
258 | | - ) |
259 | | - raise HTTPException( |
260 | | - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, |
261 | | - detail="Error setting Order Status", |
262 | | - ) |
263 | | - case x: |
264 | | - raise AssertionError(f"Expected code to be unreachable {x}") |
265 | | - |
266 | 238 | def add_product(self: Self, product: Product) -> None: |
267 | 239 | # Give the include a prefix from the product router |
268 | 240 | product_router = ProductRouter(product, self) |
|
0 commit comments