change getTokensByUsername to getTokensByUser

Signed-off-by: Yannick Bungers <git@innay.de>
This commit is contained in:
Yannick Bungers 2021-10-13 22:22:08 +02:00
parent 141b1bf5e8
commit aa8455a079
3 changed files with 12 additions and 14 deletions

View file

@ -140,14 +140,14 @@ export class AuthService {
return accessToken;
}
async getTokensByUsername(userName: string): Promise<AuthToken[]> {
const user = await this.usersService.getUserByUsername(userName, [
UserRelationEnum.AUTHTOKENS,
]);
if (user.authTokens === undefined) {
async getTokensByUser(user: User): Promise<AuthToken[]> {
const tokens = await this.authTokenRepository.find({
where: { user: user },
});
if (tokens === undefined) {
return [];
}
return user.authTokens;
return tokens;
}
async removeToken(keyId: string): Promise<void> {