This commit is contained in:
2024-03-29 21:39:44 +03:00
parent a72eb31e07
commit df6e2e7fb1

View File

@@ -12,4 +12,12 @@ class Product(BaseModel):
client_id = Column(Integer, ForeignKey('clients.id'), nullable=False, comment='ID сделки') client_id = Column(Integer, ForeignKey('clients.id'), nullable=False, comment='ID сделки')
client = relationship('Client', back_populates='products') client = relationship('Client', back_populates='products')
barcodes = relationship('ProductBarcode', back_populates='product')
class ProductBarcode(BaseModel):
__tablename__ = 'product_barcodes'
product_id = Column(Integer, ForeignKey('products.id'), nullable=False, comment='ID товара', primary_key=True)
product = relationship('Product', back_populates='barcodes')
barcode = Column(String, nullable=False, index=True, comment='ШК товара')