refactor(user): lazy-load relations

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-12-05 22:03:41 +01:00
parent 4483d2b898
commit 977ed4b9fa
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
4 changed files with 17 additions and 17 deletions

View file

@ -65,9 +65,9 @@ export class AuthService {
identifier: string,
validUntil: TimestampMillis,
): Promise<AuthTokenWithSecretDto> {
user.authTokens = await this.getTokensByUser(user);
user.authTokens = this.getTokensByUser(user);
if (user.authTokens.length >= 200) {
if ((await user.authTokens).length >= 200) {
// This is a very high ceiling unlikely to hinder legitimate usage,
// but should prevent possible attack vectors
throw new TooManyTokensError(