2020-11-11 07:23:39 +00:00
|
|
|
import path from 'path';
|
|
|
|
import Database from '@nocobase/database';
|
|
|
|
import Resourcer from '@nocobase/resourcer';
|
2020-11-11 12:57:18 +00:00
|
|
|
import getCollection from './actions/getCollection';
|
|
|
|
import getView from './actions/getView';
|
2020-11-11 07:23:39 +00:00
|
|
|
|
|
|
|
export default async function (options = {}) {
|
|
|
|
const database: Database = this.database;
|
|
|
|
const resourcer: Resourcer = this.resourcer;
|
|
|
|
|
2020-11-11 12:57:18 +00:00
|
|
|
database.import({
|
2020-11-11 07:23:39 +00:00
|
|
|
directory: path.resolve(__dirname, 'collections'),
|
|
|
|
});
|
|
|
|
|
2020-11-11 12:57:18 +00:00
|
|
|
resourcer.registerHandler('getCollection', getCollection);
|
|
|
|
resourcer.registerHandler('getView', getView);
|
2020-11-11 07:23:39 +00:00
|
|
|
|
|
|
|
resourcer.import({
|
|
|
|
directory: path.resolve(__dirname, 'resources'),
|
|
|
|
});
|
|
|
|
}
|