
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
@fickou/adonis-controller-helpers
Advanced tools
Help dev to filter database with query parameters
Add helper on Controller for Adonis JS 5+
Run:
npm i --save @fickou/adonis-controller-helpers
Install provider:
node ace configure @fickou/adonis-controller-helpers
In a controller
import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
import IndexService from 'App/Services/users/Index'
import Database from "@ioc:Adonis/Lucid/Database";
export default UserController{
public index({ request, response }: HttpContextContract){
let data = await request.checkInputs();
await Database.transaction(async (trx) => {
const executor = new Index(trx);
return response.apiView(await executor.execute(data));
});
}
}
In a service:
import Parameter from 'App/Models/settings/Parameter';
import ControllerHelper, from "@ioc:Adonis/Addons/ControllerHelper";
import {Service} from "@fickou/adonis-controller-helpers";
export default class Index extends Service {
async execute(payload) {
const query = Parameter.query({client: this.trx});
return ControllerHelper.searchPayload(query, payload);
}
}
// or
export default class Index extends Service {
async execute(payload) {
const query = ControllerHelper.buildQuery((this.trx || Database), (db) => db.query()
.from('parameters')
.select(['*']);
return ControllerHelper.searchDatabasePayload(query, payload);
}
}
FAQs
Help dev to filter database with query parameters
The npm package @fickou/adonis-controller-helpers receives a total of 0 weekly downloads. As such, @fickou/adonis-controller-helpers popularity was classified as not popular.
We found that @fickou/adonis-controller-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.