2021-12-07 15:21:16 +08:00
|
|
|
import path from 'path';
|
2022-02-02 19:08:33 +08:00
|
|
|
import { Plugin } from '@nocobase/server';
|
2021-12-07 15:21:16 +08:00
|
|
|
import { afterCreate, afterUpdate, afterDestroy } from './hooks';
|
|
|
|
|
2022-02-02 19:08:33 +08:00
|
|
|
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);
|
2022-02-02 19:08:33 +08:00
|
|
|
}
|
|
|
|
};
|