tachybase_todo/packages/plugin-ui-schema/src/server.ts

19 lines
553 B
TypeScript
Raw Normal View History

2021-07-11 22:20:54 +08:00
import path from 'path';
import { Application } from '@nocobase/server';
import { registerModels, Table } from '@nocobase/database';
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
export default async function (this: Application, options = {}) {
const database = this.database;
registerModels(models);
database.import({
directory: path.resolve(__dirname, 'collections'),
});
2021-08-11 14:27:45 +08:00
for (const [name, action] of Object.entries(actions)) {
this.resourcer.registerActionHandler(`ui_schemas:${name}`, action);
}
2021-07-11 22:20:54 +08:00
}