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:
@@ -11,7 +11,14 @@ export class RedisClientAdapter implements IRedisClient {
|
||||
|
||||
async get<T>(key: string): Promise<T | null> {
|
||||
const data = await this.redis.get(key);
|
||||
return data ? JSON.parse(data) : null;
|
||||
if (!data) return null;
|
||||
|
||||
try {
|
||||
return JSON.parse(data);
|
||||
} catch (error) {
|
||||
// If it's not valid JSON, return the raw string value
|
||||
return data as T;
|
||||
}
|
||||
}
|
||||
|
||||
async set<T>(key: string, value: T, ttlSeconds = 300): Promise<void> {
|
||||
|
||||
2
src/core/configs/cache/redis.provider.ts
vendored
2
src/core/configs/cache/redis.provider.ts
vendored
@@ -6,7 +6,7 @@
|
||||
provide: 'REDIS_CLIENT',
|
||||
useFactory: (configService: ConfigService) => {
|
||||
const redis = new Redis({
|
||||
host: configService.get<string>('REDIS_HOST', '10.1.1.124'),
|
||||
host: configService.get<string>('REDIS_HOST', '10.1.1.109'),
|
||||
port: configService.get<number>('REDIS_PORT', 6379),
|
||||
password: configService.get<string>('REDIS_PASSWORD', '1234'),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user