закупы в бэк

This commit is contained in:
Artem Tsyrulnikov
2026-01-06 19:25:01 +03:00
parent cb6bdd5580
commit 87643735a1
10 changed files with 334 additions and 30 deletions

View File

@@ -304,8 +304,12 @@ class Postgres(DatabaseBase, Database):
invite_link_type: domain.purchase.InviteLinkType,
*,
status: domain.PurchaseChannelStatus | None = None,
planned_cost: float | None = None,
comment: str | None = None,
placement_at: datetime.datetime | None = None,
cost_type: domain.purchase.CostType | None = None,
cost_value: float | None = None,
cost_before_bargain: float | None = None,
format: str | None = None,
) -> domain.PurchaseChannel:
defaults: dict[str, object | None] = {
'invite_link': invite_link,
@@ -313,10 +317,18 @@ class Postgres(DatabaseBase, Database):
}
if status is not None:
defaults['status'] = status
if planned_cost is not None:
defaults['planned_cost'] = planned_cost
if comment is not None:
defaults['comment'] = comment
if placement_at is not None:
defaults['placement_at'] = placement_at
if cost_type is not None:
defaults['cost_type'] = cost_type
if cost_value is not None:
defaults['cost_value'] = cost_value
if cost_before_bargain is not None:
defaults['cost_before_bargain'] = cost_before_bargain
if format is not None:
defaults['format'] = format
purchase_channel, created = await domain.PurchaseChannel.get_or_create(
purchase_id=purchase_id,