feat: deal tags

This commit is contained in:
2025-10-19 12:12:08 +04:00
parent d7c7d1775f
commit ffee658349
16 changed files with 355 additions and 8 deletions

View File

@ -5,6 +5,7 @@ from modules.clients.schemas.client import ClientSchema
from schemas.base import BaseSchema, BaseResponse, PaginationInfoSchema
from schemas.board import BoardSchema
from schemas.deal_group import DealGroupSchema
from schemas.deal_tag import DealTagSchema
from schemas.status import StatusSchema
@ -19,6 +20,7 @@ class DealSchema(BaseSchema):
board: BoardSchema
created_at: datetime
group: Optional[DealGroupSchema]
tags: list[DealTagSchema]
# FF module
products_quantity: int = 0
total_price: float = 0

79
schemas/deal_tag.py Normal file
View File

@ -0,0 +1,79 @@
from typing import Optional
from schemas.base import BaseSchema, BaseResponse
# region Entities
class DealTagColorSchema(BaseSchema):
id: int
color: str
background_color: str
label: str
class CreateDealTagSchema(BaseSchema):
name: str
project_id: int
tag_color_id: int
class DealTagSchema(CreateDealTagSchema):
id: int
tag_color: DealTagColorSchema
class UpdateDealTagSchema(BaseSchema):
name: Optional[str] = None
tag_color: Optional[DealTagColorSchema] = None
# endregion
# region Requests
class CreateDealTagRequest(BaseSchema):
entity: CreateDealTagSchema
class UpdateDealTagRequest(BaseSchema):
entity: UpdateDealTagSchema
class SwitchDealTagRequest(BaseSchema):
tag_id: int
deal_id: Optional[int] = None
group_id: Optional[int] = None
# endregion
# region Responses
class GetDealTagsResponse(BaseSchema):
items: list[DealTagSchema]
class CreateDealTagResponse(BaseResponse):
entity: DealTagSchema
class UpdateDealTagResponse(BaseResponse):
pass
class DeleteDealTagResponse(BaseResponse):
pass
class SwitchDealTagResponse(BaseResponse):
pass
class GetTagColorsResponse(BaseSchema):
items: list[DealTagColorSchema]
# endregion

View File

@ -1,6 +1,7 @@
from typing import Optional
from schemas.base import BaseSchema, BaseResponse
from schemas.deal_tag import DealTagSchema
from schemas.module import BuiltInModuleSchema
@ -11,6 +12,7 @@ class ProjectSchema(BaseSchema):
id: int
name: str
built_in_modules: list[BuiltInModuleSchema]
tags: list[DealTagSchema]
class CreateProjectSchema(BaseSchema):