Skip to content

Commit

Permalink
fix(throttler): make throttler more restrictive
Browse files Browse the repository at this point in the history
  • Loading branch information
emile-bex committed Oct 24, 2023
1 parent c14d77b commit 773e53d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function getSequelizeOptions(): SequelizeModuleOptions {
SequelizeModule.forRoot(getSequelizeOptions()),
ThrottlerModule.forRoot({
ttl: 60,
limit: 100,
limit: 60,
}),
BullModule.forRoot({
redis: ENV === 'dev-test' || ENV === 'test' ? {} : getRedisOptions(),
Expand Down
2 changes: 1 addition & 1 deletion src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class AuthController {
return updatedUser;
}

@Throttle(100, 60)
@Throttle(60, 60)
@Get('current')
async getCurrent(@UserPayload('id', new ParseUUIDPipe()) id: string) {
const updatedUser = await this.authService.updateUser(id, {
Expand Down
2 changes: 2 additions & 0 deletions src/contacts/contacts.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Get,
Post,
} from '@nestjs/common';
import { Throttle } from '@nestjs/throttler';
import { Public } from 'src/auth/guards';
import {
ContactCompanyFormDto,
Expand All @@ -25,6 +26,7 @@ import { InscriptionCandidateFormDto } from './dto/inscription-candidate-form.dt
import { InscriptionCandidateFormPipe } from './dto/inscription-candidate-form.pipe';

// TODO change to /contacts
@Throttle(20, 60)
@Controller('contact')
export class ContactsController {
constructor(private readonly contactsService: ContactsService) {}
Expand Down

0 comments on commit 773e53d

Please sign in to comment.