feat: attrs on product

This commit is contained in:
2024-05-10 16:18:26 +03:00
parent bde69f9db8
commit 74982b9acf
6 changed files with 54 additions and 0 deletions

View File

@@ -15,6 +15,11 @@ class ProductSchema(CustomModelCamel):
barcodes: list[str]
barcode_template: BarcodeTemplateSchema | None = None
# Attributes
brand: str | None = None
color: str | None = None
composition: str | None = None
@field_validator('barcodes', mode="before")
def barcodes_to_list(cls, v):
if isinstance(v, list) and all([type(barcode) is ProductBarcode for barcode in v]):
@@ -32,6 +37,7 @@ class ProductCreateRequest(CustomModelCamel):
barcodes: List[str]
barcode_template: BarcodeTemplateSchema | None = None
class ProductDeleteRequest(CustomModelCamel):
product_id: int