add api method
This commit is contained in:
parent
3ea47162c5
commit
6025a9890a
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user