Browse Source

fix - error query var char to into int issue resolved

pull/1/head
khanshanawaz10 1 year ago
parent
commit
2130217299
3 changed files with 16 additions and 13 deletions
  1. +1
    -1
      controller/Errorlog/index.js
  2. +4
    -6
      controller/getInvestmentSummary/index.js
  3. +11
    -6
      utils/scheduler.js

+ 1
- 1
controller/Errorlog/index.js View File

@ -4,7 +4,7 @@ const { getCurrentDateTime } = require("../helper");
function errorLogStatus(error = null, funName = null) {
let query = `INSERT INTO providentialadvisory.dbo.User_log
(client_code, request, status, response, created_date, created_by, api_name, Open_Close_Status, IPAddress, DeviceId, [Source], Header)
VALUES('23232323', '${error}', 0, '', '${getCurrentDateTime()}', '', '${funName}', 0, '', '', '', '')`;
VALUES('', '${(error).toString()}', ${0}, '', '${getCurrentDateTime()}', '', '${funName}', ${0}, '', '', '', '')`;
return db.sequelize.query(query, { type: db.sequelize.QueryTypes.INSERT });
}


+ 4
- 6
controller/getInvestmentSummary/index.js View File

@ -26,7 +26,7 @@ function getHashCode(req) {
const fetchAllInvestorId = async (sendId) => {
let data = JSON.parse(sendId)
for (let i = 0; i < data.length; i++) {
for (let i = 0; i < data?.length; i++) {
await createLiquiloanInvestor(data[i].investor_id, i)
}
}
@ -67,14 +67,13 @@ const createLiquiloanInvestor = (investor_id, index) => {
if (currentData) {
getUrlAndStore(currentData);
}
console.log(index, "investor_id-->", investor_id, "currentData-->", currentData.length, "pastData-->", pastData.length)
});
}
const getUrlAndStore = async (callsData) => {
try {
let summary = []
for (let i = 0; i < callsData.length; i++) {
for (let i = 0; i < callsData?.length; i++) {
let checkTrnId = await getInvSummaryIdQuery(callsData[i].request_id);
if (checkTrnId == 0) {
let record = {};
@ -121,7 +120,6 @@ const getUrlAndStore = async (callsData) => {
last_updatedAt: getCurrentDateTime()
}
console.log("WWWWWWWWWWWWR", record);
await db.investorSummary.update(record, {
where: {
request_id: record.request_id
@ -129,10 +127,10 @@ const getUrlAndStore = async (callsData) => {
});
}
}
if (summary.length) {
if (summary?.length) {
await db.investorSummary.bulkCreate(summary);
}
console.log("Success getInvestment summary");
}
catch (err) {
errorLogStatus(err, "nodeJs_liquiloan_getUrlAndStore")


+ 11
- 6
utils/scheduler.js View File

@ -1,25 +1,30 @@
'use strict';
const cron = require('node-cron');
const { fetchInvestorDetails } = require('../controller/getAllInvestor');
const { getAllInvestorId } = require('../controller/getInvestmentSummary');
const { getReqAndInvId } = require('../controller/getTransactionById');
const routineFetchAllInvestors = () => {
cron.schedule(process.env.SCHEDULER_RULE_FETCH_ALL_INVESTOR, () => {
console.log("running scheduler");
// recordingController.callExotelRecording();
console.log("running scheduler routineFetchAllInvestors");
fetchInvestorDetails()
})
};
const routineGetInvestmentSummary = () => {
cron.schedule(process.env.SCHEDULER_RULE_INVESTMENT_SUMMARY, () => {
console.log("running scheduler");
// recordingController.callExotelRecording();
console.log("running scheduler routineGetInvestmentSummary");
getAllInvestorId()
})
};
const routineGetTransactionById = () => {
cron.schedule(process.env.SCHEDULER_RULE_TRANS_ID, () => {
console.log("running scheduler");
// recordingController.callExotelRecording();
console.log("running scheduler routineGetTransactionById");
getReqAndInvId()
})
};


Loading…
Cancel
Save

Powered by TurnKey Linux.