From 1a164b29f090f43e435f4d956230a66bce4ee3d0 Mon Sep 17 00:00:00 2001 From: Maxson Almeida Date: Tue, 15 Oct 2024 00:06:54 -0300 Subject: [PATCH] =?UTF-8?q?Refatorar=20rota=20de=20exclus=C3=A3o=20de=20pe?= =?UTF-8?q?dido=20para=20utilizar=20identificador=20como=20par=C3=A2metro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/order/order_controller.py | 6 +++--- src/apps/order/order_service.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apps/order/order_controller.py b/src/apps/order/order_controller.py index b706582..009e265 100644 --- a/src/apps/order/order_controller.py +++ b/src/apps/order/order_controller.py @@ -26,10 +26,10 @@ async def add_order(self, order: OrderCreateDTO) -> Order: print ("Exception - add_order", exception) handlers_order_expections(exception) - @Delete("/delete") - async def delete_order(self, order: OrderFindDTO) -> Order: + @Delete("/{identifier}") + async def delete_order(self, identifier: str) -> Order: try: - return await self.order_service.delete_order(order) + return await self.order_service.delete_order(identifier) except Exception as exception: print ("Exception - delete_order", exception) handlers_order_expections(exception) diff --git a/src/apps/order/order_service.py b/src/apps/order/order_service.py index 3c558e6..b4f656c 100644 --- a/src/apps/order/order_service.py +++ b/src/apps/order/order_service.py @@ -95,7 +95,7 @@ async def get_order_by_identifier(self, identifier: str) -> Order: @db_request_handler - async def delete_order(self, order: OrderFindDTO) -> Order: + async def delete_order(self, identifier) -> Order: order_find = OrderFindDTO(identifier=identifier) order = await OrderEntity.find_one(OrderEntity.identifier == order_find.identifier)