95 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			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: 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
 |