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

17 lines
484 B
TypeScript
Raw Normal View History

2021-12-07 15:21:16 +08:00
import path from 'path';
import { Plugin } from '@nocobase/server';
2021-12-07 15:21:16 +08:00
import { afterCreate, afterUpdate, afterDestroy } from './hooks';
export default class extends Plugin {
name: 'action-logs';
2021-12-07 15:21:16 +08:00
async load() {
const database = this.app.db;
await database.import({
directory: path.resolve(__dirname, 'collections'),
});
database.on('afterCreate', afterCreate);
database.on('afterUpdate', afterUpdate);
database.on('afterDestroy', afterDestroy);
}
};