tachybase_todo/packages/plugins/action-logs/src/server.ts

22 lines
537 B
TypeScript
Raw Normal View History

2021-12-07 15:21:16 +08:00
import path from 'path';
import { afterCreate, afterUpdate, afterDestroy } from './hooks';
import { Plugin } from '@nocobase/server';
export default class PluginActionLogs extends Plugin {
async beforeLoad() {
this.db.on('afterCreate', afterCreate);
this.db.on('afterUpdate', afterUpdate);
this.db.on('afterDestroy', afterDestroy);
}
2021-12-07 15:21:16 +08:00
async load() {
await this.db.import({
2021-12-07 15:21:16 +08:00
directory: path.resolve(__dirname, 'collections'),
});
}
getName(): string {
return this.getPackageName(__dirname);
}
}