feat: temp barcode templates
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from typing import List
|
||||
|
||||
from schemas.base import CustomModelCamel, OkMessageSchema
|
||||
|
||||
|
||||
@@ -8,11 +10,17 @@ class BarcodeTemplateAttributeSchema(CustomModelCamel):
|
||||
name: str
|
||||
|
||||
|
||||
class BarcodeTemplateAdditionalAttributeSchema(CustomModelCamel):
|
||||
name: str
|
||||
value: str
|
||||
|
||||
|
||||
class BaseBarcodeTemplateSchema(CustomModelCamel):
|
||||
name: str
|
||||
is_default: bool
|
||||
width: int
|
||||
height: int
|
||||
additional_attributes: list[BarcodeTemplateAdditionalAttributeSchema]
|
||||
|
||||
|
||||
class BarcodeTemplateSchema(BaseBarcodeTemplateSchema):
|
||||
@@ -20,6 +28,16 @@ class BarcodeTemplateSchema(BaseBarcodeTemplateSchema):
|
||||
attributes: list[BarcodeTemplateAttributeSchema]
|
||||
|
||||
|
||||
class BarcodeAttributeSchema(CustomModelCamel):
|
||||
name: str
|
||||
value: str
|
||||
|
||||
|
||||
class BarcodeSchema(CustomModelCamel):
|
||||
barcode: str
|
||||
attributes: List[BarcodeAttributeSchema]
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region Requests
|
||||
@@ -44,6 +62,12 @@ class BarcodeTemplateDeleteRequest(CustomModelCamel):
|
||||
id: int
|
||||
|
||||
|
||||
class GetProductBarcodeRequest(CustomModelCamel):
|
||||
product_id: int
|
||||
barcode: str
|
||||
barcode_template_id: int | None = None
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region Responses
|
||||
@@ -74,4 +98,8 @@ class GetAllBarcodeTemplateAttributesResponse(CustomModelCamel):
|
||||
|
||||
class BarcodeTemplateDeleteResponse(OkMessageSchema):
|
||||
pass
|
||||
|
||||
|
||||
class GetProductBarcodeResponse(CustomModelCamel):
|
||||
barcode: BarcodeSchema
|
||||
# endregion
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import List
|
||||
|
||||
from pydantic import validator, field_validator
|
||||
from pydantic import field_validator
|
||||
|
||||
from schemas.barcode import BarcodeTemplateSchema
|
||||
from schemas.base import CustomModelCamel, OkMessageSchema
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from typing import List
|
||||
|
||||
from pydantic import validator, field_validator
|
||||
|
||||
from models import ProductBarcode
|
||||
from schemas.barcode import BarcodeTemplateSchema
|
||||
from schemas.base import CustomModelCamel, PaginationInfoSchema, OkMessageSchema
|
||||
from pydantic import field_validator
|
||||
from models import ProductBarcode
|
||||
|
||||
|
||||
# region Entities
|
||||
@@ -14,6 +13,7 @@ class ProductSchema(CustomModelCamel):
|
||||
article: str
|
||||
client_id: int
|
||||
barcodes: list[str]
|
||||
barcode_template: BarcodeTemplateSchema | None = None
|
||||
|
||||
@field_validator('barcodes', mode="before")
|
||||
def barcodes_to_list(cls, v):
|
||||
@@ -30,7 +30,7 @@ class ProductCreateRequest(CustomModelCamel):
|
||||
article: str
|
||||
client_id: int
|
||||
barcodes: List[str]
|
||||
|
||||
barcode_template: BarcodeTemplateSchema | None = None
|
||||
|
||||
class ProductDeleteRequest(CustomModelCamel):
|
||||
product_id: int
|
||||
|
||||
Reference in New Issue
Block a user