nocobase/packages/plugin-ui-schema/src/server.ts
2021-09-11 18:53:26 +08:00

19 lines
546 B
TypeScript

import path from 'path';
import { Application } from '@nocobase/server';
import { registerModels } from '@nocobase/database';
import * as models from './models';
import * as actions from './actions';
export default async function (this: Application, options = {}) {
const database = this.database;
registerModels(models);
database.import({
directory: path.resolve(__dirname, 'collections'),
});
for (const [name, action] of Object.entries(actions)) {
this.resourcer.registerActionHandler(`ui_schemas:${name}`, action);
}
}