Lalit Mishra
08/14/2023, 3:00 PMJason Bosco
08/14/2023, 3:00 PMLalit Mishra
08/14/2023, 3:03 PMLalit Mishra
08/14/2023, 3:03 PMJason Bosco
08/14/2023, 3:07 PMLalit Mishra
08/14/2023, 3:59 PMJason Bosco
08/14/2023, 4:01 PMthe data is nestedI’m not sure I understand this part. The structure of the
highlight
object in the response just follows your document’s original structureLalit Mishra
08/14/2023, 4:17 PMconst variantItems = itemsArray.flatMap(({ variants, itemName, id }) =>
variants?.flatMap(
({
locations,
name: variant,
salesPrice,
purchasePrice,
discountedPrice,
discountedPricePercentage,
}) =>
locations.flatMap(location => ({
id,
itemName,
locationName: location.location.name,
stock: location.currentQuantity,
variant,
salesPrice,
purchasePrice,
discountedPrice,
discountedPricePercentage,
status: 'In-stock',
}))
)
)
this is how i am getting the values to group by from the frontend can i get it with less complexity