From 921cffb76f3222fed6ebd825d969695bd319dfda Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 26 Jun 2022 23:25:53 +0200 Subject: [PATCH] fix(auth-service): typeorm query in getTokensbyUser TypeORM does not support WHERE queries for relation-colums directly. This replaces the Equal() constructor with a manual comparison of the IDs. See https://github.com/typeorm/typeorm/issues/2707 Signed-off-by: David Mehren --- backend/src/auth/auth.service.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/src/auth/auth.service.ts b/backend/src/auth/auth.service.ts index 9047eeeca..750037e27 100644 --- a/backend/src/auth/auth.service.ts +++ b/backend/src/auth/auth.service.ts @@ -160,10 +160,9 @@ export class AuthService { } async getTokensByUser(user: User): Promise { - const tokens = await this.authTokenRepository - .createQueryBuilder('token') - .where('token.userId = :userId', { userId: user.id }) - .getMany(); + const tokens = await this.authTokenRepository.find({ + where: { user: { id: user.id } }, + }); if (tokens === null) { return []; }