feat: attrs on product

This commit is contained in:
2024-05-10 16:48:43 +03:00
parent 74982b9acf
commit dca4070db7
5 changed files with 39 additions and 1 deletions

View File

@@ -8,10 +8,18 @@ class Client(BaseModel):
__tablename__ = 'clients'
id = Column(Integer, autoincrement=True, primary_key=True, index=True)
name = Column(String, nullable=False, unique=True, comment='Название клиента')
# TODO replace with additional model
company_name = Column(String,
nullable=False,
server_default='',
comment='Название компании')
created_at = Column(DateTime, nullable=False, comment='Дата создания')
products = relationship('Product', back_populates='client')
details = relationship('ClientDetails', uselist=False, back_populates='client', cascade='all, delete')
details = relationship('ClientDetails', uselist=False, back_populates='client', cascade='all, delete',
lazy='joined')
barcode_template_id = Column(Integer, ForeignKey('barcode_templates.id'), nullable=True)
barcode_template = relationship('BarcodeTemplate', lazy='selectin')