From 99259b69a26e0f68e61d303d70121fd6888b8087 Mon Sep 17 00:00:00 2001 From: adriano Date: Tue, 13 Aug 2024 09:26:46 -0300 Subject: [PATCH] feat: add three new properties to model and update usage controller --- controllers/apiUsagePricing.js | 10 +++++++++- models/API_Usage_Whatsapp.js | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/controllers/apiUsagePricing.js b/controllers/apiUsagePricing.js index 7730b64..e23c043 100644 --- a/controllers/apiUsagePricing.js +++ b/controllers/apiUsagePricing.js @@ -99,11 +99,14 @@ const registerUsage = async (req, res) => { const registerWhatsappUsage = async (req, res) => { const { companyId, + companyPhone, + clientPhone, provider, product, type, msgId, ticketId, + ticketUrl, billable, pricing_model, } = req.body @@ -116,7 +119,9 @@ const registerWhatsappUsage = async (req, res) => { 'msgId', 'ticketId', 'billable', - 'pricing_model' + 'pricing_model', + 'companyPhone', + 'clientPhone', ]) const apiPricing = await API_Pricing.findOne({ @@ -132,11 +137,14 @@ const registerWhatsappUsage = async (req, res) => { const apiUsageWhatsapp = await API_Usage_Whatsapp.create({ companyId, + companyPhone, + clientPhone, provider: provider.trim().toLowerCase(), product: product.trim().toLowerCase(), price, msgId, ticketId, + ticketUrl, billable, pricing_model, type diff --git a/models/API_Usage_Whatsapp.js b/models/API_Usage_Whatsapp.js index db5fd8c..5ac8736 100644 --- a/models/API_Usage_Whatsapp.js +++ b/models/API_Usage_Whatsapp.js @@ -7,6 +7,14 @@ const apiUsageWhatsapp = new Schema({ type: String, required: true, }, + companyPhone: { + type: String, + required: true, + }, + clientPhone: { + type: String, + required: true, + }, msgId: { type: String, required: true, @@ -15,6 +23,10 @@ const apiUsageWhatsapp = new Schema({ type: String, required: true, }, + ticketUrl: { + type: String, + required: true, + }, provider: { type: String, required: true,