Files
Fulfillment-Backend/schemas/shipping.py

95 lines
1.7 KiB
Python

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: Optional[ProductSchema]
pallet_id: Optional[int]
card_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(BaseSchema):
pallet_id: Optional[int]
class CreateBoxInCardSchema(BaseSchema):
card_id: Optional[int]
class UpdateBoxSchema(ProductAndQuantitySchema):
box_id: Optional[int]
# endregion
# region Requests
class UpdateShippingProductRequest(BaseSchema):
data: CreateShippingProductSchema | UpdateShippingProductSchema
class UpdateBoxRequest(BaseSchema):
data: CreateBoxInCardSchema | 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