mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-16 08:04:45 -04:00
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 <git@herrmehren.de>
This commit is contained in:
parent
e52cf4b4ae
commit
921cffb76f
1 changed files with 3 additions and 4 deletions
|
@ -160,10 +160,9 @@ export class AuthService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTokensByUser(user: User): Promise<AuthToken[]> {
|
async getTokensByUser(user: User): Promise<AuthToken[]> {
|
||||||
const tokens = await this.authTokenRepository
|
const tokens = await this.authTokenRepository.find({
|
||||||
.createQueryBuilder('token')
|
where: { user: { id: user.id } },
|
||||||
.where('token.userId = :userId', { userId: user.id })
|
});
|
||||||
.getMany();
|
|
||||||
if (tokens === null) {
|
if (tokens === null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue