This commit is contained in:
2024-04-12 07:34:21 +03:00
parent 5c81af05d5
commit be623a3555
12 changed files with 513 additions and 93 deletions

View File

@@ -5,6 +5,7 @@ from schemas.base import CustomModelCamel, OkMessageSchema
from schemas.client import ClientSchema
from schemas.product import ProductSchema
from schemas.service import ServiceSchema
from schemas.user import UserSchema
# region Entities
@@ -34,6 +35,14 @@ class DealProductSchema(CustomModelCamel):
quantity: int
class DealStatusHistorySchema(CustomModelCamel):
user: UserSchema
changed_at: datetime.datetime
from_status: int
to_status: int
next_status_deadline: datetime.datetime
class DealSchema(CustomModelCamel):
id: int
name: str
@@ -42,7 +51,16 @@ class DealSchema(CustomModelCamel):
current_status: int
services: List[DealServiceSchema]
products: List[DealProductSchema]
# total_price: int
status_history: List[DealStatusHistorySchema]
is_deleted: bool
is_completed: bool
client: ClientSchema
class DealGeneralInfoSchema(CustomModelCamel):
name: str
is_deleted: bool
is_completed: bool
# endregion Entities
@@ -74,10 +92,6 @@ class DealAddServicesRequest(CustomModelCamel):
services: list[DealServiceSchema]
class DealGetAllResponse(CustomModelCamel):
deals: List[DealSchema]
class DealUpdateServiceQuantityRequest(CustomModelCamel):
deal_id: int
service_id: int
@@ -95,18 +109,52 @@ class DealDeleteServiceRequest(CustomModelCamel):
service_id: int
class DealDeleteServicesResponse(OkMessageSchema):
pass
class DealDeleteServicesRequest(CustomModelCamel):
deal_id: int
service_ids: List[int]
class DealUpdateProductQuantityRequest(CustomModelCamel):
deal_id: int
product_id: int
quantity: int
class DealAddProductRequest(CustomModelCamel):
deal_id: int
product_id: int
quantity: int
class DealDeleteProductRequest(CustomModelCamel):
deal_id: int
product_id: int
class DealDeleteProductsRequest(CustomModelCamel):
deal_id: int
product_ids: List[int]
class DealUpdateGeneralInfoRequest(CustomModelCamel):
deal_id: int
data: DealGeneralInfoSchema
# endregion Requests
# region Responses
class DealUpdateProductQuantityResponse(OkMessageSchema):
pass
class DealDeleteServicesResponse(OkMessageSchema):
pass
class DealGetAllResponse(CustomModelCamel):
deals: List[DealSchema]
class DealChangeStatusResponse(CustomModelCamel):
ok: bool
@@ -140,4 +188,20 @@ class DealAddServiceResponse(OkMessageSchema):
class DealDeleteServiceResponse(OkMessageSchema):
pass
class DealDeleteProductResponse(OkMessageSchema):
pass
class DealDeleteProductsResponse(OkMessageSchema):
pass
class DealAddProductResponse(OkMessageSchema):
pass
class DealUpdateGeneralInfoResponse(OkMessageSchema):
pass
# endregion Responses