forked from FoundKeyGang/FoundKey
perf(server): reduce db query
This commit is contained in:
parent
f68b646878
commit
aebd77ad38
1 changed files with 3 additions and 3 deletions
|
@ -78,14 +78,14 @@ export default class DbResolver {
|
||||||
public async getAuthUserFromKeyId(keyId: string): Promise<AuthUser | null> {
|
public async getAuthUserFromKeyId(keyId: string): Promise<AuthUser | null> {
|
||||||
const key = await UserPublickeys.findOne({
|
const key = await UserPublickeys.findOne({
|
||||||
keyId,
|
keyId,
|
||||||
|
}, {
|
||||||
|
relations: ['user'],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (key == null) return null;
|
if (key == null) return null;
|
||||||
|
|
||||||
const user = await Users.findOne(key.userId) as IRemoteUser;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
user,
|
user: key.user as IRemoteUser,
|
||||||
key,
|
key,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue