feat: purchases added
This commit is contained in:
@@ -26,6 +26,14 @@ __all__ = (
|
||||
'UpdateCreativeInput',
|
||||
'ArchiveCreativeInput',
|
||||
'DeleteCreativeInput',
|
||||
'PurchaseOutput',
|
||||
'GetPurchasesInput',
|
||||
'GetPurchasesOutput',
|
||||
'GetPurchaseInput',
|
||||
'CreatePurchaseInput',
|
||||
'UpdatePurchaseInput',
|
||||
'ArchivePurchaseInput',
|
||||
'DeletePurchaseInput',
|
||||
)
|
||||
|
||||
from .creative import (
|
||||
@@ -48,6 +56,16 @@ from .external_channel import (
|
||||
ImportExternalChannelsOutput,
|
||||
UpdateExternalChannelLinksInput,
|
||||
)
|
||||
from .purchase import (
|
||||
ArchivePurchaseInput,
|
||||
CreatePurchaseInput,
|
||||
DeletePurchaseInput,
|
||||
GetPurchaseInput,
|
||||
GetPurchasesInput,
|
||||
GetPurchasesOutput,
|
||||
PurchaseOutput,
|
||||
UpdatePurchaseInput,
|
||||
)
|
||||
from .target_channel import (
|
||||
ChannelBotPermissions,
|
||||
ConnectTargetChanInput,
|
||||
|
||||
71
src/dto/purchase.py
Normal file
71
src/dto/purchase.py
Normal file
@@ -0,0 +1,71 @@
|
||||
import datetime
|
||||
import uuid
|
||||
|
||||
import pydantic
|
||||
|
||||
from src import domain
|
||||
|
||||
|
||||
class PurchaseOutput(pydantic.BaseModel):
|
||||
id: uuid.UUID
|
||||
target_channel_id: uuid.UUID
|
||||
target_channel_title: str
|
||||
external_channel_id: uuid.UUID
|
||||
external_channel_title: str
|
||||
creative_id: uuid.UUID
|
||||
creative_name: str
|
||||
placement_date: datetime.datetime
|
||||
cost: float | None
|
||||
comment: str | None
|
||||
ad_post_url: str | None
|
||||
invite_link_type: domain.InviteLinkType
|
||||
invite_link: str
|
||||
status: domain.PurchaseStatus
|
||||
subscriptions_count: int
|
||||
views_count: int | None
|
||||
created_at: datetime.datetime
|
||||
|
||||
|
||||
class GetPurchasesInput(pydantic.BaseModel):
|
||||
user_id: uuid.UUID
|
||||
target_channel_id: uuid.UUID | None = None
|
||||
external_channel_id: uuid.UUID | None = None
|
||||
creative_id: uuid.UUID | None = None
|
||||
include_archived: bool = False
|
||||
|
||||
|
||||
class GetPurchasesOutput(pydantic.BaseModel):
|
||||
purchases: list[PurchaseOutput]
|
||||
|
||||
|
||||
class GetPurchaseInput(pydantic.BaseModel):
|
||||
purchase_id: uuid.UUID
|
||||
user_id: uuid.UUID
|
||||
|
||||
|
||||
class CreatePurchaseInput(pydantic.BaseModel):
|
||||
target_channel_id: uuid.UUID
|
||||
external_channel_id: uuid.UUID
|
||||
creative_id: uuid.UUID
|
||||
placement_date: datetime.datetime
|
||||
cost: float | None = None
|
||||
comment: str | None = None
|
||||
ad_post_url: str | None = None
|
||||
invite_link_type: domain.InviteLinkType = domain.InviteLinkType.PUBLIC
|
||||
|
||||
|
||||
class UpdatePurchaseInput(pydantic.BaseModel):
|
||||
placement_date: datetime.datetime | None = None
|
||||
cost: float | None = None
|
||||
comment: str | None = None
|
||||
ad_post_url: str | None = None
|
||||
|
||||
|
||||
class ArchivePurchaseInput(pydantic.BaseModel):
|
||||
purchase_id: uuid.UUID
|
||||
user_id: uuid.UUID
|
||||
|
||||
|
||||
class DeletePurchaseInput(pydantic.BaseModel):
|
||||
purchase_id: uuid.UUID
|
||||
user_id: uuid.UUID
|
||||
Reference in New Issue
Block a user