set custom template
This commit is contained in:
@@ -13,25 +13,29 @@ class OfficeTemplatesService(BaseService):
|
|||||||
def set_office_custom_template(data):
|
def set_office_custom_template(data):
|
||||||
logger.info('set_office_custom_template')
|
logger.info('set_office_custom_template')
|
||||||
try:
|
try:
|
||||||
# office_users = OfficeUsers.get_office_users_list()
|
with db.session.begin():
|
||||||
# office_users_data = []
|
subscrtiption_uid = data.get('subscrtiption_uid', '')
|
||||||
# if office_users:
|
custom_id = data.get('custom_id', '')
|
||||||
# for t in office_users:
|
|
||||||
# office_users_data.append({
|
|
||||||
# 'id': t.id,
|
|
||||||
# 'uid': t.uid,
|
|
||||||
# 'username': t.username,
|
|
||||||
# 'firstname': t.firstname,
|
|
||||||
# 'lastname': t.lastname,
|
|
||||||
# 'acc_level': t.acc_level,
|
|
||||||
# 'status': t.status,
|
|
||||||
# 'added': t.added.isoformat() if t.added else None
|
|
||||||
# })
|
|
||||||
|
|
||||||
office_users_result = {
|
membersSubResult = MembersProducts.get_member_product_by_subscription_uid(subscrtiption_uid)
|
||||||
"set_office_custom_template": [],
|
if not membersSubResult:
|
||||||
}
|
return {
|
||||||
return office_users_result
|
"message": "Invalid Subscription",
|
||||||
|
"error_message": "Error - Please select a valid product to view",
|
||||||
|
"data": None,
|
||||||
|
"error": f"Subscription with UID {subscrtiption_uid} does not exist."
|
||||||
|
}, 400
|
||||||
|
|
||||||
|
member_id = membersSubResult.member_id
|
||||||
|
logger.info(f'set_office_custom_template {member_id} {subscrtiption_uid} {custom_id}')
|
||||||
|
|
||||||
|
MembersProducts.set_member_product_custom_template(member_id, subscrtiption_uid, custom_id)
|
||||||
|
|
||||||
|
|
||||||
|
office_users_result = {
|
||||||
|
"set_office_custom_template": [],
|
||||||
|
}
|
||||||
|
return office_users_result
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
|
|||||||
@@ -98,6 +98,15 @@ class MembersProducts(db.Model):
|
|||||||
member_product.product_template = product_template
|
member_product.product_template = product_template
|
||||||
return product_template
|
return product_template
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def set_member_product_custom_template(cls, member_id, uid, custom_template):
|
||||||
|
member_product = cls.query.filter_by(member_id=str(member_id), uid=str(uid)).first()
|
||||||
|
if not member_product:
|
||||||
|
return None
|
||||||
|
logger.info(f'ACTION:::set_member_product_custom_template {member_id} {uid} {custom_template}')
|
||||||
|
member_product.custom_template = custom_template
|
||||||
|
return custom_template
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_member_product_external_url(cls, member_id, product_id, external_url):
|
def set_member_product_external_url(cls, member_id, product_id, external_url):
|
||||||
member_product = cls.query.filter_by(member_id=str(member_id), product_id=str(product_id)).first()
|
member_product = cls.query.filter_by(member_id=str(member_id), product_id=str(product_id)).first()
|
||||||
|
|||||||
Reference in New Issue
Block a user