feat: suporte a múltiplos sellerId e melhorias no código
- Adicionado suporte para sellerId como string separada por vírgula (ex: 270,431) - Melhorias em deb.repository: tipagem e documentação - Melhorias em deb.service: remoção de validação redundante - Melhorias em deb.controller: remoção de try/catch duplicado - Melhorias em orders.service: early returns e tipagem melhorada - Aplicado early returns para reduzir aninhamento - Melhorias de tipagem em todos os métodos
This commit is contained in:
@@ -3,7 +3,6 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class LoginDto {
|
||||
@ApiProperty({
|
||||
example: 'joelson.r',
|
||||
description: 'Usuário de login',
|
||||
})
|
||||
@IsString()
|
||||
@@ -11,7 +10,6 @@ export class LoginDto {
|
||||
username: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: '1010',
|
||||
description: 'Senha do usuário',
|
||||
})
|
||||
@IsString()
|
||||
|
||||
@@ -11,9 +11,9 @@ export interface RateLimitConfig {
|
||||
@Injectable()
|
||||
export class RateLimitingService {
|
||||
private readonly defaultConfig: RateLimitConfig = {
|
||||
maxAttempts: 5, // 5 tentativas
|
||||
windowMs: 15 * 60 * 1000, // 15 minutos
|
||||
blockDurationMs: 30 * 60 * 1000, // 30 minutos de bloqueio
|
||||
maxAttempts: 15, // 15 tentativas
|
||||
windowMs: 1 * 60 * 1000, // 1 minuto
|
||||
blockDurationMs: 1 * 60 * 1000, // 1 minuto de bloqueio
|
||||
};
|
||||
|
||||
constructor(
|
||||
@@ -115,7 +115,7 @@ export class RateLimitingService {
|
||||
const blockKey = this.buildBlockKey(ip);
|
||||
|
||||
const attempts = await this.redis.get<string>(key);
|
||||
const isBlocked = await this.redis.get(blockKey);
|
||||
const isBlocked = await this.redis.get<string>(blockKey);
|
||||
const ttl = await this.redis.ttl(blockKey);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user