2021-12-07 15:21:16 +08:00
|
|
|
import path from 'path';
|
|
|
|
import { afterCreate, afterUpdate, afterDestroy } from './hooks';
|
2022-02-07 01:14:00 +08:00
|
|
|
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() {
|
2022-02-07 01:14:00 +08:00
|
|
|
await this.db.import({
|
2021-12-07 15:21:16 +08:00
|
|
|
directory: path.resolve(__dirname, 'collections'),
|
|
|
|
});
|
2022-02-02 19:08:33 +08:00
|
|
|
}
|
2022-03-28 22:01:10 +08:00
|
|
|
|
|
|
|
getName(): string {
|
|
|
|
return this.getPackageName(__dirname);
|
|
|
|
}
|
2022-02-07 01:14:00 +08:00
|
|
|
}
|