diff --git a/cg/services/orders/order_service/order_service.py b/cg/services/orders/order_service/order_service.py index c6bd4caf45..d3c7a32921 100644 --- a/cg/services/orders/order_service/order_service.py +++ b/cg/services/orders/order_service/order_service.py @@ -3,7 +3,7 @@ from cg.services.orders.order_service.models import OrderQueryParams from cg.services.orders.order_summary_service.dto.order_summary import OrderSummary from cg.services.orders.order_summary_service.order_summary_service import OrderSummaryService -from cg.store.models import Order as DatabaseOrder +from cg.store.models import Order as DbOrder from cg.store.store import Store @@ -13,7 +13,7 @@ def __init__(self, store: Store, status_service: OrderSummaryService) -> None: self.summary_service = status_service def get_order(self, order_id: int) -> Order: - order: DatabaseOrder = self.store.get_order_by_id(order_id) + order: DbOrder = self.store.get_order_by_id(order_id) summary: OrderSummary = self.summary_service.get_summary(order_id) return self._create_order_response(order=order, summary=summary) @@ -27,12 +27,12 @@ def get_orders(self, orders_request: OrdersRequest) -> OrdersResponse: return self._create_orders_response(orders=orders, summaries=summaries, total=total_count) def set_open(self, order_id: int, open: bool) -> Order: - order: DatabaseOrder = self.store.update_order_status(order_id=order_id, open=open) + order: DbOrder = self.store.update_order_status(order_id=order_id, open=open) return self._create_order_response(order) def update_is_open(self, order_id: int, delivered_analyses: int) -> None: """Update the is_open parameter of an order based on the number of delivered analyses.""" - order: DatabaseOrder = self.store.get_order_by_id(order_id) + order: DbOrder = self.store.get_order_by_id(order_id) case_count: int = len(order.cases) if self._is_order_closed(case_count=case_count, delivered_analyses=delivered_analyses): self.set_open(order_id=order_id, open=False) @@ -52,7 +52,7 @@ def _get_order_query_params(orders_request: OrdersRequest) -> OrderQueryParams: ) @staticmethod - def _create_order_response(order: DatabaseOrder, summary: OrderSummary | None = None) -> Order: + def _create_order_response(order: DbOrder, summary: OrderSummary | None = None) -> Order: return Order( customer_id=order.customer.internal_id, ticket_id=order.ticket_id, @@ -64,7 +64,7 @@ def _create_order_response(order: DatabaseOrder, summary: OrderSummary | None = ) def _create_orders_response( - self, orders: list[DatabaseOrder], summaries: list[OrderSummary], total: int + self, orders: list[DbOrder], summaries: list[OrderSummary], total: int ) -> OrdersResponse: orders: list[Order] = [self._create_order_response(order) for order in orders] self._add_summaries(orders=orders, summaries=summaries)