diff --git a/controller/getInvestmentSummary/index.js b/controller/getInvestmentSummary/index.js index 05de4cf..7a00dca 100644 --- a/controller/getInvestmentSummary/index.js +++ b/controller/getInvestmentSummary/index.js @@ -31,7 +31,12 @@ const fetchAllInvestorId = async (sendId) => { } } -const getAllInvestorId = async () => { +const getAllInvestorId = ((req, res) => { + getAllInvestorIdFun(); + res.send("in procress"); +}) + +const getAllInvestorIdFun = async () => { let allInvestorId = await db.liquiloansInvestors.findAll({ attributes: ['investor_id'] }); @@ -130,7 +135,6 @@ const getUrlAndStore = async (callsData) => { if (summary?.length) { await db.investorSummary.bulkCreate(summary); } - console.log("Success getInvestment summary"); } catch (err) { errorLogStatus(err, "nodeJs_liquiloan_getUrlAndStore") diff --git a/controller/getTransactionById/index.js b/controller/getTransactionById/index.js index c6b995a..18d0684 100644 --- a/controller/getTransactionById/index.js +++ b/controller/getTransactionById/index.js @@ -21,8 +21,13 @@ function getHashCode(investor_id, request_id) { } +const getReqAndInvId = ((req, res) => { + getReqAndInvIdFun(); + res.send("in procress"); +}) + //get Request_Id and Investor_Id.... -const getReqAndInvId = async () => { +const getReqAndInvIdFun = async () => { let allInvestorId = await db.investorSummary.findAll({ attributes: ['investor_id', 'request_id'] }); @@ -37,9 +42,9 @@ const fetchReqAndInvId = async (sendId) => { let checkInvestorId = data[i].investor_id; let checkRequestId = data[i].request_id; if (checkInvestorId && checkRequestId) { - setTimeout(() => { - getTransactionById(checkInvestorId, checkRequestId) - }, 10); + // setTimeout(() => { + await getTransactionById(checkInvestorId, checkRequestId) + // }, 10); } } } @@ -61,12 +66,12 @@ const getTransactionById = (checkInvestorId, checkRequestId) => { request_id: checkRequestId.toString() }) }; - request(options, function (error, response) { + request(options, async function (error, response) { if (error) throw new Error(error); if (response.body) { - setTimeout(() => { - fetchTransactionId(response.body); - }, 10); + // setTimeout(() => { + await fetchTransactionId(response.body); + // }, 10); } }); } catch (err) { @@ -105,8 +110,7 @@ const fetchTransactionId = async (data) => { item.ext_transaction_date = trnId.ext_transaction_date, item.source_payment = trnId.source_payment, item.last_updatedAt = getCurrentDateTime() - - let isRecordPresent = await getInvTransIdQuery(item); + let isRecordPresent = await getInvTransIdQuery(item.request_id); if (isRecordPresent.length) { await db.transactionById.update(item, { where: {