add CacheService.findLocalUserByNativeToken and findOptionalLocalUserByNativeToken
This commit is contained in:
parent
8bf15a7fc2
commit
1eb7159173
2 changed files with 15 additions and 2 deletions
|
|
@ -701,6 +701,20 @@ export class CacheService implements OnApplicationShutdown {
|
|||
return user;
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async findLocalUserByNativeToken(token: string): Promise<MiLocalUser> {
|
||||
const id = await this.nativeTokenCache.fetch(token);
|
||||
return await this.findLocalUserById(id);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async findOptionalLocalUserByNativeToken(token: string): Promise<MiLocalUser | undefined> {
|
||||
const id = await this.nativeTokenCache.fetchMaybe(token);
|
||||
if (id == null) return undefined;
|
||||
|
||||
return await this.findOptionalLocalUserById(id);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async findRemoteUserById(userId: MiUser['id']): Promise<MiRemoteUser> {
|
||||
const user = await this.findUserById(userId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue