feat: enhance deal management with CRUD operations and improve payload handling
Test / test (push) Successful in 12s
Test / test (pull_request) Successful in 11s

This commit is contained in:
Artem Kashaev
2025-11-27 16:15:47 +05:00
parent a4c3864ef6
commit e6a3a2cc23
3 changed files with 102 additions and 27 deletions
+15 -2
View File
@@ -5,16 +5,29 @@ from decimal import Decimal
from pydantic import BaseModel
from app.models.deal import DealCreate, DealStage, DealStatus
class DealCreatePayload(BaseModel):
contact_id: int
title: str
amount: Decimal | None = None
currency: str | None = None
owner_id: int | None = None
def to_domain(self, *, organization_id: int, fallback_owner: int) -> DealCreate:
return DealCreate(
organization_id=organization_id,
contact_id=self.contact_id,
owner_id=self.owner_id or fallback_owner,
title=self.title,
amount=self.amount,
currency=self.currency,
)
class DealUpdatePayload(BaseModel):
status: str | None = None
stage: str | None = None
status: DealStatus | None = None
stage: DealStage | None = None
amount: Decimal | None = None
currency: str | None = None