._.
This commit is contained in:
parent
69773dc831
commit
c53fdbb063
@ -1,6 +1,8 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class CalculateTotalOrderRequest(BaseModel):
|
class CalculateTotalOrderRequest(BaseModel):
|
||||||
deadline: str
|
deadline: datetime
|
||||||
robotsCount: int
|
robotsCount: int
|
||||||
|
|||||||
@ -85,7 +85,6 @@ class NewTotalOrderService:
|
|||||||
|
|
||||||
new_delivery_accessory = DeliveryAccessory(
|
new_delivery_accessory = DeliveryAccessory(
|
||||||
queue=point_index + 1,
|
queue=point_index + 1,
|
||||||
count=round(accessory.count * self.robotsCount / 100),
|
|
||||||
accessory_id=accessory.id,
|
accessory_id=accessory.id,
|
||||||
delivery_order_id=new_delivery_order.id,
|
delivery_order_id=new_delivery_order.id,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
from sqlalchemy import desc
|
||||||
from sqlalchemy.orm import Session, joinedload
|
from sqlalchemy.orm import Session, joinedload
|
||||||
|
|
||||||
from app.infrastructure.database.models.total_orders import TotalOrder
|
from app.infrastructure.database.models.total_orders import TotalOrder
|
||||||
|
|
||||||
|
|
||||||
@ -13,6 +15,7 @@ class TotalOrdersRepository:
|
|||||||
return self.db.query(TotalOrder) \
|
return self.db.query(TotalOrder) \
|
||||||
.options(joinedload(TotalOrder.user)) \
|
.options(joinedload(TotalOrder.user)) \
|
||||||
.options(joinedload(TotalOrder.status)) \
|
.options(joinedload(TotalOrder.status)) \
|
||||||
|
.order_by(desc(TotalOrder.order_datetime)) \
|
||||||
.all()
|
.all()
|
||||||
|
|
||||||
def get_by_id(self, total_order_id: int):
|
def get_by_id(self, total_order_id: int):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user