mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 添加app/load钩子
This commit is contained in:
1 parent
ce0357d9bd
commit
e5ed861f1b
10 files changed
+44
-19
No files matched your search
@@ -6,6 +6,7 @@ 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 { Value } from '../typeutils';
|
||||
import pwhash from '../lib/hash.hydro';
|
||||
import * as db from '../service/db';
|
||||
import * as bus from '../service/bus';
|
||||
@@ -172,11 +173,11 @@ export async function getByEmail(domainId: string, mail: string): Promise<User |
|
||||
return new User(udoc, dudoc);
|
||||
}
|
||||
|
||||
export function setById(uid: number, $set = {}, $unset = {}) {
|
||||
export async function setById(uid: number, $set?: Partial<Udoc>, $unset?: Value<Partial<Udoc>, ''>) {
|
||||
const op: any = {};
|
||||
if ($set && Object.keys($set).length) op.$set = $set;
|
||||
if ($unset && Object.keys($unset).length) op.$unset = $unset;
|
||||
return coll.findOneAndUpdate({ _id: uid }, op);
|
||||
return await coll.findOneAndUpdate({ _id: uid }, op);
|
||||
}
|
||||
|
||||
export function setEmail(uid: number, mail: string) {
|
||||
|
||||
Reference in new issue
Block a user