my product dra
This commit is contained in:
+1
-1
@@ -318,7 +318,7 @@ ALTER TABLE members_products ADD db_status INT DEFAULT 0;
|
|||||||
ALTER TABLE members_products ADD provision_status INT DEFAULT 0;
|
ALTER TABLE members_products ADD provision_status INT DEFAULT 0;
|
||||||
ALTER TABLE members_products ADD p_file INT DEFAULT 0;
|
ALTER TABLE members_products ADD p_file INT DEFAULT 0;
|
||||||
ALTER TABLE members_products ADD url_status INT DEFAULT 0;
|
ALTER TABLE members_products ADD url_status INT DEFAULT 0;
|
||||||
|
ALTER TABLE members_products ADD product_template VARCHAR(100);
|
||||||
|
|
||||||
-- INSERT INTO merms_products (name,description,status,product_id, banner) VALUES ('Personal Website','Your personal professional web presence',1,'A000001', 'banner.jpg');
|
-- INSERT INTO merms_products (name,description,status,product_id, banner) VALUES ('Personal Website','Your personal professional web presence',1,'A000001', 'banner.jpg');
|
||||||
-- INSERT INTO merms_products (name,description,status,product_id, banner) VALUES ('Professional Website','Your healthcare practice online presence ',1,'A000002', 'banner.jpg');
|
-- INSERT INTO merms_products (name,description,status,product_id, banner) VALUES ('Professional Website','Your healthcare practice online presence ',1,'A000002', 'banner.jpg');
|
||||||
|
|||||||
@@ -178,8 +178,6 @@ def merms_contacts():
|
|||||||
response = ContactService.process_request(data)
|
response = ContactService.process_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/products", methods=["POST"])
|
@api.route("/panel/account/products", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_products():
|
def merms_products():
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ class AccountService(BaseService):
|
|||||||
'option_name': t.option_name,
|
'option_name': t.option_name,
|
||||||
'option_type': t.option_type,
|
'option_type': t.option_type,
|
||||||
'payment_uid': t.payment_uid,
|
'payment_uid': t.payment_uid,
|
||||||
'amount': t.amount,
|
'amount': round( t.amount*0.01, 2),
|
||||||
'status': t.status,
|
'status': t.status,
|
||||||
'added': t.added
|
'added': t.added
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -36,17 +36,17 @@ class MyProductsService(BaseService):
|
|||||||
validated_data = MyProductsService.validate_data(data, MyProductSetTemplateSchema())
|
validated_data = MyProductsService.validate_data(data, MyProductSetTemplateSchema())
|
||||||
token = validated_data.get('token')
|
token = validated_data.get('token')
|
||||||
uid = validated_data.get('uid')
|
uid = validated_data.get('uid')
|
||||||
|
template_uid = validated_data.get('template_uid')
|
||||||
member_data = Members.get_member_by_uid(uid)
|
member_data = Members.get_member_by_uid(uid)
|
||||||
member_id = member_data.id
|
member_id = member_data.id
|
||||||
|
response_data ={}
|
||||||
product_id = validated_data.get('product_id')
|
product_id = validated_data.get('product_id')
|
||||||
|
|
||||||
template_data = []
|
MembersProducts.set_member_product_template(member_id, product_id, template_uid)
|
||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
"product_id": product_id,
|
"product_id": product_id,
|
||||||
"current_template_uid": "f7198ccc-1efc-4c40-8b79-17bc17956195",
|
"new_template_uid": template_uid,
|
||||||
"templates": template_data,
|
|
||||||
"last_update": datetime.datetime.utcnow(),
|
"last_update": datetime.datetime.utcnow(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,44 +82,23 @@ class MyProductsService(BaseService):
|
|||||||
member_id = member_data.id
|
member_id = member_data.id
|
||||||
|
|
||||||
product_id = validated_data.get('product_id')
|
product_id = validated_data.get('product_id')
|
||||||
|
|
||||||
# class MyProductSchema(Schema):
|
|
||||||
# token = fields.Str(required=True)
|
|
||||||
# uid = fields.Str(required=True)
|
|
||||||
# product_id = fields.Str(required=True)
|
|
||||||
templates = ProductsTemplates.get_template_by_product_id(product_id)
|
|
||||||
template_data = {
|
|
||||||
'template_16': {'title': 'Template Name-16', 'template_id': '02af24fd-2b1a-46ed-af21-87018e726408',
|
|
||||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
|
||||||
'template_22': {'title': 'Template Name-22', 'template_id': '8b296894-42e4-4f2e-abd1-7c2a38d6e07b',
|
|
||||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
|
||||||
'template_47': {'title': 'Template Name-47', 'template_id': 'ef2ffa1c-9272-42cd-9d33-0e614047b4f8',
|
|
||||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
|
||||||
'template_25': {'title': 'Template Name-25', 'template_id': 'b3a7ba31-dc47-4a40-a5cc-fd1ff27d6b78',
|
|
||||||
'banner': 'file-icon/svg.png', 'active': '1'},
|
|
||||||
'template_49': {'title': 'Template Name-49', 'template_id': '60959c69-6672-4f69-a006-eeb7d210e605',
|
|
||||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
|
||||||
'template_27': {'title': 'Template Name-27', 'template_id': 'e4acb98a-c584-45f2-bece-af677dcf0a1f',
|
|
||||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
|
||||||
'template_51': {'title': 'Template Name-51', 'template_id': '975ee42e-3169-4978-92d7-d28e7e2ac014',
|
|
||||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
|
||||||
'template_9': {'title': 'Template Name-9', 'template_id': 'fc8f0738-6500-4775-9895-2047cd275302',
|
|
||||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
|
||||||
}
|
|
||||||
template_data = []
|
template_data = []
|
||||||
for t in templates:
|
memberSubscription = MembersProducts.get_member_product_by_product_member_id(member_id, product_id)
|
||||||
template_data.append({
|
if memberSubscription:
|
||||||
'id': t.id,
|
templates = ProductsTemplates.get_template_by_product_id(product_id)
|
||||||
'template_uid': t.uid,
|
for t in templates:
|
||||||
'title': t.name,
|
template_data.append({
|
||||||
'active': 1,
|
'id': t.id,
|
||||||
'banner': 'https://qa-panel.mermsemr.com/static/media/',
|
'template_uid': t.uid,
|
||||||
'added': t.added.isoformat() if t.added else None
|
'title': t.name,
|
||||||
})
|
'active': 1,
|
||||||
|
'banner': 'https://qa-panel.mermsemr.com/static/media/',
|
||||||
|
'added': t.added.isoformat() if t.added else None
|
||||||
|
})
|
||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
"product_id": product_id,
|
"product_id": product_id,
|
||||||
"current_template_uid": "f7198ccc-1efc-4c40-8b79-17bc17956195",
|
"current_template_uid": memberSubscription.product_template if memberSubscription else None ,
|
||||||
"templates": template_data,
|
"templates": template_data,
|
||||||
"last_update": datetime.datetime.utcnow(),
|
"last_update": datetime.datetime.utcnow(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class MembersProducts(db.Model):
|
|||||||
status = db.Column(db.Integer, nullable=True, default=0)
|
status = db.Column(db.Integer, nullable=True, default=0)
|
||||||
added = db.Column(db.DateTime(timezone=True), server_default=func.now())
|
added = db.Column(db.DateTime(timezone=True), server_default=func.now())
|
||||||
updated = db.Column(db.DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
updated = db.Column(db.DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||||
|
product_template= db.Column(db.String(100), nullable=True)
|
||||||
|
|
||||||
# name = db.Column(db.String(100), nullable=False)
|
# name = db.Column(db.String(100), nullable=False)
|
||||||
# description = db.Column(db.String(250), nullable=False)
|
# description = db.Column(db.String(250), nullable=False)
|
||||||
@@ -69,6 +70,14 @@ class MembersProducts(db.Model):
|
|||||||
return None
|
return None
|
||||||
return member_product
|
return member_product
|
||||||
|
|
||||||
|
@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()
|
||||||
|
if not member_product:
|
||||||
|
return None
|
||||||
|
member_product.product_template = product_template
|
||||||
|
return product_template
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_subscription(cls, member_id ,product_id,status,internal_url):
|
def create_subscription(cls, member_id ,product_id,status,internal_url):
|
||||||
@@ -144,6 +153,7 @@ class MembersProducts(db.Model):
|
|||||||
'dns_group': self.dns_group,
|
'dns_group': self.dns_group,
|
||||||
'status': self.status,
|
'status': self.status,
|
||||||
'added': self.added,
|
'added': self.added,
|
||||||
|
'product_template': self.product_template,
|
||||||
'updated': self.updated
|
'updated': self.updated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user