mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 04:33:50 +01:00
perf(server): reduce db query
This commit is contained in:
parent
7cbbd915ce
commit
c1ce301d24
@ -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 New Issue
Block a user