Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/plugins/billing/controllers/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
const {sanitizeEntity} = require('strapi-utils');
/**
* billing.js controller
*
* @description: A set of functions called "actions" of the `billing` plugin.
*/
module.exports = {
/**
* Default action.
*
* @return {Object}
*/
find_api_rates: async (ctx) => {
// const rate = await strapi.query('rate_api','billing').find({});
// const rate = await strapi.entityService.find({},{ model: "plugins::billing.rate_api" });
// return rate;
let entities;
if (ctx.query._q) {
entities = await strapi.query('rate_api','billing').search(ctx.query);
} else {
entities = await strapi.query('rate_api','billing').find(ctx.query);
}
return entities;
// ctx.send({
// message: 'ok'
// });
// return sanitizeEntity(rate,{ model: "plugins::billing.rate_api" });
},
create_api_rates: async (ctx) => {
const data=ctx.request.body
// console.log(data)
const result = await strapi.entityService.create({data},{ model: "plugins::billing.rate_api" });
if(result){
ctx.send({
message: 'Successfully Created'
});
}
},
async delete_api_rates(ctx) {
const {id}=ctx.params;
const entity = await strapi.query('rate_api','billing').delete({id});
if(entity){
ctx.send({
message: 'Successfully Deleted'
});
}
},
async fineOne_api_rates(ctx) {
const { id } = ctx.params;
console.log(id)
// const entity = await strapi.entityService.findOne({id},{ model: "plugins::billing.rate_api" });
const entity = await strapi.query('rate_api','billing').findOne({id});
return entity;
},
find_records: async (ctx) => {
let entities;
if (ctx.query._q) {
entities = await strapi.query('records','billing').search(ctx.query);
} else {
entities = await strapi.query('records','billing').find(ctx.query);
}
return entities;
},
create_records: async (ctx) => {
const data=ctx.request.body
const result = await strapi.entityService.create({data},{ model: "plugins::billing.records" });
if(result){
ctx.send({
message: 'Successfully Created'
});
}
},
async delete_records(ctx) {
const {id}=ctx.params;
const entity = await strapi.query('records','billing').delete({id});
if(entity){
ctx.send({
message: 'Successfully Deleted'
});
}
},
async fineOne_records(ctx) {
const { id } = ctx.params;
console.log(id)
;
const entity = await strapi.query('records','billing').findOne({id});
return entity;
},
async update_records(ctx) {
const { id } = ctx.params;
console.log({ id });
let entity;
if (ctx.is('multipart')) {
const { data, files } = parseMultipartData(ctx);
entity = await strapi.query('records','billing').update({ id }, data, {
files,
});
} else {
entity = await strapi.query('records','billing').update({ id }, ctx.request.body);
}
ctx.send({
message: 'Successfully Updated'
});
},
async update_api_rates(ctx) {
const { id } = ctx.params;
console.log({ id });
let entity;
if (ctx.is('multipart')) {
const { data, files } = parseMultipartData(ctx);
entity = await strapi.query('rate_api','billing').update({ id }, data, {
files,
});
} else {
entity = await strapi.query('rate_api','billing').update({ id }, ctx.request.body);
}
ctx.send({
message: 'Successfully Updated'
});
}
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.019 ]-- |