tachybase_todo/packages/plugin-users/src/server.ts

28 lines
723 B
TypeScript
Raw Normal View History

import path from 'path';
import Database from '@nocobase/database';
import Resourcer from '@nocobase/resourcer';
import login from './actions/login';
import register from './actions/register';
import logout from './actions/logout';
import check from './actions/check';
export default async function (options = {}) {
const database: Database = this.database;
const resourcer: Resourcer = this.resourcer;
2020-11-11 20:57:18 +08:00
database.import({
directory: path.resolve(__dirname, 'collections'),
});
resourcer.registerHandlers({
'users:login': login,
'users:register': register,
'users:logout': logout,
'users:check': check,
});
resourcer.import({
directory: path.resolve(__dirname, 'resources'),
});
}