diff options
Diffstat (limited to 'src/utils/solrMapping.js')
| -rw-r--r-- | src/utils/solrMapping.js | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/utils/solrMapping.js b/src/utils/solrMapping.js index d4694eb2..f73e966a 100644 --- a/src/utils/solrMapping.js +++ b/src/utils/solrMapping.js @@ -1,3 +1,28 @@ +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; @@ -36,9 +61,11 @@ export const productMappingSolr = (products, pricelist) => { tag: product?.flashsale_tag_s || 'FLASH SALE', }, qtySold: product?.qty_sold_f || 0, - isTkdn:product?.tkdn_b || false, - isSni:product?.sni_b || false, - voucherPastiHemat:product?.voucher_pastihemat || [] + isTkdn: product?.tkdn_b || false, + isSni: product?.sni_b || false, + newVoucherPastiHemat: [], + is_in_bu: product?.is_in_bu_b || false, + voucherPastiHemat: product?.voucher_pastihemat || [], }; if (product.manufacture_id_i && product.manufacture_name_s) { @@ -56,6 +83,14 @@ export const productMappingSolr = (products, pricelist) => { name: product.category_name_s || '', }, ]; + productMapped.newVoucherPastiHemat = [ + { + min_purchase: product.voucher_min_purchase_f || 0, + discount_type: product.voucher_discount_type_s || '', + discount_amount: product.voucher_discount_amount_f || 0, + max_discount: product.voucher_max_discount_f || 0, + }, + ]; return productMapped; }); }; |
