2021-07-11 22:20:54 +08:00
|
|
|
import path from 'path';
|
2021-09-23 00:16:04 +08:00
|
|
|
import { PluginOptions } from '@nocobase/server';
|
2021-09-11 18:53:26 +08:00
|
|
|
import { registerModels } from '@nocobase/database';
|
2021-07-11 22:20:54 +08:00
|
|
|
import * as models from './models';
|
2021-08-11 14:27:45 +08:00
|
|
|
import * as actions from './actions';
|
2021-07-11 22:20:54 +08:00
|
|
|
|
2021-09-23 00:16:04 +08:00
|
|
|
registerModels(models);
|
2021-07-11 22:20:54 +08:00
|
|
|
|
2021-09-23 00:16:04 +08:00
|
|
|
export default {
|
|
|
|
name: 'ui-schema',
|
|
|
|
async load() {
|
|
|
|
const database = this.app.db;
|
|
|
|
|
|
|
|
database.import({
|
|
|
|
directory: path.resolve(__dirname, 'collections'),
|
|
|
|
});
|
|
|
|
|
|
|
|
for (const [name, action] of Object.entries(actions)) {
|
|
|
|
this.app.resourcer.registerActionHandler(`ui_schemas:${name}`, action);
|
|
|
|
}
|
2021-08-11 14:27:45 +08:00
|
|
|
}
|
2021-09-23 00:16:04 +08:00
|
|
|
} as PluginOptions;
|