feat: pallets and boxes for deals
This commit is contained in:
@@ -11,6 +11,7 @@ from schemas.client import ClientSchema
|
||||
from schemas.marketplace import BaseMarketplaceSchema
|
||||
from schemas.product import ProductSchema
|
||||
from schemas.service import ServiceSchema, ServicePriceCategorySchema
|
||||
from schemas.shipping import PalletSchema, BoxSchema
|
||||
from schemas.shipping_warehouse import ShippingWarehouseSchema
|
||||
from schemas.user import UserSchema
|
||||
|
||||
@@ -102,6 +103,8 @@ class DealSchema(BaseSchema):
|
||||
category: Optional[ServicePriceCategorySchema] = None
|
||||
group: Optional[DealGroupSchema] = None
|
||||
manager: Optional[UserSchema] = None
|
||||
pallets: List[PalletSchema] = []
|
||||
boxes: List[BoxSchema] = []
|
||||
|
||||
delivery_date: Optional[datetime.datetime] = None
|
||||
receiving_slot_date: Optional[datetime.datetime] = None
|
||||
|
||||
94
schemas/shipping.py
Normal file
94
schemas/shipping.py
Normal file
@@ -0,0 +1,94 @@
|
||||
from typing import Optional
|
||||
|
||||
from schemas.base import BaseSchema, OkMessageSchema
|
||||
from schemas.product import ProductSchema
|
||||
|
||||
|
||||
# region Entities
|
||||
|
||||
class ProductAndQuantitySchema(BaseSchema):
|
||||
product_id: Optional[int]
|
||||
quantity: Optional[int]
|
||||
|
||||
|
||||
class BoxSchema(BaseSchema):
|
||||
id: int
|
||||
quantity: int
|
||||
product: ProductSchema
|
||||
pallet_id: Optional[int]
|
||||
deal_id: Optional[int]
|
||||
|
||||
|
||||
class ShippingProductSchema(BaseSchema):
|
||||
id: int
|
||||
quantity: int
|
||||
product: ProductSchema
|
||||
pallet_id: int
|
||||
|
||||
|
||||
class PalletSchema(BaseSchema):
|
||||
id: int
|
||||
boxes: list[BoxSchema]
|
||||
shipping_products: list[ShippingProductSchema]
|
||||
|
||||
|
||||
class CreateShippingProductSchema(ProductAndQuantitySchema):
|
||||
pallet_id: int
|
||||
|
||||
|
||||
class UpdateShippingProductSchema(ProductAndQuantitySchema):
|
||||
shipping_product_id: int
|
||||
|
||||
|
||||
class CreateBoxInPalletSchema(ProductAndQuantitySchema):
|
||||
pallet_id: Optional[int]
|
||||
|
||||
|
||||
class CreateBoxInDealSchema(ProductAndQuantitySchema):
|
||||
deal_id: Optional[int]
|
||||
|
||||
|
||||
class UpdateBoxSchema(ProductAndQuantitySchema):
|
||||
box_id: Optional[int]
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region Requests
|
||||
|
||||
class UpdateShippingProductRequest(BaseSchema):
|
||||
data: CreateShippingProductSchema | UpdateShippingProductSchema
|
||||
|
||||
|
||||
class UpdateBoxRequest(BaseSchema):
|
||||
data: CreateBoxInDealSchema | CreateBoxInPalletSchema | UpdateBoxSchema
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region Responses
|
||||
|
||||
class CreatePalletResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DeletePalletResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class UpdateShippingProductResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class UpdateBoxResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DeleteBoxResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class DeleteShippingProductResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
# endregion
|
||||
Reference in New Issue
Block a user