From ddfcb22b11b5cf67087cb49d55b3f5c17e62dd03 Mon Sep 17 00:00:00 2001 From: venkataakhil Date: Thu, 22 Jun 2023 13:45:07 +0530 Subject: [PATCH] Clear publish data function --- smart_service/apis/master_api.py | 8 -------- smart_service/apis/support.py | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/smart_service/apis/master_api.py b/smart_service/apis/master_api.py index 1262a60..075b921 100644 --- a/smart_service/apis/master_api.py +++ b/smart_service/apis/master_api.py @@ -21,14 +21,6 @@ base_path = os.path.expanduser( "~") + "/frappe-bench/sites/" + site_name + "/public" -@frappe.whitelist(allow_guest=True) -def masters1(): - rate_res = custom_rate_limit(limit=5, seconds=10) - if rate_res != 1: - return rate_res - return 1 - - def custom_rate_limit(limit, seconds): ip_based = True ip = frappe.local.request_ip if ip_based is True else None diff --git a/smart_service/apis/support.py b/smart_service/apis/support.py index dd2ae7b..f498bd1 100644 --- a/smart_service/apis/support.py +++ b/smart_service/apis/support.py @@ -404,6 +404,18 @@ def set_procedure_false(): frappe.db.sql('''update `tabSystem Mapping_Sub System` set procedure_is_published=0; ''') frappe.db.commit() - return 1 + return True except Exception as e: - return e \ No newline at end of file + return False + + +@frappe.whitelist(allow_guest=1) +def clear_procedures(): + try: + set_procedure_false() + frappe.db.sql('''delete FROM `tabPublish`;''') + frappe.db.sql('''delete FROM `tabPublish_Docs`;''') + frappe.db.commit() + except Exception as e: + return e +