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

+2 -1
View File
@@ -1,6 +1,7 @@
import { Collection } from 'mongodb';
import { TokenDoc } from '../interface';
import * as db from '../service/db';
import * as bus from '../service/bus';
export const coll: Collection<TokenDoc> = db.collection('token');
@@ -87,7 +88,7 @@ export function delByUid(uid: number) {
return coll.deleteMany({ uid });
}
global.Hydro.postInit.push(ensureIndexes);
bus.once('app/started', ensureIndexes);
global.Hydro.model.token = {
coll,