diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-09-04 09:54:44 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-09-04 09:54:44 +0700 |
| commit | f6a398c036d2ab833ecb798fa88e641e2f801bb0 (patch) | |
| tree | 7aead541e26b5166ae3d2049fc732c7030e4e9c6 /src/utils | |
| parent | cbdeecd2fb8770afe46a374292e6ed3e5ec48214 (diff) | |
| parent | ad168bf46919b46f708625b7d2fdc56606ec9af6 (diff) | |
Merge branch 'update-allPromo-fetch' into backup-release
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/solrMapping.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils/solrMapping.js b/src/utils/solrMapping.js index fee474be..0d50b99b 100644 --- a/src/utils/solrMapping.js +++ b/src/utils/solrMapping.js @@ -1,3 +1,29 @@ +export const promoMappingSolr = (promotions) => { + return promotions.map((promotion) =>{ + let productMapped = { + 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) + }; + return productMapped; + }) +}; + + export const productMappingSolr = (products, pricelist) => { return products.map((product) => { let price = product.price_tier1_v2_f || 0; @@ -123,3 +149,4 @@ const flashsaleTime = (endDate) => { isFlashSale: flashsaleEndDate > currentTime, }; }; + |
