This commit is contained in:
David Arranz 2025-10-24 13:07:09 +02:00
parent f2ef5d2267
commit 88f5062c03

View File

@ -189,13 +189,12 @@ export class CustomerRepository
deleted_at: null, deleted_at: null,
}; };
// Reemplazar findAndCountAll por findAll + count (más control y mejor rendimiento) const { rows, count } = await CustomerModel.findAndCountAll({
/*const { rows, count } = await CustomerModel.findAndCountAll({
...query, ...query,
transaction, transaction,
});*/ });
const [rows, count] = await Promise.all([ /*const [rows, count] = await Promise.all([
CustomerModel.findAll({ CustomerModel.findAll({
...CustomerModel, ...CustomerModel,
transaction, transaction,
@ -205,7 +204,7 @@ export class CustomerRepository
distinct: true, // evita duplicados por LEFT JOIN distinct: true, // evita duplicados por LEFT JOIN
transaction, transaction,
}), }),
]); ]);*/
return mapper.mapToDTOCollection(rows, count); return mapper.mapToDTOCollection(rows, count);
} catch (err: unknown) { } catch (err: unknown) {