here in for loop with other operations ie: searching product, i have added for of loop and mapping product with store in mapping table. data size is in thousands.
for (let store of storesList) {
storeProductMappingRepository
.findOne({
relations: ["store", "product"],
where: {
store: store,
product: product,
},
})
.then((isMappingAvailable) => {
if (!isMappingAvailable) {
let storeProductMapping = new StoreProductMapping();
storeProductMapping.price = item.Item_Price;
storeProductMapping.store = store;
storeProductMapping.product = product;
storeProductMappingRepository.save(storeProductMapping);
}
});
}