diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-09-02 13:24:07 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-09-02 13:24:07 +0700 |
| commit | bf805f7da68891250a10d85d9206607de3cbfacf (patch) | |
| tree | 45355b1ed81f0a086497a8717636ee368b7ba578 /src/utils | |
| parent | 702b5d9b6e215ad812fadaff3325e1e6164d3b24 (diff) | |
<iman> temp save update fetch data promotion program line
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/solrMapping.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/solrMapping.js b/src/utils/solrMapping.js index fee474be..e93b0b54 100644 --- a/src/utils/solrMapping.js +++ b/src/utils/solrMapping.js @@ -1,3 +1,31 @@ +const map = (promotions) => { + const result = []; + for (const promotion of promotions) { + const data = { + id: promotion.id, + program_id: promotion.program_id_i, + name: promotion.name_s, + type: { + value: promotion.type_value_s, + label: promotion.type_label_s, + }, + limit: promotion.package_limit_i, + limit_user: promotion.package_limit_user_i, + limit_trx: promotion.package_limit_trx_i, + price: promotion.price_f, + sequence: promotion.sequence_i, + total_qty: promotion.total_qty_i, + products: JSON.parse(promotion.products_s), + product_id: promotion.product_ids[0], + qty_sold_f:promotion.total_qty_sold_f, + free_products: JSON.parse(promotion.free_products_s), + }; + result.push(data); + } + return result; +}; + + export const productMappingSolr = (products, pricelist) => { return products.map((product) => { let price = product.price_tier1_v2_f || 0; @@ -123,3 +151,4 @@ const flashsaleTime = (endDate) => { isFlashSale: flashsaleEndDate > currentTime, }; }; + |
