feat: flatten the nested columns of exported data

This commit is contained in:
Ahmed Bouhuolia
2024-05-02 15:38:57 +02:00
parent 55aab76c9b
commit 83a5010dc5
21 changed files with 392 additions and 97 deletions

View File

@@ -49,6 +49,7 @@ export class GetBills {
const { results, pagination } = await Bill.query()
.onBuild((builder) => {
builder.withGraphFetched('vendor');
builder.withGraphFetched('entries.item');
dynamicFilter.buildQuery()(builder);
})
.pagination(filter.page - 1, filter.pageSize);

View File

@@ -14,6 +14,7 @@ export class VendorCreditTransformer extends Transformer {
'formattedSubtotal',
'formattedVendorCreditDate',
'formattedCreditsRemaining',
'formattedInvoicedAmount',
'entries',
];
};
@@ -58,6 +59,17 @@ export class VendorCreditTransformer extends Transformer {
});
};
/**
* Retrieves the formatted invoiced amount.
* @param credit
* @returns {string}
*/
protected formattedInvoicedAmount = (credit) => {
return formatNumber(credit.invoicedAmount, {
currencyCode: credit.currencyCode,
});
};
/**
* Retrieves the entries of the bill.
* @param {IVendorCredit} vendorCredit