core: 优化钩子逻辑

This commit is contained in:
undefined committed 2020-09-06 11:31:49 +08:00
1 parent 03dc8903e2
commit f2f0212947
27 files changed
+205 -124

No files matched your search

+3 -2
View File
@@ -5,9 +5,10 @@ import * as setting from './setting';
import * as domain from './domain';
import { BUILTIN_USERS, PRIV } from './builtin';
import { UserNotFoundError, UserAlreadyExistError, LoginError } from '../error';
import { User as _User, Udoc, Udict } from '../interface';
import pwhash from '../lib/hash.hydro';
import * as db from '../service/db';
import { User as _User, Udoc, Udict } from '../interface';
import * as bus from '../service/bus';
const coll: Collection<Udoc> = db.collection('user');
@@ -248,7 +249,7 @@ function ensureIndexes() {
]);
}
global.Hydro.postInit.push(ensureIndexes);
bus.once('app/started', ensureIndexes);
global.Hydro.model.user = {
User,
create,