This commit is contained in:
Ahmed Bouhuolia
2026-01-15 22:04:42 +02:00
parent 3c1273becb
commit 2bbc154f18
34 changed files with 301 additions and 176 deletions

View File

@@ -76,9 +76,14 @@ export class PaymentReceivedValidators {
customerId: number,
paymentReceiveEntries: { invoiceId: number }[],
): Promise<SaleInvoice[]> {
const invoicesIds = paymentReceiveEntries.map(
(e: { invoiceId: number }) => e.invoiceId,
);
const invoicesIds = paymentReceiveEntries
.map((e: { invoiceId: number }) => e.invoiceId)
.filter((id): id is number => id !== undefined && id !== null);
if (invoicesIds.length === 0) {
throw new ServiceError(ERRORS.INVOICES_IDS_NOT_FOUND);
}
const storedInvoices = await this.saleInvoiceModel()
.query()
.whereIn('id', invoicesIds)