generative data
This commit is contained in:
@@ -27,16 +27,14 @@ class GenerativeEngineIntegration:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# input = "Tell me a three sentence bedtime story about a unicorn."
|
# input = "Tell me a three sentence bedtime story about a unicorn."
|
||||||
logger.info(response)
|
# logger.info(response)
|
||||||
json_response = json.loads(response.json())
|
json_response = json.loads(response.json())
|
||||||
# json_response = response.json()
|
# json_response = response.json()
|
||||||
# logger.info(json_response.keys())
|
# logger.info(json_response.keys())
|
||||||
logger.info(json_response)
|
# logger.info(json_response)
|
||||||
# logger.info(json_response["output"])
|
# logger.info(json_response["output"])
|
||||||
logger.info(json_response["output"])
|
# logger.info(json_response["output"][0])
|
||||||
logger.info(json_response["output"][0])
|
# logger.info(json_response["output"][0]["content"][0]["text"])
|
||||||
logger.info(json_response["output"][0]["content"][0]["text"])
|
|
||||||
# return json_response["generated_text"]
|
|
||||||
|
|
||||||
# chatgpt_response = response.choices[0].message.content
|
# chatgpt_response = response.choices[0].message.content
|
||||||
return json_response
|
return json_response
|
||||||
|
|||||||
+71
-19
@@ -56,6 +56,7 @@ def merms_reset():
|
|||||||
response = LoginService.process_reset(data)
|
response = LoginService.process_reset(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/auth/resetverify", methods=["POST"])
|
@api.route("/panel/auth/resetverify", methods=["POST"])
|
||||||
# @jwt_required()
|
# @jwt_required()
|
||||||
def merms_resetverify():
|
def merms_resetverify():
|
||||||
@@ -63,6 +64,7 @@ def merms_resetverify():
|
|||||||
response = LoginService.verify_reset(data)
|
response = LoginService.verify_reset(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/auth/resetcomplete", methods=["POST"])
|
@api.route("/panel/auth/resetcomplete", methods=["POST"])
|
||||||
# @jwt_required()
|
# @jwt_required()
|
||||||
def merms_resetcomplete():
|
def merms_resetcomplete():
|
||||||
@@ -70,6 +72,7 @@ def merms_resetcomplete():
|
|||||||
response = LoginService.complete_reset(data)
|
response = LoginService.complete_reset(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/Login", methods=["POST"])
|
@api.route("/panel/Login", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_login():
|
def merms_login():
|
||||||
@@ -77,6 +80,7 @@ def merms_login():
|
|||||||
response = LoginService.process_request(data)
|
response = LoginService.process_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/Register", methods=["POST"])
|
@api.route("/panel/Register", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_register():
|
def merms_register():
|
||||||
@@ -84,7 +88,8 @@ def merms_register():
|
|||||||
response = RegisterService.process_request(data)
|
response = RegisterService.process_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
#/panel/Register/verify
|
|
||||||
|
# /panel/Register/verify
|
||||||
@api.route("/panel/Register/verify", methods=["POST"])
|
@api.route("/panel/Register/verify", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_register_verify():
|
def merms_register_verify():
|
||||||
@@ -92,6 +97,7 @@ def merms_register_verify():
|
|||||||
response = RegisterService.process_verify(data)
|
response = RegisterService.process_verify(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/Register/complete", methods=["POST"])
|
@api.route("/panel/Register/complete", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_register_complete():
|
def merms_register_complete():
|
||||||
@@ -99,6 +105,7 @@ def merms_register_complete():
|
|||||||
response = RegisterService.process_complete(data)
|
response = RegisterService.process_complete(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account", methods=["POST"])
|
@api.route("/panel/account", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_account():
|
def merms_account():
|
||||||
@@ -106,6 +113,7 @@ def merms_account():
|
|||||||
response = AccountService.process_request(data)
|
response = AccountService.process_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account-bar", methods=["POST"])
|
@api.route("/panel/account-bar", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_account_bar():
|
def merms_account_bar():
|
||||||
@@ -113,6 +121,7 @@ def merms_account_bar():
|
|||||||
response = AccountService.process_bar_data(data)
|
response = AccountService.process_bar_data(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/bar", methods=["POST"])
|
@api.route("/panel/account/bar", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_account_bar2():
|
def merms_account_bar2():
|
||||||
@@ -120,6 +129,7 @@ def merms_account_bar2():
|
|||||||
response = AccountService.process_bar_data(data)
|
response = AccountService.process_bar_data(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/actions", methods=["POST"])
|
@api.route("/panel/account/actions", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_account_actions():
|
def merms_account_actions():
|
||||||
@@ -127,6 +137,7 @@ def merms_account_actions():
|
|||||||
response = AccountService.process_action_request(data)
|
response = AccountService.process_action_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/productsurl", methods=["POST"])
|
@api.route("/panel/account/productsurl", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_account_product_url():
|
def merms_account_product_url():
|
||||||
@@ -134,6 +145,7 @@ def merms_account_product_url():
|
|||||||
response = ProductsService.product_url_request(data)
|
response = ProductsService.product_url_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/payments", methods=["POST"])
|
@api.route("/panel/account/payments", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_account_payments():
|
def merms_account_payments():
|
||||||
@@ -141,6 +153,7 @@ def merms_account_payments():
|
|||||||
response = AccountService.process_payments_data(data)
|
response = AccountService.process_payments_data(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/products/url", methods=["POST"])
|
@api.route("/panel/account/products/url", methods=["POST"])
|
||||||
def myproduct_url():
|
def myproduct_url():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -148,6 +161,7 @@ def myproduct_url():
|
|||||||
response = ProductsService.product_url_request(data)
|
response = ProductsService.product_url_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/products/refresh", methods=["POST"])
|
@api.route("/panel/account/products/refresh", methods=["POST"])
|
||||||
def myproduct_refresh():
|
def myproduct_refresh():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -155,6 +169,7 @@ def myproduct_refresh():
|
|||||||
response = ProductsService.myproduct_refresh_request(data)
|
response = ProductsService.myproduct_refresh_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/products/templates", methods=["POST"])
|
@api.route("/panel/account/products/templates", methods=["POST"])
|
||||||
# @token_required
|
# @token_required
|
||||||
def get_myproduct_templates():
|
def get_myproduct_templates():
|
||||||
@@ -164,6 +179,7 @@ def get_myproduct_templates():
|
|||||||
response = MyProductsService.mpproduct_template_data(data)
|
response = MyProductsService.mpproduct_template_data(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/template/activate", methods=["POST"])
|
@api.route("/panel/account/template/activate", methods=["POST"])
|
||||||
# @token_required
|
# @token_required
|
||||||
def get_myproduct_templates_activate():
|
def get_myproduct_templates_activate():
|
||||||
@@ -172,6 +188,7 @@ def get_myproduct_templates_activate():
|
|||||||
response = MyProductsService.process_set_template(data)
|
response = MyProductsService.process_set_template(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/contacts", methods=["POST"])
|
@api.route("/panel/contacts", methods=["POST"])
|
||||||
def merms_contacts():
|
def merms_contacts():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -179,6 +196,7 @@ 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():
|
||||||
@@ -194,6 +212,7 @@ def myproduct_dash():
|
|||||||
response = MyProductsService.process_request(data)
|
response = MyProductsService.process_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/myproduct/settings", methods=["POST"])
|
@api.route("/panel/myproduct/settings", methods=["POST"])
|
||||||
def myproduct_settings():
|
def myproduct_settings():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -201,6 +220,7 @@ def myproduct_settings():
|
|||||||
response = MyProductsService.process_settings(data)
|
response = MyProductsService.process_settings(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/myproduct/configuration", methods=["POST"])
|
@api.route("/panel/myproduct/configuration", methods=["POST"])
|
||||||
def myproduct_configuration():
|
def myproduct_configuration():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -216,6 +236,7 @@ def myproduct_settings_values():
|
|||||||
response = MyProductsService.process_settings_values(data)
|
response = MyProductsService.process_settings_values(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/subscription/products", methods=["POST"])
|
@api.route("/panel/subscription/products", methods=["POST"])
|
||||||
def subscription_products():
|
def subscription_products():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -223,6 +244,7 @@ def subscription_products():
|
|||||||
response = SubscriptionsService.subscription_available_products(data)
|
response = SubscriptionsService.subscription_available_products(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@api.route("/panel/subscription/start", methods=["POST"])
|
@api.route("/panel/subscription/start", methods=["POST"])
|
||||||
def subscription_sessuib_start():
|
def subscription_sessuib_start():
|
||||||
@@ -240,7 +262,8 @@ def myproduct_subscription():
|
|||||||
response = MyProductsService.process_subscription(data)
|
response = MyProductsService.process_subscription(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
#/panel/myproduct/provision
|
|
||||||
|
# /panel/myproduct/provision
|
||||||
@api.route("/panel/myproduct/provision", methods=["POST"])
|
@api.route("/panel/myproduct/provision", methods=["POST"])
|
||||||
def myproduct_provision():
|
def myproduct_provision():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -248,6 +271,7 @@ def myproduct_provision():
|
|||||||
response = MyProductsService.process_provision(data)
|
response = MyProductsService.process_provision(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/myproduct/provision-actions", methods=["POST"])
|
@api.route("/panel/myproduct/provision-actions", methods=["POST"])
|
||||||
def myproduct_provision_actions():
|
def myproduct_provision_actions():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -255,6 +279,7 @@ def myproduct_provision_actions():
|
|||||||
response = MyProductsService.process_provision_actions(data)
|
response = MyProductsService.process_provision_actions(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route("/stripe/payments", methods=["POST"])
|
@api.route("/stripe/payments", methods=["POST"])
|
||||||
def stripe_payments_webhook_post():
|
def stripe_payments_webhook_post():
|
||||||
try:
|
try:
|
||||||
@@ -274,7 +299,6 @@ def stripe_payments_webhook_post():
|
|||||||
logger.info("This block always runs.")
|
logger.info("This block always runs.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# /panel/account/calendar
|
# /panel/account/calendar
|
||||||
@api.route("/panel/account/calendar", methods=["POST"])
|
@api.route("/panel/account/calendar", methods=["POST"])
|
||||||
def mycalendar_dash():
|
def mycalendar_dash():
|
||||||
@@ -283,6 +307,7 @@ def mycalendar_dash():
|
|||||||
response = AccountService.process_calendar(data)
|
response = AccountService.process_calendar(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
# /panel/account/calendar
|
# /panel/account/calendar
|
||||||
@api.route("/panel/account/startprofile", methods=["POST"])
|
@api.route("/panel/account/startprofile", methods=["POST"])
|
||||||
def account_startprofile():
|
def account_startprofile():
|
||||||
@@ -291,17 +316,18 @@ def account_startprofile():
|
|||||||
response = AccountService.process_startprofile(data)
|
response = AccountService.process_startprofile(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
# Health Check Endpoint
|
# Health Check Endpoint
|
||||||
@api.route("/test", methods=["GET"])
|
@api.route("/test", methods=["GET"])
|
||||||
def test_check():
|
def test_check():
|
||||||
|
data = {"uid": "ok", "token": "jjjfjfjfjfjjf"}
|
||||||
data = {"uid": "ok", "token":"jjjfjfjfjfjjf"}
|
|
||||||
logger.info(f"Member Actions Error: {data}")
|
logger.info(f"Member Actions Error: {data}")
|
||||||
response = AccountService.process_action_request(data)
|
response = AccountService.process_action_request(data)
|
||||||
#response = ProductsService.process_request(data)
|
# response = ProductsService.process_request(data)
|
||||||
return {"status": "ok"}, 200
|
return {"status": "ok"}, 200
|
||||||
|
|
||||||
#======================================================
|
|
||||||
|
# ======================================================
|
||||||
@api.route('/office/login', methods=['POST'])
|
@api.route('/office/login', methods=['POST'])
|
||||||
def login():
|
def login():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -325,6 +351,7 @@ def login():
|
|||||||
|
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
|
|
||||||
@api.route('/office/dashboard', methods=['GET'])
|
@api.route('/office/dashboard', methods=['GET'])
|
||||||
# @token_required
|
# @token_required
|
||||||
def get_dashboard():
|
def get_dashboard():
|
||||||
@@ -332,6 +359,7 @@ def get_dashboard():
|
|||||||
result = OfficeDashboardService.get_dashboard_data()
|
result = OfficeDashboardService.get_dashboard_data()
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
|
|
||||||
@api.route('/office/customers', methods=['GET'])
|
@api.route('/office/customers', methods=['GET'])
|
||||||
# @token_required
|
# @token_required
|
||||||
def get_customer_office():
|
def get_customer_office():
|
||||||
@@ -346,6 +374,7 @@ def get_customer_office():
|
|||||||
response = OfficeCustomerService.get_customer_data(filters)
|
response = OfficeCustomerService.get_customer_data(filters)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@api.route('/office/subcriptions', methods=['GET'])
|
@api.route('/office/subcriptions', methods=['GET'])
|
||||||
# @token_required
|
# @token_required
|
||||||
def get_subcriptions_list_office():
|
def get_subcriptions_list_office():
|
||||||
@@ -360,35 +389,58 @@ def get_subcriptions_list_office():
|
|||||||
response = SubscriptionsService.get_subscription_data(filters)
|
response = SubscriptionsService.get_subscription_data(filters)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@api.route('/office/transaction', methods=['GET'])
|
|
||||||
|
@api.route('/office/billings', methods=['GET'])
|
||||||
# @token_required
|
# @token_required
|
||||||
def get_subscription_office():
|
def get_subscription_billings_office():
|
||||||
# Call the dashboard service
|
# Call the dashboard service
|
||||||
result = OfficeDashboardService.get_subscriptions_data()
|
filters = {
|
||||||
|
'product_id': request.args.get('product_id'),
|
||||||
|
'member_id': request.args.get('member_id'),
|
||||||
|
'page': request.args.get('page', 1),
|
||||||
|
'limit': request.args.get('limit', 20)
|
||||||
|
}
|
||||||
|
result = OfficeDashboardService.get_payments_data(filters)
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
|
|
||||||
#=====================================================
|
@api.route('/office/transaction', methods=['GET'])
|
||||||
|
# @token_required
|
||||||
|
def get_subscription_transaction_office():
|
||||||
|
# Call the dashboard service
|
||||||
|
filters = {
|
||||||
|
'product_id': request.args.get('product_id'),
|
||||||
|
'member_id': request.args.get('member_id'),
|
||||||
|
'page': request.args.get('page', 1),
|
||||||
|
'limit': request.args.get('limit', 20)
|
||||||
|
}
|
||||||
|
result = OfficeDashboardService.get_payments_data(filters)
|
||||||
|
return jsonify(result)
|
||||||
|
|
||||||
|
|
||||||
|
# =====================================================
|
||||||
@api.route('/web/contents', methods=['GET'])
|
@api.route('/web/contents', methods=['GET'])
|
||||||
# @token_required
|
# @token_required
|
||||||
def get_web_contents():
|
def get_web_contents():
|
||||||
# Call the dashboard service
|
# Call the dashboard service
|
||||||
provision_uid = request.args.get('provision_uid')
|
provision_uid = request.args.get('provision_uid')
|
||||||
result = WebContentsService.get_web_contents_data(provision_uid)
|
result = WebContentsService.get_web_contents_data(provision_uid)
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
#=====================================================
|
|
||||||
|
# =====================================================
|
||||||
@api.route('/web/generatives', methods=['GET'])
|
@api.route('/web/generatives', methods=['GET'])
|
||||||
def get_refresh_generatives():
|
def get_refresh_generatives():
|
||||||
logger.info("START TO ENTER GENERATIVE")
|
logger.info("START TO ENTER GENERATIVE")
|
||||||
# Call the dashboard service
|
# Call the dashboard service
|
||||||
data = []
|
data = []
|
||||||
result = GenerativesService.process_generatives_list(data)
|
result = GenerativesService.process_generatives_list(data)
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
#===================================================
|
|
||||||
|
# ===================================================
|
||||||
# Common Data
|
# Common Data
|
||||||
#=====================================================
|
# =====================================================
|
||||||
@api.route('/panel/common/practice', methods=['POST'])
|
@api.route('/panel/common/practice', methods=['POST'])
|
||||||
# @token_required
|
# @token_required
|
||||||
def common_practice():
|
def common_practice():
|
||||||
@@ -397,10 +449,11 @@ def common_practice():
|
|||||||
logger.info(f"Route common Practice Data ==>>>> {data}")
|
logger.info(f"Route common Practice Data ==>>>> {data}")
|
||||||
response = CommonDataService.available_practices(data)
|
response = CommonDataService.available_practices(data)
|
||||||
return response
|
return response
|
||||||
# return jsonify(result)
|
|
||||||
#===================================================
|
|
||||||
|
|
||||||
|
|
||||||
|
# return jsonify(result)
|
||||||
|
# ===================================================
|
||||||
|
|
||||||
|
|
||||||
# Health Check Endpoint
|
# Health Check Endpoint
|
||||||
@api.route("/health", methods=["GET"])
|
@api.route("/health", methods=["GET"])
|
||||||
@@ -408,7 +461,6 @@ def health_check():
|
|||||||
return {"status": "ok"}, 200
|
return {"status": "ok"}, 200
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Authorize endpoint
|
# Authorize endpoint
|
||||||
@api.route("/Authorize", methods=["POST"])
|
@api.route("/Authorize", methods=["POST"])
|
||||||
def authorize():
|
def authorize():
|
||||||
|
|||||||
@@ -16,10 +16,20 @@ class GenerativesService(BaseService):
|
|||||||
logger.info("ENTER GENERATIVE")
|
logger.info("ENTER GENERATIVE")
|
||||||
generate_list = GenerativesList.get_generative_list()
|
generate_list = GenerativesList.get_generative_list()
|
||||||
practice_type = "Dentist"
|
practice_type = "Dentist"
|
||||||
|
subscription_uid =" a42dbcc2-7466-4bea-aa67-8357c2c33925"
|
||||||
|
product_id ="A000001"
|
||||||
|
|
||||||
for t in generate_list:
|
for t in generate_list:
|
||||||
prompt_string = str(t["prompt"]).replace("REPLACE_THIS", practice_type)
|
prompt_string = str(t["prompt"]).replace("REPLACE_THIS", practice_type)
|
||||||
|
var_name = t["name"]
|
||||||
logger.info(f"GenerativesService ****** *****: {t['name']} {prompt_string}")
|
logger.info(f"GenerativesService ****** *****: {t['name']} {prompt_string}")
|
||||||
|
json_response = []
|
||||||
|
# json_response = GenerativeEngineIntegration.ask_generative(prompt_string)
|
||||||
|
if json_response is not None:
|
||||||
|
logger.info(json_response)
|
||||||
|
logger.info(json_response["output"])
|
||||||
|
logger.info(json_response["output"][0])
|
||||||
|
logger.info(json_response["output"][0]["content"][0]["text"])
|
||||||
|
text_result= json_response["output"][0]["content"][0]["text"]
|
||||||
|
logger.info(f"INSERT *****: {product_id} {var_name} {subscription_uid} {text_result}")
|
||||||
|
|
||||||
res = []
|
|
||||||
# res = GenerativeEngineIntegration.ask_generative("write 3 pharagraphs on a dentist website ")
|
|
||||||
logger.info(res)
|
|
||||||
|
|||||||
@@ -9,8 +9,63 @@ from app.models import MembersProducts, Products, Members, ProductsDetails, Prod
|
|||||||
|
|
||||||
class OfficeDashboardService(BaseService):
|
class OfficeDashboardService(BaseService):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_subscriptions_data():
|
def get_payments_data(filters):
|
||||||
pass
|
try:
|
||||||
|
if filters is None:
|
||||||
|
filters = {}
|
||||||
|
|
||||||
|
# Extract filters
|
||||||
|
product_id = filters.get('product_id')
|
||||||
|
member_id = filters.get('member_id')
|
||||||
|
|
||||||
|
# Extract pagination parameters
|
||||||
|
page = int(filters.get('page', 1))
|
||||||
|
limit = int(filters.get('limit', 20))
|
||||||
|
|
||||||
|
# Ensure page and limit are valid
|
||||||
|
if page < 1:
|
||||||
|
page = 1
|
||||||
|
if limit < 1 or limit > 100:
|
||||||
|
limit = 20
|
||||||
|
|
||||||
|
membersSubList, total_count = MembersProducts.get_all_subscriptions(product_id, member_id, page, limit)
|
||||||
|
# Convert loans to dictionary format
|
||||||
|
member_sub_data = []
|
||||||
|
for subs in membersSubList:
|
||||||
|
member_sub_data.append({
|
||||||
|
'id': subs.id,
|
||||||
|
'member_id': subs.member_id,
|
||||||
|
'product_id': subs.product_id,
|
||||||
|
'internal_url': subs.internal_url,
|
||||||
|
'external_url': subs.external_url,
|
||||||
|
'dns_group': subs.dns_group,
|
||||||
|
'status': subs.status,
|
||||||
|
'updated': subs.updated,
|
||||||
|
"added": subs.added,
|
||||||
|
})
|
||||||
|
|
||||||
|
# Calculate total pages
|
||||||
|
total_pages = (total_count + limit - 1) // limit
|
||||||
|
|
||||||
|
response_data = {
|
||||||
|
'subscriptions': member_sub_data,
|
||||||
|
'count': len(member_sub_data),
|
||||||
|
'pagination': {
|
||||||
|
'total_count': total_count,
|
||||||
|
'total_pages': total_pages,
|
||||||
|
'current_page': page,
|
||||||
|
'limit': limit,
|
||||||
|
'has_next': page < total_pages,
|
||||||
|
'has_prev': page > 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response_data
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True)
|
||||||
|
return jsonify({"message": "Internal Server Error"}), 500
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_dashboard_data():
|
def get_dashboard_data():
|
||||||
|
|||||||
Reference in New Issue
Block a user