feat: CRUD for product barcode images
This commit is contained in:
@@ -23,6 +23,8 @@ class Product(BaseModel):
|
||||
barcode_template_id = Column(Integer, ForeignKey('barcode_templates.id'), nullable=True)
|
||||
barcode_template = relationship('BarcodeTemplate', lazy='joined')
|
||||
|
||||
barcode_image = relationship('ProductBarcodeImage', back_populates='product', lazy='joined', uselist=False)
|
||||
|
||||
# Attributes
|
||||
# TODO move to another table
|
||||
brand = Column(String, nullable=True, comment='Бренд')
|
||||
@@ -61,3 +63,11 @@ class ProductBarcode(BaseModel):
|
||||
product: Mapped["Product"] = relationship(back_populates='barcodes')
|
||||
|
||||
barcode = Column(String, nullable=False, index=True, comment='ШК товара', primary_key=True)
|
||||
|
||||
|
||||
class ProductBarcodeImage(BaseModel):
|
||||
__tablename__ = 'product_barcode_images'
|
||||
product_id = Column(Integer, ForeignKey('products.id'), primary_key=True, comment='ID товара')
|
||||
product: Mapped["Product"] = relationship(back_populates='barcode_image')
|
||||
|
||||
filename = Column(String, nullable=False)
|
||||
|
||||
Reference in New Issue
Block a user