import datetime from typing import List from schemas.base import CustomModelCamel, OkMessageSchema from schemas.client import ClientSchema from schemas.product import ProductSchema from schemas.service import ServiceSchema # region Entities class FastDeal(CustomModelCamel): name: str client: ClientSchema comment: str acceptance_date: datetime.datetime class DealSummary(CustomModelCamel): id: int name: str client_name: str changed_at: datetime.datetime status: int total_price: int class DealServiceSchema(CustomModelCamel): service: ServiceSchema quantity: int class DealProductSchema(CustomModelCamel): product: ProductSchema quantity: int class DealSchema(CustomModelCamel): id: int name: str client_id: int created_at: datetime.datetime current_status: int services: List[DealServiceSchema] products: List[DealProductSchema] # total_price: int # endregion Entities # region Requests class DealChangeStatusRequest(CustomModelCamel): deal_id: int new_status: int class DealCreateRequest(CustomModelCamel): name: str class DealQuickCreateRequest(CustomModelCamel): name: str client_name: str client_address: str comment: str acceptance_date: datetime.datetime class DealSummaryRequest(CustomModelCamel): pass class DealAddServicesRequest(CustomModelCamel): deal_id: int services: list[DealServiceSchema] class DealGetAllResponse(CustomModelCamel): deals: List[DealSchema] class DealUpdateServiceQuantityRequest(CustomModelCamel): deal_id: int service_id: int quantity: int class DealAddServiceRequest(CustomModelCamel): deal_id: int service_id: int quantity: int class DealDeleteServiceRequest(CustomModelCamel): deal_id: int service_id: int class DealDeleteServicesResponse(OkMessageSchema): pass class DealDeleteServicesRequest(CustomModelCamel): deal_id: int service_ids: List[int] # endregion Requests # region Responses class DealChangeStatusResponse(CustomModelCamel): ok: bool class DealCreateResponse(CustomModelCamel): ok: bool class DealQuickCreateResponse(CustomModelCamel): deal_id: int class DealSummaryResponse(CustomModelCamel): summaries: List[DealSummary] class DealAddServicesResponse(CustomModelCamel): ok: bool message: str class DealUpdateServiceQuantityResponse(CustomModelCamel): ok: bool message: str class DealAddServiceResponse(OkMessageSchema): pass class DealDeleteServiceResponse(OkMessageSchema): pass # endregion Responses