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:
JurTI-BR
2025-11-03 18:05:14 -03:00
parent 3849fa1c4e
commit 25975fc0b0
17 changed files with 291 additions and 300 deletions

View File

@@ -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()

View File

@@ -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 {