feat: barcode templates
This commit is contained in:
36
modules/fulfillment_base/models/barcode.py
Normal file
36
modules/fulfillment_base/models/barcode.py
Normal file
@ -0,0 +1,36 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from models.base import BaseModel
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from modules.fulfillment_base.models import Product
|
||||
|
||||
|
||||
class ProductBarcode(BaseModel):
|
||||
__tablename__ = "fulfillment_base_product_barcodes"
|
||||
|
||||
product_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("fulfillment_base_products.id"),
|
||||
primary_key=True,
|
||||
)
|
||||
product: Mapped["Product"] = relationship(back_populates="barcodes")
|
||||
|
||||
barcode: Mapped[str] = mapped_column(
|
||||
primary_key=True, index=True, comment="ШК товара"
|
||||
)
|
||||
|
||||
|
||||
class ProductBarcodeImage(BaseModel):
|
||||
__tablename__ = "fulfillment_base_product_barcode_images"
|
||||
|
||||
product_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("fulfillment_base_products.id"),
|
||||
primary_key=True,
|
||||
comment="ID товара",
|
||||
)
|
||||
product: Mapped["Product"] = relationship(back_populates="barcode_image")
|
||||
|
||||
filename: Mapped[str] = mapped_column()
|
||||
Reference in New Issue
Block a user