feat: cards, attributes and modules
This commit is contained in:
43
schemas/attribute.py
Normal file
43
schemas/attribute.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import pickle
|
||||
from datetime import datetime, date
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import field_validator
|
||||
|
||||
from schemas.base import BaseSchema
|
||||
|
||||
|
||||
# region Entities
|
||||
|
||||
class AttributeTypeSchema(BaseSchema):
|
||||
id: int
|
||||
type: str
|
||||
name: str
|
||||
is_deleted: bool
|
||||
|
||||
|
||||
class AttributeSchema(BaseSchema):
|
||||
id: int
|
||||
label: str
|
||||
name: str
|
||||
is_applicable_to_group: bool
|
||||
is_nullable: bool
|
||||
default_value: Optional[bool | int | float | str | date | datetime]
|
||||
type: AttributeTypeSchema
|
||||
|
||||
@field_validator("default_value", mode="before")
|
||||
def validate_default_value(cls, value: Optional[bytes]):
|
||||
return pickle.loads(value) if value else None
|
||||
|
||||
|
||||
class CardAttributeSchema(BaseSchema):
|
||||
value: Optional[bool | int | float | str | date | datetime]
|
||||
card_id: int
|
||||
attribute: AttributeSchema
|
||||
|
||||
@field_validator("value", mode="before")
|
||||
def validate_value(cls, value: Optional[bytes]):
|
||||
return pickle.loads(value) if value else None
|
||||
|
||||
|
||||
# endregion
|
||||
@@ -81,8 +81,8 @@ class GetProductBarcodePdfRequest(GetProductBarcodeRequest):
|
||||
quantity: int
|
||||
|
||||
|
||||
class GetDealProductsBarcodesPdfRequest(BaseSchema):
|
||||
deal_id: int
|
||||
class GetCardProductsBarcodesPdfRequest(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
# endregion
|
||||
@@ -131,7 +131,7 @@ class GetProductBarcodePdfResponse(BaseSchema):
|
||||
mime_type: str
|
||||
|
||||
|
||||
class GetDealProductsBarcodesPdfResponse(BaseSchema):
|
||||
class GetCardProductsBarcodesPdfResponse(BaseSchema):
|
||||
base64_string: str
|
||||
filename: str
|
||||
mime_type: str
|
||||
|
||||
@@ -3,14 +3,16 @@ from typing import Optional
|
||||
|
||||
from schemas.base import BaseSchema, OkMessageSchema
|
||||
|
||||
|
||||
# region Entities
|
||||
class DealBillRequestSchema(BaseSchema):
|
||||
deal_id: int
|
||||
class CardBillRequestSchema(BaseSchema):
|
||||
card_id: int
|
||||
created_at: datetime.datetime
|
||||
paid: bool
|
||||
pdf_url: Optional[str]
|
||||
invoice_number: Optional[str]
|
||||
|
||||
|
||||
class GroupBillRequestSchema(BaseSchema):
|
||||
group_id: int
|
||||
created_at: datetime.datetime
|
||||
@@ -18,28 +20,30 @@ class GroupBillRequestSchema(BaseSchema):
|
||||
pdf_url: Optional[str]
|
||||
invoice_number: Optional[str]
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region Requests
|
||||
class CreateDealBillRequest(BaseSchema):
|
||||
deal_id: int
|
||||
class CreateCardBillRequest(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
class CancelDealBillRequest(BaseSchema):
|
||||
deal_id: int
|
||||
class CancelCardBillRequest(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region Responses
|
||||
class CreateDealBillResponse(OkMessageSchema):
|
||||
class CreateCardBillResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CancelDealBillResponse(OkMessageSchema):
|
||||
class CancelCardBillResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class GetDealBillById(BaseSchema):
|
||||
deal_bill: DealBillRequestSchema
|
||||
class GetCardBillById(BaseSchema):
|
||||
card_bill: CardBillRequestSchema
|
||||
|
||||
# endregion
|
||||
|
||||
@@ -13,7 +13,7 @@ class BaseBoardSchema(BaseSchema):
|
||||
class BoardSchema(BaseBoardSchema):
|
||||
id: int
|
||||
ordinal_number: int
|
||||
deal_statuses: list[StatusSchema]
|
||||
statuses: list[StatusSchema]
|
||||
project: ProjectSchema
|
||||
|
||||
|
||||
|
||||
421
schemas/card.py
Normal file
421
schemas/card.py
Normal file
@@ -0,0 +1,421 @@
|
||||
from datetime import datetime, date
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from pydantic import constr
|
||||
|
||||
from schemas.attribute import CardAttributeSchema
|
||||
from schemas.base import BaseSchema, OkMessageSchema
|
||||
from schemas.billing import CardBillRequestSchema
|
||||
from schemas.board import BoardSchema
|
||||
from schemas.client import ClientSchema
|
||||
from schemas.group import CardGroupSchema
|
||||
from schemas.marketplace import BaseMarketplaceSchema
|
||||
from schemas.product import ProductSchema
|
||||
from schemas.service import ServiceSchema
|
||||
from schemas.shipping import PalletSchema, BoxSchema
|
||||
from schemas.shipping_warehouse import ShippingWarehouseSchema, BaseShippingWarehouseSchema
|
||||
from schemas.status import StatusSchema, CardStatusHistorySchema
|
||||
from schemas.user import UserSchema
|
||||
|
||||
|
||||
# region Entities
|
||||
|
||||
class BaseSchemaWithAttributes(BaseSchema):
|
||||
attributes: dict[str, Union[bool, str, int, float, date, datetime, None]] = None
|
||||
|
||||
def validate_attributes(cls, value):
|
||||
for attr_name, attr_value in value.items():
|
||||
if not isinstance(attr_value, (str, int, float, date, datetime, None)):
|
||||
raise ValueError(f"Invalid type for attribute '{attr_name}': {type(attr_value)}")
|
||||
return value
|
||||
|
||||
|
||||
class CardSummary(BaseSchema):
|
||||
id: int
|
||||
name: str
|
||||
client_name: str
|
||||
created_at: datetime
|
||||
status: StatusSchema
|
||||
board: BoardSchema
|
||||
total_price: int
|
||||
rank: int
|
||||
base_marketplace: Optional[BaseMarketplaceSchema] = None
|
||||
total_products: int
|
||||
|
||||
shipment_warehouse_id: Optional[int]
|
||||
shipment_warehouse_name: Optional[str]
|
||||
|
||||
bill_request: Optional[CardBillRequestSchema] = None
|
||||
group: Optional[CardGroupSchema] = None
|
||||
|
||||
|
||||
class CardServiceSchema(BaseSchema):
|
||||
service: ServiceSchema
|
||||
quantity: int
|
||||
price: int
|
||||
employees: List[UserSchema]
|
||||
is_fixed_price: bool
|
||||
|
||||
|
||||
class CardProductServiceSchema(BaseSchema):
|
||||
service: ServiceSchema
|
||||
price: int
|
||||
employees: List[UserSchema]
|
||||
is_fixed_price: bool
|
||||
|
||||
|
||||
class CardProductSchema(BaseSchema):
|
||||
product: ProductSchema
|
||||
services: List[CardProductServiceSchema]
|
||||
quantity: int
|
||||
comment: str = ""
|
||||
|
||||
|
||||
class CardEmployeesSchema(BaseSchema):
|
||||
user: UserSchema
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class BaseCardSchema(BaseSchema):
|
||||
id: int
|
||||
name: str
|
||||
comment: str
|
||||
created_at: datetime
|
||||
status: StatusSchema
|
||||
board: BoardSchema
|
||||
status_history: List[CardStatusHistorySchema]
|
||||
is_deleted: bool
|
||||
is_completed: bool
|
||||
|
||||
is_locked: bool
|
||||
services: List[CardServiceSchema]
|
||||
products: List[CardProductSchema]
|
||||
client_id: int
|
||||
client: ClientSchema
|
||||
shipping_warehouse: Optional[Union[ShippingWarehouseSchema, str]] = None
|
||||
bill_request: Optional[CardBillRequestSchema] = None
|
||||
group: Optional[CardGroupSchema] = None
|
||||
manager: Optional[UserSchema] = None
|
||||
pallets: List[PalletSchema] = []
|
||||
boxes: List[BoxSchema] = []
|
||||
employees: List[CardEmployeesSchema] = []
|
||||
|
||||
|
||||
class CardSchema(BaseCardSchema):
|
||||
attributes: list[CardAttributeSchema]
|
||||
|
||||
|
||||
class CardGeneralInfoSchema(BaseSchemaWithAttributes):
|
||||
name: str
|
||||
is_deleted: bool
|
||||
is_completed: bool
|
||||
comment: str
|
||||
shipping_warehouse: Optional[str] = None
|
||||
manager: Optional[UserSchema] = None
|
||||
board_id: int
|
||||
status_id: int
|
||||
|
||||
|
||||
class OptionalShippingWarehouseSchema(BaseShippingWarehouseSchema):
|
||||
id: Optional[int] = None
|
||||
|
||||
|
||||
class ParsedCityBreakdownSchema(BaseSchema):
|
||||
base_marketplace: BaseMarketplaceSchema
|
||||
shipping_warehouse: OptionalShippingWarehouseSchema
|
||||
quantity: int
|
||||
|
||||
|
||||
class ParsedProductRowSchema(BaseSchema):
|
||||
barcode: str
|
||||
products: list[ProductSchema]
|
||||
breakdowns: list[ParsedCityBreakdownSchema]
|
||||
|
||||
|
||||
class CityBreakdownFromExcelSchema(BaseSchema):
|
||||
base_marketplace: BaseMarketplaceSchema
|
||||
shipping_warehouse: OptionalShippingWarehouseSchema
|
||||
quantity: int
|
||||
|
||||
|
||||
class ProductFromExcelSchema(BaseSchema):
|
||||
product_id: int
|
||||
cities_breakdown: list[CityBreakdownFromExcelSchema]
|
||||
|
||||
|
||||
# endregion Entities
|
||||
|
||||
# region Requests
|
||||
class CardChangeStatusRequest(BaseSchema):
|
||||
card_id: int
|
||||
new_status: int
|
||||
|
||||
|
||||
class CardCreateRequest(BaseSchema):
|
||||
name: str
|
||||
status_id: int
|
||||
|
||||
|
||||
class CardQuickCreateRequest(BaseSchema):
|
||||
name: constr(strip_whitespace=True)
|
||||
client_name: constr(strip_whitespace=True)
|
||||
comment: str
|
||||
acceptance_date: datetime
|
||||
shipping_warehouse: constr(strip_whitespace=True)
|
||||
base_marketplace: BaseMarketplaceSchema
|
||||
status_id: int
|
||||
|
||||
|
||||
class CardSummaryRequest(BaseSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardAddServicesRequest(BaseSchema):
|
||||
card_id: int
|
||||
services: list[CardServiceSchema]
|
||||
|
||||
|
||||
class CardUpdateServiceQuantityRequest(BaseSchema):
|
||||
card_id: int
|
||||
service_id: int
|
||||
quantity: int
|
||||
|
||||
|
||||
class CardUpdateServiceRequest(BaseSchema):
|
||||
card_id: int
|
||||
service: CardServiceSchema
|
||||
|
||||
|
||||
class CardAddServiceRequest(BaseSchema):
|
||||
card_id: int
|
||||
service_id: int
|
||||
quantity: int
|
||||
price: int
|
||||
|
||||
|
||||
class CardDeleteServiceRequest(BaseSchema):
|
||||
card_id: int
|
||||
service_id: int
|
||||
|
||||
|
||||
class CardDeleteServicesRequest(BaseSchema):
|
||||
card_id: int
|
||||
service_ids: List[int]
|
||||
|
||||
|
||||
class CardUpdateProductQuantityRequest(BaseSchema):
|
||||
card_id: int
|
||||
product_id: int
|
||||
quantity: int
|
||||
|
||||
|
||||
class CardAddProductRequest(BaseSchema):
|
||||
card_id: int
|
||||
product: CardProductSchema
|
||||
|
||||
|
||||
class CardDeleteProductRequest(BaseSchema):
|
||||
card_id: int
|
||||
product_id: int
|
||||
|
||||
|
||||
class CardDeleteProductsRequest(BaseSchema):
|
||||
card_id: int
|
||||
product_ids: List[int]
|
||||
|
||||
|
||||
class CardUpdateGeneralInfoRequest(BaseSchema):
|
||||
card_id: int
|
||||
data: CardGeneralInfoSchema
|
||||
|
||||
|
||||
class CardSummaryReorderRequest(BaseSchema):
|
||||
card_id: int
|
||||
status_id: int
|
||||
index: int
|
||||
deadline: datetime | None = None
|
||||
comment: str | None = None
|
||||
|
||||
|
||||
class CardDeleteRequest(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
class CardUpdateProductRequest(BaseSchema):
|
||||
card_id: int
|
||||
product: CardProductSchema
|
||||
|
||||
|
||||
class CardServicesCopyRequest(BaseSchema):
|
||||
card_id: int
|
||||
source_product_id: int
|
||||
destination_product_ids: List[int]
|
||||
|
||||
|
||||
class CardProductAddKitRequest(BaseSchema):
|
||||
card_id: int
|
||||
product_id: int
|
||||
kit_id: int
|
||||
|
||||
|
||||
class CardAddKitRequest(BaseSchema):
|
||||
card_id: int
|
||||
kit_id: int
|
||||
|
||||
|
||||
class CardCreateGuestUrlRequest(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
class CardCompleteRequest(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
class CardPrefillRequest(BaseSchema):
|
||||
old_card_id: int
|
||||
new_card_id: int
|
||||
|
||||
|
||||
class CardRecalculatePriceRequest(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
class ManageEmployeeRequest(BaseSchema):
|
||||
card_id: int
|
||||
user_id: int
|
||||
is_assign: bool
|
||||
|
||||
|
||||
class CreateCardsFromExcelRequest(BaseSchema):
|
||||
client_id: int
|
||||
status_id: int
|
||||
products: list[ProductFromExcelSchema]
|
||||
|
||||
|
||||
# endregion Requests
|
||||
|
||||
# region Responses
|
||||
class CardUpdateProductQuantityResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardDeleteServicesResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardGetAllResponse(BaseSchema):
|
||||
cards: List[CardSchema]
|
||||
|
||||
|
||||
class CardChangeStatusResponse(BaseSchema):
|
||||
ok: bool
|
||||
|
||||
|
||||
class CardCreateResponse(BaseSchema):
|
||||
ok: bool
|
||||
|
||||
|
||||
class CardQuickCreateResponse(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
class CardSummaryResponse(BaseSchema):
|
||||
summaries: List[CardSummary]
|
||||
|
||||
|
||||
class CardAddServicesResponse(BaseSchema):
|
||||
ok: bool
|
||||
message: str
|
||||
|
||||
|
||||
class CardUpdateServiceQuantityResponse(BaseSchema):
|
||||
ok: bool
|
||||
message: str
|
||||
|
||||
|
||||
class CardUpdateServiceResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardAddServiceResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardDeleteServiceResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardDeleteProductResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardDeleteProductsResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardAddProductResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardUpdateGeneralInfoResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardSummaryReorderResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardDeleteResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardUpdateProductResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardServicesCopyResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardProductAddKitResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardAddKitResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardCreateGuestUrlResponse(OkMessageSchema):
|
||||
url: str
|
||||
|
||||
|
||||
class CardCompleteResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardPrefillResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class CardRecalculatePriceResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class ManageEmployeeResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class GetAvailableEmployeesToAssignResponse(BaseSchema):
|
||||
employees: list[UserSchema]
|
||||
|
||||
|
||||
class ParseCardsExcelResponse(BaseSchema):
|
||||
rows: list[ParsedProductRowSchema]
|
||||
errors: list[str]
|
||||
|
||||
|
||||
class CreateCardsFromExcelResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
# endregion Responses
|
||||
420
schemas/deal.py
420
schemas/deal.py
@@ -1,420 +0,0 @@
|
||||
import datetime
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from pydantic import constr
|
||||
|
||||
from schemas.base import BaseSchema, OkMessageSchema
|
||||
from schemas.billing import DealBillRequestSchema
|
||||
from schemas.board import BoardSchema
|
||||
from schemas.client import ClientSchema
|
||||
from schemas.group import DealGroupSchema
|
||||
from schemas.marketplace import BaseMarketplaceSchema
|
||||
from schemas.product import ProductSchema
|
||||
from schemas.service import ServiceSchema
|
||||
from schemas.shipping import PalletSchema, BoxSchema
|
||||
from schemas.shipping_warehouse import ShippingWarehouseSchema, BaseShippingWarehouseSchema
|
||||
from schemas.status import StatusSchema, DealStatusHistorySchema
|
||||
from schemas.user import UserSchema
|
||||
|
||||
|
||||
# region Entities
|
||||
class FastDeal(BaseSchema):
|
||||
name: str
|
||||
client: ClientSchema
|
||||
comment: str
|
||||
acceptance_date: datetime.datetime
|
||||
|
||||
|
||||
class DealSummary(BaseSchema):
|
||||
id: int
|
||||
name: str
|
||||
client_name: str
|
||||
created_at: datetime.datetime
|
||||
status: StatusSchema
|
||||
board: BoardSchema
|
||||
total_price: int
|
||||
rank: int
|
||||
base_marketplace: Optional[BaseMarketplaceSchema] = None
|
||||
total_products: int
|
||||
|
||||
shipment_warehouse_id: Optional[int]
|
||||
shipment_warehouse_name: Optional[str]
|
||||
|
||||
delivery_date: Optional[datetime.datetime] = None
|
||||
receiving_slot_date: Optional[datetime.datetime] = None
|
||||
bill_request: Optional[DealBillRequestSchema] = None
|
||||
group: Optional[DealGroupSchema] = None
|
||||
|
||||
|
||||
class DealServiceSchema(BaseSchema):
|
||||
service: ServiceSchema
|
||||
quantity: int
|
||||
price: int
|
||||
employees: List[UserSchema]
|
||||
is_fixed_price: bool
|
||||
|
||||
|
||||
class DealProductServiceSchema(BaseSchema):
|
||||
service: ServiceSchema
|
||||
price: int
|
||||
employees: List[UserSchema]
|
||||
is_fixed_price: bool
|
||||
|
||||
|
||||
class DealProductSchema(BaseSchema):
|
||||
product: ProductSchema
|
||||
services: List[DealProductServiceSchema]
|
||||
quantity: int
|
||||
comment: str = ""
|
||||
|
||||
|
||||
class DealEmployeesSchema(BaseSchema):
|
||||
user: UserSchema
|
||||
created_at: datetime.datetime
|
||||
|
||||
|
||||
class DealSchema(BaseSchema):
|
||||
id: int
|
||||
name: str
|
||||
client_id: int
|
||||
created_at: datetime.datetime
|
||||
status: StatusSchema
|
||||
board: BoardSchema
|
||||
services: List[DealServiceSchema]
|
||||
products: List[DealProductSchema]
|
||||
status_history: List[DealStatusHistorySchema]
|
||||
is_deleted: bool
|
||||
is_completed: bool
|
||||
is_locked: bool
|
||||
is_accounted: bool
|
||||
client: ClientSchema
|
||||
comment: str
|
||||
shipping_warehouse: Optional[Union[ShippingWarehouseSchema, str]] = None
|
||||
bill_request: Optional[DealBillRequestSchema] = None
|
||||
group: Optional[DealGroupSchema] = None
|
||||
manager: Optional[UserSchema] = None
|
||||
pallets: List[PalletSchema] = []
|
||||
boxes: List[BoxSchema] = []
|
||||
employees: List[DealEmployeesSchema] = []
|
||||
|
||||
delivery_date: Optional[datetime.datetime] = None
|
||||
receiving_slot_date: Optional[datetime.datetime] = None
|
||||
|
||||
|
||||
class DealGeneralInfoSchema(BaseSchema):
|
||||
name: str
|
||||
is_deleted: bool
|
||||
is_completed: bool
|
||||
is_accounted: bool
|
||||
comment: str
|
||||
shipping_warehouse: Optional[str] = None
|
||||
delivery_date: Optional[datetime.datetime] = None
|
||||
receiving_slot_date: Optional[datetime.datetime] = None
|
||||
manager: Optional[UserSchema] = None
|
||||
board: BoardSchema
|
||||
status: StatusSchema
|
||||
|
||||
|
||||
class OptionalShippingWarehouseSchema(BaseShippingWarehouseSchema):
|
||||
id: Optional[int] = None
|
||||
|
||||
|
||||
class ParsedCityBreakdownSchema(BaseSchema):
|
||||
base_marketplace: BaseMarketplaceSchema
|
||||
shipping_warehouse: OptionalShippingWarehouseSchema
|
||||
quantity: int
|
||||
|
||||
|
||||
class ParsedProductRowSchema(BaseSchema):
|
||||
barcode: str
|
||||
products: list[ProductSchema]
|
||||
breakdowns: list[ParsedCityBreakdownSchema]
|
||||
|
||||
|
||||
class CityBreakdownFromExcelSchema(BaseSchema):
|
||||
base_marketplace: BaseMarketplaceSchema
|
||||
shipping_warehouse: OptionalShippingWarehouseSchema
|
||||
quantity: int
|
||||
|
||||
|
||||
class ProductFromExcelSchema(BaseSchema):
|
||||
product_id: int
|
||||
cities_breakdown: list[CityBreakdownFromExcelSchema]
|
||||
|
||||
|
||||
# endregion Entities
|
||||
|
||||
# region Requests
|
||||
class DealChangeStatusRequest(BaseSchema):
|
||||
deal_id: int
|
||||
new_status: int
|
||||
|
||||
|
||||
class DealCreateRequest(BaseSchema):
|
||||
name: str
|
||||
status_id: int
|
||||
|
||||
|
||||
class DealQuickCreateRequest(BaseSchema):
|
||||
name: constr(strip_whitespace=True)
|
||||
client_name: constr(strip_whitespace=True)
|
||||
comment: str
|
||||
acceptance_date: datetime.datetime
|
||||
shipping_warehouse: constr(strip_whitespace=True)
|
||||
base_marketplace: BaseMarketplaceSchema
|
||||
status_id: int
|
||||
|
||||
|
||||
class DealSummaryRequest(BaseSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealAddServicesRequest(BaseSchema):
|
||||
deal_id: int
|
||||
services: list[DealServiceSchema]
|
||||
|
||||
|
||||
class DealUpdateServiceQuantityRequest(BaseSchema):
|
||||
deal_id: int
|
||||
service_id: int
|
||||
quantity: int
|
||||
|
||||
|
||||
class DealUpdateServiceRequest(BaseSchema):
|
||||
deal_id: int
|
||||
service: DealServiceSchema
|
||||
|
||||
|
||||
class DealAddServiceRequest(BaseSchema):
|
||||
deal_id: int
|
||||
service_id: int
|
||||
quantity: int
|
||||
price: int
|
||||
|
||||
|
||||
class DealDeleteServiceRequest(BaseSchema):
|
||||
deal_id: int
|
||||
service_id: int
|
||||
|
||||
|
||||
class DealDeleteServicesRequest(BaseSchema):
|
||||
deal_id: int
|
||||
service_ids: List[int]
|
||||
|
||||
|
||||
class DealUpdateProductQuantityRequest(BaseSchema):
|
||||
deal_id: int
|
||||
product_id: int
|
||||
quantity: int
|
||||
|
||||
|
||||
class DealAddProductRequest(BaseSchema):
|
||||
deal_id: int
|
||||
product: DealProductSchema
|
||||
|
||||
|
||||
class DealDeleteProductRequest(BaseSchema):
|
||||
deal_id: int
|
||||
product_id: int
|
||||
|
||||
|
||||
class DealDeleteProductsRequest(BaseSchema):
|
||||
deal_id: int
|
||||
product_ids: List[int]
|
||||
|
||||
|
||||
class DealUpdateGeneralInfoRequest(BaseSchema):
|
||||
deal_id: int
|
||||
data: DealGeneralInfoSchema
|
||||
|
||||
|
||||
class DealSummaryReorderRequest(BaseSchema):
|
||||
deal_id: int
|
||||
status_id: int
|
||||
index: int
|
||||
deadline: datetime.datetime | None = None
|
||||
comment: str | None = None
|
||||
|
||||
|
||||
class DealDeleteRequest(BaseSchema):
|
||||
deal_id: int
|
||||
|
||||
|
||||
class DealUpdateProductRequest(BaseSchema):
|
||||
deal_id: int
|
||||
product: DealProductSchema
|
||||
|
||||
|
||||
class DealServicesCopyRequest(BaseSchema):
|
||||
deal_id: int
|
||||
source_product_id: int
|
||||
destination_product_ids: List[int]
|
||||
|
||||
|
||||
class DealProductAddKitRequest(BaseSchema):
|
||||
deal_id: int
|
||||
product_id: int
|
||||
kit_id: int
|
||||
|
||||
|
||||
class DealAddKitRequest(BaseSchema):
|
||||
deal_id: int
|
||||
kit_id: int
|
||||
|
||||
|
||||
class DealCreateGuestUrlRequest(BaseSchema):
|
||||
deal_id: int
|
||||
|
||||
|
||||
class DealCompleteRequest(BaseSchema):
|
||||
deal_id: int
|
||||
|
||||
|
||||
class DealPrefillRequest(BaseSchema):
|
||||
old_deal_id: int
|
||||
new_deal_id: int
|
||||
|
||||
|
||||
class DealRecalculatePriceRequest(BaseSchema):
|
||||
deal_id: int
|
||||
|
||||
|
||||
class ManageEmployeeRequest(BaseSchema):
|
||||
deal_id: int
|
||||
user_id: int
|
||||
is_assign: bool
|
||||
|
||||
|
||||
class CreateDealsFromExcelRequest(BaseSchema):
|
||||
client_id: int
|
||||
status_id: int
|
||||
products: list[ProductFromExcelSchema]
|
||||
|
||||
|
||||
# endregion Requests
|
||||
|
||||
# region Responses
|
||||
class DealUpdateProductQuantityResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealDeleteServicesResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealGetAllResponse(BaseSchema):
|
||||
deals: List[DealSchema]
|
||||
|
||||
|
||||
class DealChangeStatusResponse(BaseSchema):
|
||||
ok: bool
|
||||
|
||||
|
||||
class DealCreateResponse(BaseSchema):
|
||||
ok: bool
|
||||
|
||||
|
||||
class DealQuickCreateResponse(BaseSchema):
|
||||
deal_id: int
|
||||
|
||||
|
||||
class DealSummaryResponse(BaseSchema):
|
||||
summaries: List[DealSummary]
|
||||
|
||||
|
||||
class DealAddServicesResponse(BaseSchema):
|
||||
ok: bool
|
||||
message: str
|
||||
|
||||
|
||||
class DealUpdateServiceQuantityResponse(BaseSchema):
|
||||
ok: bool
|
||||
message: str
|
||||
|
||||
|
||||
class DealUpdateServiceResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealAddServiceResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealDeleteServiceResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealDeleteProductResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealDeleteProductsResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealAddProductResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealUpdateGeneralInfoResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealSummaryReorderResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealDeleteResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealUpdateProductResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealServicesCopyResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealProductAddKitResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealAddKitResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealCreateGuestUrlResponse(OkMessageSchema):
|
||||
url: str
|
||||
|
||||
|
||||
class DealCompleteResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealPrefillResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealRecalculatePriceResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class ManageEmployeeResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class GetAvailableEmployeesToAssignResponse(BaseSchema):
|
||||
employees: list[UserSchema]
|
||||
|
||||
|
||||
class ParseDealsExcelResponse(BaseSchema):
|
||||
rows: list[ParsedProductRowSchema]
|
||||
errors: list[str]
|
||||
|
||||
|
||||
class CreateDealsFromExcelResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
# endregion Responses
|
||||
@@ -6,7 +6,7 @@ from schemas.billing import GroupBillRequestSchema
|
||||
|
||||
# region Entities
|
||||
|
||||
class DealGroupSchema(BaseSchema):
|
||||
class CardGroupSchema(BaseSchema):
|
||||
id: int
|
||||
name: Optional[str] = None
|
||||
lexorank: str
|
||||
@@ -17,50 +17,50 @@ class DealGroupSchema(BaseSchema):
|
||||
|
||||
# region Requests
|
||||
|
||||
class DealGroupUpdateRequest(BaseSchema):
|
||||
data: DealGroupSchema
|
||||
class CardGroupUpdateRequest(BaseSchema):
|
||||
data: CardGroupSchema
|
||||
|
||||
|
||||
class DealCreateGroupRequest(BaseSchema):
|
||||
dragging_deal_id: int
|
||||
hovered_deal_id: int
|
||||
class CreateCardGroupRequest(BaseSchema):
|
||||
dragging_card_id: int
|
||||
hovered_card_id: int
|
||||
|
||||
|
||||
class DealGroupChangeStatusRequest(BaseSchema):
|
||||
class CardGroupChangeStatusRequest(BaseSchema):
|
||||
group_id: int
|
||||
new_status: int
|
||||
|
||||
|
||||
class DealAddToGroupRequest(BaseSchema):
|
||||
deal_id: int
|
||||
class CardAddToGroupRequest(BaseSchema):
|
||||
card_id: int
|
||||
group_id: int
|
||||
|
||||
|
||||
class DealRemoveFromGroupRequest(BaseSchema):
|
||||
deal_id: int
|
||||
class CardRemoveFromGroupRequest(BaseSchema):
|
||||
card_id: int
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region Responses
|
||||
|
||||
class DealCreateGroupResponse(OkMessageSchema):
|
||||
class CardCreateGroupResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealGroupUpdateResponse(OkMessageSchema):
|
||||
class CardGroupUpdateResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealGroupChangeStatusResponse(OkMessageSchema):
|
||||
class CardGroupChangeStatusResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealAddToGroupResponse(OkMessageSchema):
|
||||
class CardAddToGroupResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DealRemoveFromGroupResponse(OkMessageSchema):
|
||||
class CardRemoveFromGroupResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
# endregion
|
||||
|
||||
11
schemas/module.py
Normal file
11
schemas/module.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from schemas.base import BaseSchema
|
||||
|
||||
|
||||
# region Entities
|
||||
|
||||
class ModuleSchema(BaseSchema):
|
||||
id: int
|
||||
key: str
|
||||
is_deleted: bool
|
||||
|
||||
# endregion
|
||||
@@ -1,4 +1,6 @@
|
||||
from schemas.attribute import AttributeSchema
|
||||
from schemas.base import BaseSchema, OkMessageSchema
|
||||
from schemas.module import ModuleSchema
|
||||
|
||||
|
||||
# region Entities
|
||||
@@ -10,9 +12,11 @@ class BaseProjectSchema(BaseSchema):
|
||||
|
||||
class ProjectSchema(BaseProjectSchema):
|
||||
id: int
|
||||
attributes: list[AttributeSchema]
|
||||
modules: list[ModuleSchema]
|
||||
|
||||
|
||||
class ProjectSchemaWithCount(ProjectSchema):
|
||||
class FullProjectSchema(ProjectSchema):
|
||||
boards_count: int
|
||||
|
||||
|
||||
@@ -27,13 +31,14 @@ class CreateProjectRequest(BaseSchema):
|
||||
class UpdateProjectRequest(BaseSchema):
|
||||
project: ProjectSchema
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
|
||||
# region Responses
|
||||
|
||||
class GetProjectsResponse(BaseSchema):
|
||||
projects: list[ProjectSchemaWithCount]
|
||||
projects: list[FullProjectSchema]
|
||||
|
||||
|
||||
class CreateProjectResponse(OkMessageSchema):
|
||||
|
||||
@@ -16,7 +16,7 @@ class ServicePriceRangeSchema(BaseSchema):
|
||||
class ServiceCategorySchema(BaseSchema):
|
||||
id: int
|
||||
name: str
|
||||
deal_service_rank: str
|
||||
card_service_rank: str
|
||||
product_service_rank: str
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class BoxSchema(BaseSchema):
|
||||
quantity: int
|
||||
product: Optional[ProductSchema]
|
||||
pallet_id: Optional[int]
|
||||
deal_id: Optional[int]
|
||||
card_id: Optional[int]
|
||||
|
||||
|
||||
class ShippingProductSchema(BaseSchema):
|
||||
@@ -44,8 +44,8 @@ class CreateBoxInPalletSchema(BaseSchema):
|
||||
pallet_id: Optional[int]
|
||||
|
||||
|
||||
class CreateBoxInDealSchema(BaseSchema):
|
||||
deal_id: Optional[int]
|
||||
class CreateBoxInCardSchema(BaseSchema):
|
||||
card_id: Optional[int]
|
||||
|
||||
|
||||
class UpdateBoxSchema(ProductAndQuantitySchema):
|
||||
@@ -61,7 +61,7 @@ class UpdateShippingProductRequest(BaseSchema):
|
||||
|
||||
|
||||
class UpdateBoxRequest(BaseSchema):
|
||||
data: CreateBoxInDealSchema | CreateBoxInPalletSchema | UpdateBoxSchema
|
||||
data: CreateBoxInCardSchema | CreateBoxInPalletSchema | UpdateBoxSchema
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
@@ -11,7 +11,7 @@ class ProfitChartDataItem(BaseSchema):
|
||||
revenue: float
|
||||
profit: float
|
||||
expenses: float
|
||||
deals_count: int
|
||||
cards_count: int
|
||||
|
||||
|
||||
class ProfitTableDataItem(BaseSchema):
|
||||
@@ -19,7 +19,7 @@ class ProfitTableDataItem(BaseSchema):
|
||||
revenue: float
|
||||
profit: float
|
||||
expenses: Optional[float] = 0
|
||||
deals_count: int
|
||||
cards_count: int
|
||||
|
||||
# endregion
|
||||
|
||||
@@ -31,7 +31,7 @@ class CommonProfitFilters(BaseSchema):
|
||||
base_marketplace_key: str
|
||||
project_id: int
|
||||
board_id: int
|
||||
deal_status_id: int
|
||||
card_status_id: int
|
||||
manager_id: int
|
||||
expense_tag_id: int
|
||||
income_tag_id: int
|
||||
|
||||
@@ -17,7 +17,7 @@ class StatusSchema(BaseStatusSchema):
|
||||
is_deleted: bool = False
|
||||
|
||||
|
||||
class DealStatusHistorySchema(BaseSchema):
|
||||
class CardStatusHistorySchema(BaseSchema):
|
||||
user: UserSchema
|
||||
changed_at: datetime
|
||||
from_status: StatusSchema
|
||||
|
||||
Reference in New Issue
Block a user