fix(server): skip throttle for currentUser (#6700)

This commit is contained in:
forehalo
2024-04-25 09:45:30 +00:00
parent 6237bf18ab
commit 3297486e31
5 changed files with 45 additions and 21 deletions

View File

@@ -12,7 +12,7 @@ import {
} from '@nestjs/graphql';
import type { Request, Response } from 'express';
import { Config, Throttle } from '../../fundamentals';
import { Config, SkipThrottle, Throttle } from '../../fundamentals';
import { UserService } from '../user';
import { UserType } from '../user/types';
import { validators } from '../utils/validators';
@@ -33,12 +33,6 @@ export class ClientTokenType {
sessionToken?: string;
}
/**
* Auth resolver
* Token rate limit: 20 req/m
* Sign up/in rate limit: 10 req/m
* Other rate limit: 5 req/m
*/
@Throttle('strict')
@Resolver(() => UserType)
export class AuthResolver {
@@ -49,6 +43,7 @@ export class AuthResolver {
private readonly token: TokenService
) {}
@SkipThrottle()
@Public()
@Query(() => UserType, {
name: 'currentUser',