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:
@@ -403,7 +403,12 @@ WHERE
|
||||
);
|
||||
}
|
||||
if (query.sellerId) {
|
||||
conditions.push(`AND PCPEDC.CODUSUR = :sellerId`);
|
||||
const sellerIds = query.sellerId
|
||||
.split(",")
|
||||
.map((s) => s.trim())
|
||||
.filter((s) => s)
|
||||
.join(",");
|
||||
conditions.push(`AND PCPEDC.CODUSUR IN (${sellerIds})`);
|
||||
}
|
||||
if (query.customerId) {
|
||||
conditions.push(`AND PCPEDC.CODCLI = :customerId`);
|
||||
@@ -572,9 +577,6 @@ WHERE
|
||||
if (query.filialretira) {
|
||||
parameters.storeStockId = query.filialretira;
|
||||
}
|
||||
if (query.sellerId) {
|
||||
parameters.sellerId = query.sellerId;
|
||||
}
|
||||
if (query.customerId) {
|
||||
parameters.customerId = query.customerId;
|
||||
}
|
||||
@@ -805,7 +807,12 @@ WHERE
|
||||
conditions.push(`AND PCPEDC.CODFILIAL = :storeId`);
|
||||
}
|
||||
if (query.sellerId) {
|
||||
conditions.push(`AND PCPEDC.CODUSUR = :sellerId`);
|
||||
const sellerIds = query.sellerId
|
||||
.split(",")
|
||||
.map((s) => s.trim())
|
||||
.filter((s) => s)
|
||||
.join(",");
|
||||
conditions.push(`AND PCPEDC.CODUSUR IN (${sellerIds})`);
|
||||
}
|
||||
if (query.customerId) {
|
||||
conditions.push(`AND PCPEDC.CODCLI = :customerId`);
|
||||
@@ -889,9 +896,6 @@ WHERE
|
||||
if (query.codfilial) {
|
||||
parameters.storeId = query.codfilial;
|
||||
}
|
||||
if (query.sellerId) {
|
||||
parameters.sellerId = query.sellerId;
|
||||
}
|
||||
if (query.customerId) {
|
||||
parameters.customerId = query.customerId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user