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

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