From 750b70b075ca3c3bd6cc1f97a0b97076a7d439bc Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 24 May 2024 11:35:09 +0530 Subject: [PATCH] refactor: Wrap meta in v2 (#26548) --- frappe/api/v2.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frappe/api/v2.py b/frappe/api/v2.py index 06b6eab04e..e7603333c5 100644 --- a/frappe/api/v2.py +++ b/frappe/api/v2.py @@ -115,6 +115,11 @@ def delete_doc(doctype: str, name: str): return "ok" +def get_meta(doctype: str): + frappe.only_for("All") + return frappe.get_meta(doctype) + + def execute_doc_method(doctype: str, name: str, method: str | None = None): """Get a document from DB and execute method on it. @@ -188,6 +193,6 @@ url_rules = [ endpoint=execute_doc_method, ), # Collection level APIs - Rule("/doctype//meta", methods=["GET"], endpoint=frappe.get_meta), + Rule("/doctype//meta", methods=["GET"], endpoint=get_meta), Rule("/doctype//count", methods=["GET"], endpoint=count), ]