temp images on products

This commit is contained in:
2024-05-24 09:45:54 +03:00
parent 3a4f91d751
commit 88679089b6
11 changed files with 115 additions and 31 deletions

View File

@@ -24,6 +24,19 @@ class Product(BaseModel):
composition = Column(String, nullable=True, comment='Состав')
size = Column(String, nullable=True, comment='Размер')
additional_info = Column(String, nullable=True, comment='Дополнительное поле')
images = relationship('ProductImage',
back_populates='product',
cascade="all, delete-orphan")
class ProductImage(BaseModel):
__tablename__ = 'product_images'
id = Column(Integer, autoincrement=True, primary_key=True, index=True)
product_id = Column(Integer, ForeignKey('products.id'), nullable=False)
product = relationship('Product', back_populates='images')
image_url = Column(String, nullable=False)
class ProductBarcode(BaseModel):