Browse Source

code fix

pull/1/head
Akhilesh Chandak 1 year ago
parent
commit
761c54551b
3 changed files with 14 additions and 40 deletions
  1. +12
    -9
      controller/getInvestmentSumarry.js
  2. +2
    -1
      model/investorSummary.js
  3. +0
    -30
      utils/db_config.js

+ 12
- 9
controller/getInvestmentSumarry.js View File

@ -22,6 +22,9 @@ function getHashCode(req) {
} }
const createLiquiloanInvestor = () => { const createLiquiloanInvestor = () => {
for (let i = 0; i < arrayGetList.length; i++) { for (let i = 0; i < arrayGetList.length; i++) {
@ -49,13 +52,11 @@ const createLiquiloanInvestor = () => {
const getUrlAndStore = async (body) => { const getUrlAndStore = async (body) => {
try { try {
const data = JSON.parse(body) const data = JSON.parse(body)
// console.log(data, "111111111111111111111111111111111111111111");
let callsData = data; let callsData = data;
let calls = [];
let summary = []
// if (callsData.length) { // if (callsData.length) {
console.log(callsData.data.past_investments.length, "LDPDPLDPLDPLLPDPDLDLPDPLDPL");
//console.log(callsData.data.past_investments.length, "LDPDPLDPLDPLLPDPDLDLPDPLDPL");
for (let i = 0; i < callsData.data.past_investments.length; i++) { for (let i = 0; i < callsData.data.past_investments.length; i++) {
console.log();
let record = {}; let record = {};
record.transaction_id = callsData.data.past_investments[i].transaction_id, record.transaction_id = callsData.data.past_investments[i].transaction_id,
record.investor_id = callsData.data.past_investments[i].investor_id, record.investor_id = callsData.data.past_investments[i].investor_id,
@ -89,14 +90,16 @@ const getUrlAndStore = async (body) => {
record.withdrawable_balance = callsData.data.past_investments[i].withdrawable_balance, record.withdrawable_balance = callsData.data.past_investments[i].withdrawable_balance,
record.scheme_closed_date = callsData.data.past_investments[i].scheme_closed_date, record.scheme_closed_date = callsData.data.past_investments[i].scheme_closed_date,
record.request_id = callsData.data.past_investments[i].request_id, record.request_id = callsData.data.past_investments[i].request_id,
record.source = callsData.data.past_investments[i].source
record.source = callsData.data.past_investments[i].source,
record.created_at = new Date()
calls.push(record);
console.log('calls---->', calls);
await db.P2P_Liquiloans_Inv_Summarys.bulkCreate(calls);
summary.push(record);
} }
console.log('calls---->', summary);
await db.investorSummary.bulkCreate(summary);
//}
} }
catch (err) { catch (err) {
console.log(err, "KDDODKODKODKODKODKODKO"); console.log(err, "KDDODKODKODKODKODKODKO");


+ 2
- 1
model/investorSummary.js View File

@ -1,7 +1,7 @@
module.exports = function (sequelize, DataTypes) { module.exports = function (sequelize, DataTypes) {
const getInvestorSummary = sequelize.define('P2P_Liquiloans_Inv_Summarys', { const getInvestorSummary = sequelize.define('P2P_Liquiloans_Inv_Summarys', {
transaction_id: { type: DataTypes.INTEGER, allowNull: true},
transaction_id: { type: DataTypes.INTEGER, allowNull: false, unique: true },
investor_id: { type: DataTypes.INTEGER, allowNull: true }, investor_id: { type: DataTypes.INTEGER, allowNull: true },
scheme_id: { type: DataTypes.INTEGER, allowNull: true }, scheme_id: { type: DataTypes.INTEGER, allowNull: true },
investment_roi: { type: DataTypes.INTEGER, allowNull: true }, investment_roi: { type: DataTypes.INTEGER, allowNull: true },
@ -34,6 +34,7 @@ module.exports = function (sequelize, DataTypes) {
scheme_closed_date: { type: DataTypes.STRING, allowNull: true }, scheme_closed_date: { type: DataTypes.STRING, allowNull: true },
request_id: { type: DataTypes.INTEGER, allowNull: true }, request_id: { type: DataTypes.INTEGER, allowNull: true },
source: { type: DataTypes.STRING, allowNull: true }, source: { type: DataTypes.STRING, allowNull: true },
created_at: { type: DataTypes.STRING, allowNull: true },
}, { }, {
//freezeTableName: true, // Model tableName will be the same as the model name //freezeTableName: true, // Model tableName will be the same as the model name
timestamps: false, timestamps: false,


+ 0
- 30
utils/db_config.js View File

@ -44,33 +44,3 @@ db.investorSummary = require('../model/investorSummary')(sequelize, Sequelize);
module.exports = db; module.exports = db;
/*
const sql = require('mssql')
const sqlConfig = {
user: 'BSeMF',
password: 'nivesh2017',
database: 'providentialadvisory',
server: 'ec2-13-235-204-185.ap-south-1.compute.amazonaws.com',
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 30000
},
options: {
encrypt: true, // for azure
trustServerCertificate: true // change to true for local dev / self-signed certs
}
}
const connection = async () => {
try {
console.log('ajksfkgjsafkksafkkfskf')
let con = await sql.connect(sqlConfig)
console.log('connection',con);
} catch (err) {
console.log(err);
}
};
connection();
*/

Loading…
Cancel
Save

Powered by TurnKey Linux.