Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 8x 7x 7x 2x | import { CostCenterData } from './cost-center.interface'; import { CostCenter } from './cost-center.model'; export class CostCenterMapper { static fromData(data: CostCenterData): CostCenter { if (data) { return { ...data, orders: data.orders?.map(order => ({ documentNo: order.orderNo, status: order.orderStatus, creationDate: order.orderDate.toString(), attributes: order.buyer.attributes, totalProductQuantity: order.items, totals: { total: { type: 'PriceItem', gross: order.orderTotalGross.value, net: order.orderTotalNet.value, currency: order.orderTotalGross.currency, }, itemTotal: undefined, isEstimated: false, }, })), }; } else E{ throw new Error(`'costCenterData' is required for the mapping`); } } } |