From 98b0bd8983d144bd34169f3000185450a64bb3af Mon Sep 17 00:00:00 2001 From: khanshanawaz10 Date: Wed, 13 Dec 2023 10:26:04 +0530 Subject: [PATCH] feat - model added --- controller/getInvestmentSumarry.js | 29 ++----------------- ...tors.js => P2P_Liquiloans_Inv_Summarys.js} | 12 ++++---- utils/db_config.js | 2 +- 3 files changed, 9 insertions(+), 34 deletions(-) rename model/{P2P_Liquiloans_Investors.js => P2P_Liquiloans_Inv_Summarys.js} (84%) diff --git a/controller/getInvestmentSumarry.js b/controller/getInvestmentSumarry.js index 25a60f5..ad62485 100644 --- a/controller/getInvestmentSumarry.js +++ b/controller/getInvestmentSumarry.js @@ -94,37 +94,12 @@ const getUrlAndStore = async (body) => { calls.push(record); console.log('calls---->', calls); - await db.P2P_Liquiloans_Investors.bulkCreate(calls); + await db.P2P_Liquiloans_Inv_Summarys.bulkCreate(calls); - // record.sid = callsData[i].Sid; - // record.date_created = callsData[i].DateCreated; - // record.date_updated = callsData[i].DateUpdated; - // record.account_sid = callsData[i].AccountSid; - // record.to = callsData[i].To; - // record.from = callsData[i].From; - // record.phone_number = callsData[i].PhoneNumber; - // record.phone_number_sid = callsData[i].PhoneNumberSid; - // record.status = callsData[i].Status; - // record.start_time = callsData[i].StartTime; - // record.end_time = callsData[i].EndTime; - // record.duration = callsData[i].Duration; - // record.price = callsData[i].Price; - // record.direction = callsData[i].Direction; - // record.recording_url = callsData[i].RecordingUrl; - - // record.conversation_duration = callsData[i].Details.ConversationDuration; - // record.leg1_status = callsData[i].Details.Leg1Status; - // record.leg2_status = callsData[i].Details.Leg2Status; - // record.created_at = new Date(); - - - // calls.push(record); - // console.log('calls---->', calls.length); - // await db.exotelCalls.bulkCreate(calls); } } catch (err) { - console.log(err); + console.log(err, "KDDODKODKODKODKODKODKO"); // winstonLogger.error('getUrlAndStore() error is : ' + err); } } diff --git a/model/P2P_Liquiloans_Investors.js b/model/P2P_Liquiloans_Inv_Summarys.js similarity index 84% rename from model/P2P_Liquiloans_Investors.js rename to model/P2P_Liquiloans_Inv_Summarys.js index 9b2e213..2c8880c 100644 --- a/model/P2P_Liquiloans_Investors.js +++ b/model/P2P_Liquiloans_Inv_Summarys.js @@ -1,10 +1,10 @@ module.exports = function (sequelize, DataTypes) { - const getInvestorSummary = sequelize.define('P2P_Liquiloans_Investors', { + const getInvestorSummary = sequelize.define('P2P_Liquiloans_Inv_Summarys', { - transaction_id: { type: DataTypes.INTEGER, allowNull: false, unique: true }, - investor_id: { type: DataTypes.INTEGER, allowNull: false, unique: true }, - scheme_id: { type: DataTypes.INTEGER, allowNull: false, unique: true }, - investment_roi: { type: DataTypes.INTEGER, allowNull: false, unique: true }, + transaction_id: { type: DataTypes.INTEGER, allowNull: true, unique: true }, + investor_id: { type: DataTypes.INTEGER, allowNull: true, unique: true }, + scheme_id: { type: DataTypes.INTEGER, allowNull: true, unique: true }, + investment_roi: { type: DataTypes.INTEGER, allowNull: true, unique: true }, return_type: { type: DataTypes.STRING, allowNull: true }, payout_type: { type: DataTypes.STRING, allowNull: true }, lockin_tenure: { type: DataTypes.INTEGER, allowNull: true }, @@ -32,7 +32,7 @@ module.exports = function (sequelize, DataTypes) { accrued_value: { type: DataTypes.INTEGER, allowNull: true }, withdrawable_balance: { type: DataTypes.INTEGER, allowNull: true }, scheme_closed_date: { type: DataTypes.STRING, allowNull: true }, - request_id: { type: DataTypes.STRING, allowNull: true }, + request_id: { type: DataTypes.INTEGER, allowNull: true }, source: { type: DataTypes.STRING, allowNull: true }, }, { //freezeTableName: true, // Model tableName will be the same as the model name diff --git a/utils/db_config.js b/utils/db_config.js index f020697..2b762e5 100644 --- a/utils/db_config.js +++ b/utils/db_config.js @@ -38,7 +38,7 @@ db.sequelize = sequelize; db.liquiloansInvestors = require('../model/liquiloansInvestors')(sequelize, Sequelize); -db.P2P_Liquiloans_Investors = require('../model/P2P_Liquiloans_Investors')(sequelize, Sequelize); +db.P2P_Liquiloans_Inv_Summarys = require('../model/P2P_Liquiloans_Inv_Summarys')(sequelize, Sequelize); module.exports = db;