color style
This commit is contained in:
@@ -34,6 +34,7 @@ class MembersProducts(db.Model):
|
||||
custom_template = db.Column(db.String(100), nullable=True)
|
||||
primary_server = db.Column(db.String(100), nullable=True)
|
||||
provision_port = db.Column(db.Integer, nullable=True, default=0)
|
||||
colorstyle = db.Column(db.String(55), nullable=True)
|
||||
|
||||
|
||||
# name = db.Column(db.String(100), nullable=False)
|
||||
@@ -90,6 +91,15 @@ class MembersProducts(db.Model):
|
||||
return None
|
||||
return member_product
|
||||
|
||||
@classmethod
|
||||
def set_member_product_colorstyle(cls, member_id, product_id, colorstyle):
|
||||
member_product = cls.query.filter_by(member_id=str(member_id), product_id=str(product_id)).first()
|
||||
if not member_product:
|
||||
return None
|
||||
member_product.colorstyle = colorstyle
|
||||
return colorstyle
|
||||
|
||||
|
||||
@classmethod
|
||||
def set_member_product_template(cls, member_id, product_id, product_template):
|
||||
member_product = cls.query.filter_by(member_id=str(member_id), product_id=str(product_id)).first()
|
||||
@@ -190,6 +200,7 @@ class MembersProducts(db.Model):
|
||||
'provision_port': self.provision_port,
|
||||
'product_template': self.product_template,
|
||||
'custom_template': self.custom_template,
|
||||
'colorstyle': self.colorstyle,
|
||||
'updated': self.updated
|
||||
}
|
||||
|
||||
|
||||
@@ -21,20 +21,24 @@ class ProductsColorStyle(db.Model):
|
||||
|
||||
@classmethod
|
||||
def get_colorstyle_by_product_id(cls, product_id):
|
||||
templates = cls.query.filter_by(product_id=str(product_id)).all()
|
||||
|
||||
if not templates:
|
||||
# raise ValueError(f"Templates with Product ID {product_id} not found")
|
||||
colorStyle = cls.query.filter_by(product_id=str(product_id)).all()
|
||||
if not colorStyle:
|
||||
return None
|
||||
return templates
|
||||
return colorStyle
|
||||
|
||||
@classmethod
|
||||
def get_colorstyle_by_product_id_and_uid(cls, product_id, style_uid):
|
||||
colorStyle = cls.query.filter_by(product_id=str(product_id), uid=str(style_uid)).first()
|
||||
if not colorStyle:
|
||||
return None
|
||||
return colorStyle
|
||||
|
||||
@classmethod
|
||||
def get_colorstyle_for_office(cls, filters):
|
||||
templates = cls.query.all()
|
||||
|
||||
if not templates:
|
||||
raise ValueError(f"Templates not found")
|
||||
return templates
|
||||
colorStyle = cls.query.all()
|
||||
if not colorStyle:
|
||||
raise ValueError(f"Color Style not found")
|
||||
return colorStyle
|
||||
|
||||
# @classmethod
|
||||
# def get_template_by_uid(cls, template_uid):
|
||||
|
||||
Reference in New Issue
Block a user