feat: Added client price to api_pricings colletion

feat/client_price
adriano 2025-06-05 16:30:11 -03:00
parent 99259b69a2
commit feb05b3e6e
3 changed files with 11 additions and 5 deletions

View File

@ -13,7 +13,7 @@ const API_Usage_Whatsapp = require("../models/API_Usage_Whatsapp.js")
const setApiPricing = async (req, res) => { const setApiPricing = async (req, res) => {
const { provider, product, currency, price, billingBy, billingUnit, type } = req.body const { provider, product, currency, price, billingBy, billingUnit, type, clientPrice } = req.body
mustContainProperties(req, ['provider', mustContainProperties(req, ['provider',
'product', 'product',
@ -37,7 +37,8 @@ const setApiPricing = async (req, res) => {
price, price,
billingBy, billingBy,
billingUnit, billingUnit,
type type,
clientPrice
} }
const options = { new: true, upsert: true } const options = { new: true, upsert: true }

View File

@ -20,6 +20,9 @@ const apiPricing = new Schema({
type: String, type: String,
required: true required: true
}, },
clientPrice: {
type: String,
},
billingBy:{ billingBy:{
type: String, type: String,
enum: ['minute', 'character', 'token', 'second', 'hour'], enum: ['minute', 'character', 'token', 'second', 'hour'],

6
package-lock.json generated
View File

@ -7443,7 +7443,8 @@
"version": "4.4.0", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.4.0.tgz", "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.4.0.tgz",
"integrity": "sha512-BabizFdC3wBHhbI4kJh0VkQP9GkBfoHPydD0COMce1nJ1kJAB3F2TmJ/I7diULBKtmEWSwEbuN/KDtgnmUUVmw==", "integrity": "sha512-BabizFdC3wBHhbI4kJh0VkQP9GkBfoHPydD0COMce1nJ1kJAB3F2TmJ/I7diULBKtmEWSwEbuN/KDtgnmUUVmw==",
"dev": true "dev": true,
"requires": {}
}, },
"create-require": { "create-require": {
"version": "1.1.1", "version": "1.1.1",
@ -7748,7 +7749,8 @@
"express-async-errors": { "express-async-errors": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/express-async-errors/-/express-async-errors-3.1.1.tgz", "resolved": "https://registry.npmjs.org/express-async-errors/-/express-async-errors-3.1.1.tgz",
"integrity": "sha512-h6aK1da4tpqWSbyCa3FxB/V6Ehd4EEB15zyQq9qe75OZBp0krinNKuH4rAY+S/U/2I36vdLAUFSjQJ+TFmODng==" "integrity": "sha512-h6aK1da4tpqWSbyCa3FxB/V6Ehd4EEB15zyQq9qe75OZBp0krinNKuH4rAY+S/U/2I36vdLAUFSjQJ+TFmODng==",
"requires": {}
}, },
"express-fileupload": { "express-fileupload": {
"version": "1.2.1", "version": "1.2.1",