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,7 +1,7 @@
import { Service } from 'typedi';
import { ISaleEstimate } from '@/interfaces';
import { Transformer } from '@/lib/Transformer/Transformer';
import { formatNumber } from 'utils';
import { ItemEntryTransformer } from '../Invoices/ItemEntryTransformer';
export class SaleEstimateTransfromer extends Transformer {
/**
@@ -16,6 +16,7 @@ export class SaleEstimateTransfromer extends Transformer {
'formattedDeliveredAtDate',
'formattedApprovedAtDate',
'formattedRejectedAtDate',
'entries',
];
};
@@ -74,4 +75,15 @@ export class SaleEstimateTransfromer extends Transformer {
currencyCode: estimate.currencyCode,
});
};
/**
* Retrieves the entries of the sale estimate.
* @param {ISaleEstimate} estimate
* @returns {}
*/
protected entries = (estimate) => {
return this.item(estimate.entries, new ItemEntryTransformer(), {
currencyCode: estimate.currencyCode,
});
};
}