feat: pallets and boxes for deals
This commit is contained in:
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