feat: add three new properties to model and update usage controller
parent
54a4f837ce
commit
99259b69a2
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue