diff --git a/app/controllers/creditpd.controller.js b/app/controllers/creditpd.controller.js index 95330bf..8fb8127 100644 --- a/app/controllers/creditpd.controller.js +++ b/app/controllers/creditpd.controller.js @@ -19,32 +19,12 @@ exports.PullCreditPdData = async (req, res) => { if(CreditGeneralInformationDataExist) { - CreditGeneralInformation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id} - }).then(data=>{ - CreditAddressDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditFuturePlans.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditBorrowerAndGuarantorDetails.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditBusinessAndPersonalBankingDetails.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - BusinessAsset.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditFinancialInformation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditKeyShareholder.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditKeyProductBusinessContribution.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - EmployeeStrength.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - ClientDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - StockDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditExistingLoanObligation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - FamilyMemberInvolvedInBusiness.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditManager.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditFinalRemarks.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditLoanDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - CreditGeneralBusinessInformation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - SupplierDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); - }).catch(err=>{logMsg.info("GeneralInformation Deletion failed ,PdId(ref_no)= "+req.body.pdid+ " ERR =" + err); }); - // res.send({'status':200, 'message': "data already exist." ,'data': "No data" }); - // logMsg.info("CreditGeneralInformation data already exist.,PdId(ref_no)= "+req.body.pdid); - // } - // else - // { + + res.send({'status':200, 'message': "data already exist." ,'data': "No data" }); + logMsg.info("CreditGeneralInformation data already exist.,PdId(ref_no)= "+req.body.pdid); + } + else + { const arr = [ CreditAddressDetail , CreditBorrowerAndGuarantorDetails , CreditBusinessAndPersonalBankingDetails, BusinessAsset , ClientDetail , Covid19Questions , EmployeeStrength , CreditExistingLoanObligation , FamilyMemberInvolvedInBusiness , CreditFinalRemarks , CreditFinancialAnalysis , CreditFinancialInformation , CreditFuturePlans , CreditGeneralBusinessInformation , CreditGeneralInformation , CreditKeyProductBusinessContribution , CreditKeyShareholder , CreditLoanDetail , OverallPlanOfAction , PortFolioHealth , ProductAndProcess , CreditProfile , SizeAndGeographicalResearch , StockDetail , SupplierDetail , TotalOverallDebit , ValidationPoint , CreditManager , Photograph ] ; const tempData = JSON.parse(JSON.stringify(req.body)); PDID = []; diff --git a/app/controllers/test.controller.js b/app/controllers/test.controller.js index 3bde004..8bb753d 100644 --- a/app/controllers/test.controller.js +++ b/app/controllers/test.controller.js @@ -19,3 +19,82 @@ exports.Welcome = (req, res) => }); } //end of try catch }; + +exports.test = (req, res) => +{ + try + { + + // CreditGeneralInformation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id} + // }).then(data=>{ + // CreditAddressDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditFuturePlans.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditBorrowerAndGuarantorDetails.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditBusinessAndPersonalBankingDetails.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // BusinessAsset.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditFinancialInformation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditKeyShareholder.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditKeyProductBusinessContribution.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // EmployeeStrength.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // ClientDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // StockDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditExistingLoanObligation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // FamilyMemberInvolvedInBusiness.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditManager.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditFinalRemarks.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditLoanDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // CreditGeneralBusinessInformation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // SupplierDetail.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id}}); + // }).catch(err=>{logMsg.info("GeneralInformation Deletion failed ,PdId(ref_no)= "+req.body.pdid+ " ERR =" + err); }); + const moment = require('moment'); + console.log("hai"); + array = [ + "09:00 am", + "09:30 am", + "10:00 am", + "10:30 am", + "11:00 am", + "11:30 am", + "12:00 pm", + "12:30 pm", + "01:00 pm", + "01:00 pm", + "01:30 pm", + "02:00 pm", + "02:30 pm", + "03:00 pm", + "03:30 pm", + "04:00 pm", + "04:30 pm", + "05:00 pm", + "05:30 pm", + "06:00 pm", + "06:30 pm", + "07:00 pm", + "07:30 pm", + "08:00 pm", + "08:30 pm", + "09:00 pm", + ]; + let index = array.indexOf("02:30 pm"); + console.log(index) + // const firstSlt = new Date("Wed Apr 12 2023 12:15:00 GMT+0530"); + // const lastSlt = new Date("Wed Apr 12 2023 12:45:00 GMT+0530"); + const firstSlt = "11:30 am"; + // const filteredTimes = array.filter(time => time.length > 4; ); + + filteredTimes = array.filter(function(item) { + return array.indexOf(item) > index; + }); + // dt = new Date(); + // time = new moment(dt); + // time.toString() + // time = time.add(interval,'m'); + console.log(filteredTimes); + res.send({'status':200 , message:"Success." , 'rslt' : filteredTimes}); + } catch(err) { + res.status(500).send({'status':404, + message: err.message || "Some error occurred while inserting statements." ,'data': "No data" + }); } //end of try catch + +}; diff --git a/app/routes/routes.js b/app/routes/routes.js index 750b162..48ee9a6 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -20,6 +20,8 @@ module.exports = app => { */ router.get("/demo", Mycontroller.Welcome); + router.get("/test", Mycontroller.test); + router.post("/ReInsertImageData", CreditPdController.ReInsertImageData);