fix(server): add formatted values to responses transformers

This commit is contained in:
Ahmed Bouhuolia
2023-12-04 08:21:06 +02:00
parent 0f39cfb3af
commit fb70c94465
12 changed files with 189 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
import { IBill } from '@/interfaces';
import { Transformer } from '@/lib/Transformer/Transformer';
import { ItemEntryTransformer } from '@/services/Sales/Invoices/ItemEntryTransformer';
import { SaleInvoiceTaxEntryTransformer } from '@/services/Sales/Invoices/SaleInvoiceTaxEntryTransformer';
import { formatNumber } from 'utils';
@@ -23,6 +24,7 @@ export class PurchaseInvoiceTransformer extends Transformer {
'totalFormatted',
'totalLocalFormatted',
'taxes',
'entries',
];
};
@@ -178,4 +180,15 @@ export class PurchaseInvoiceTransformer extends Transformer {
currencyCode: bill.currencyCode,
});
};
/**
* Retrieves the entries of the bill.
* @param {Bill} credit
* @returns {}
*/
protected entries = (bill) => {
return this.item(bill.entries, new ItemEntryTransformer(), {
currencyCode: bill.currencyCode,
});
};
}