feat: barcode templates
This commit is contained in:
		@@ -20,22 +20,31 @@ class BarcodeTemplateAdditionalField(BaseModel):
 | 
			
		||||
    barcode_template = relationship('BarcodeTemplate')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BarcodeTemplateSize(BaseModel):
 | 
			
		||||
    __tablename__ = 'barcode_template_sizes'
 | 
			
		||||
    id = Column(Integer, autoincrement=True, primary_key=True, index=True)
 | 
			
		||||
 | 
			
		||||
    name = Column(String, nullable=False, index=True, comment='Название размера')
 | 
			
		||||
    key = Column(String, nullable=False, index=True, comment='Ключ размера')
 | 
			
		||||
 | 
			
		||||
    width = Column(Integer, nullable=False, comment='Ширина в мм')
 | 
			
		||||
    height = Column(Integer, nullable=False, comment='Высота в мм')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BarcodeTemplate(BaseModel):
 | 
			
		||||
    __tablename__ = 'barcode_templates'
 | 
			
		||||
    id = Column(Integer, autoincrement=True, primary_key=True, index=True)
 | 
			
		||||
    name = Column(String, nullable=False, index=True, comment='Название шаблона')
 | 
			
		||||
    attributes = relationship('BarcodeTemplateAttribute',
 | 
			
		||||
                              secondary=barcode_template_attribute_link,
 | 
			
		||||
                              cascade="all",
 | 
			
		||||
                              lazy='selectin'
 | 
			
		||||
                              )
 | 
			
		||||
    additional_fields = relationship('BarcodeTemplateAdditionalField',
 | 
			
		||||
                                     lazy='selectin',
 | 
			
		||||
                                     back_populates='barcode_template',
 | 
			
		||||
                                     cascade="all")
 | 
			
		||||
    additional_attributes = relationship('BarcodeTemplateAdditionalField',
 | 
			
		||||
                                         lazy='selectin',
 | 
			
		||||
                                         back_populates='barcode_template',
 | 
			
		||||
                                         cascade="all, delete")
 | 
			
		||||
 | 
			
		||||
    is_default = Column(Boolean, nullable=False, default=False, comment='По умолчанию')
 | 
			
		||||
 | 
			
		||||
    # size
 | 
			
		||||
    width = Column(Integer, nullable=False, comment='Ширина в мм')
 | 
			
		||||
    height = Column(Integer, nullable=False, comment='Высота в мм')
 | 
			
		||||
    size_id = Column(Integer, ForeignKey('barcode_template_sizes.id'), nullable=False)
 | 
			
		||||
    size = relationship('BarcodeTemplateSize', lazy='joined')
 | 
			
		||||
 
 | 
			
		||||
@@ -33,23 +33,6 @@ class DealProduct(BaseModel):
 | 
			
		||||
    quantity = Column(Integer, nullable=False, comment='Кол-во продукта')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# class BarcodeTemplateAttributeLink(BaseModel):
 | 
			
		||||
#     __tablename__ = 'barcode_template_attributes_links'
 | 
			
		||||
#     barcode_template_id = Column(Integer,
 | 
			
		||||
#                                  ForeignKey('barcode_templates.id'),
 | 
			
		||||
#                                  nullable=False,
 | 
			
		||||
#                                  comment='ID Шаблона ШК',
 | 
			
		||||
#                                  primary_key=True)
 | 
			
		||||
#     barcode_template = relationship('BarcodeTemplate',
 | 
			
		||||
#                                     # back_populates='attributes'
 | 
			
		||||
#                                     )
 | 
			
		||||
#
 | 
			
		||||
#     attribute_id = Column(Integer,
 | 
			
		||||
#                           ForeignKey('barcode_template_attributes.id'),
 | 
			
		||||
#                           nullable=False,
 | 
			
		||||
#                           comment='ID Атрибута',
 | 
			
		||||
#                           primary_key=True)
 | 
			
		||||
#     attribute = relationship('BarcodeTemplateAttribute')
 | 
			
		||||
barcode_template_attribute_link = Table(
 | 
			
		||||
    'barcode_template_attribute_links',
 | 
			
		||||
    BaseModel.metadata,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user