feat: вфыв

This commit is contained in:
2024-07-20 09:32:22 +03:00
parent e7235021f9
commit 6b09251141
27 changed files with 536 additions and 119 deletions

View File

@@ -240,13 +240,21 @@ class DealService(BaseService):
async def update_general_info(self, request: DealUpdateGeneralInfoRequest) -> DealUpdateGeneralInfoResponse:
try:
deal = await self.session.scalar(select(Deal).where(Deal.id == request.deal_id))
deal: Deal = await self.session.scalar(select(Deal).where(Deal.id == request.deal_id))
if not deal:
raise HTTPException(status_code=404, detail="Сделка не найдена")
deal.name = request.data.name
deal.comment = request.data.comment
deal.is_deleted = request.data.is_deleted
deal.is_completed = request.data.is_completed
# Updating shipping warehouse
shipping_warehouse_service = ShippingWarehouseService(self.session)
shipping_warehouse = await shipping_warehouse_service.get_by_name(request.data.shipping_warehouse)
if not shipping_warehouse and request.data.shipping_warehouse:
shipping_warehouse = await shipping_warehouse_service.create_by_name(request.data.shipping_warehouse)
deal.shipping_warehouse = shipping_warehouse
await self.session.commit()
return DealUpdateGeneralInfoResponse(ok=True, message='Данные о сделке успешно обновлены')
except Exception as e: