add api method

This commit is contained in:
Casey Wittrock 2025-11-07 15:53:15 -06:00
parent 3ea47162c5
commit 6025a9890a
2 changed files with 7 additions and 6 deletions

View File

@ -230,22 +230,18 @@ def get_clients(options):
def upsert_estimate(data):
pass
@frappe.whitelist()
def upsert_job(data):
pass
@frappe.whitelist()
def upsert_invoice(data):
pass
@frappe.whitelist()
def upsert_warranty(data):
pass
@frappe.whitelist()
def upsert_client(data):
data = json.loads(data)

View File

@ -6,6 +6,7 @@ const FRAPPE_UPSERT_CLIENT_METHOD = "custom_ui.api.db.upsert_client";
const FRAPPE_UPSERT_ESTIMATE_METHOD = "custom_ui.api.db.upsert_estimate";
const FRAPPE_UPSERT_JOB_METHOD = "custom_ui.api.db.upsert_job";
const FRAPPE_UPSERT_INVOICE_METHOD = "custom_ui.api.db.upsert_invoice";
const FRAPPE_GET_STATUS_COUNTS_METHOD = "custom_ui.api.db.get_client_status_counts";
class Api {
static async request(frappeMethod, args = {}) {
@ -28,6 +29,10 @@ class Api {
}
}
static async getStatusCounts() {
return;
}
static async getClientDetails(options = {}) {
return await this.request("custom_ui.api.db.get_clients", { options });
}
@ -289,14 +294,14 @@ class Api {
const payload = DataUtils.toSnakeCaseObject(invoiceData);
const result = await this.request(FRAPPE_UPSERT_INVOICE_METHOD, { data: payload });
console.log("DEBUG: API - Created Invoice: ", result);
return result
return result;
}
static async createWarranty(warrantyData) {
const payload = DataUtils.toSnakeCaseObject(warrantyData);
const result = await this.request(FRAPPE_UPSERT_INVOICE_METHOD, { data: payload });
console.log("DEBUG: API - Created Warranty: ", result);
return result
return result;
}
// External API calls