@fickou/adonis-audit-database
v1.0.17
Published
Help dev to filter database with query parameters
Downloads
8
Maintainers
Readme
adonis-audit-database
Add helper on Controller for Adonis JS 5+
Table of contents
Installation
Run:
npm i --save @fickou/adonis-audit-database
Install provider:
node ace configure @fickou/adonis-audit-database
Configuration
Go to config/audit.ts
and defined you own configuration:
import { AuditConfig } from "@ioc:Adonis/Addons/AuditDatabase";
import Env from "@ioc:Adonis/Core/Env";
const auditConfig: AuditConfig = {
connection: Env.get("AUDIT_CONNECTION","mongo://localhost"),
collection: Env.get('AUDIT_COLLECTION',"audit_db"),
};
export default auditConfig;
Sample Usage
Model
On each model just add @AuditWatcher()
on top like:
import {BaseModel, column} from '@ioc:Adonis/Lucid/Orm'
import {AuditWatcher} from "@fickou/adonis-audit-database";
@AuditWatcher()
export default class Package extends BaseModel {
@column({isPrimary: true})
public id: number
@column()
public label: number
}