const { sequelize,Test} = require('../models') const { logMsg } = require('../services/logger.js'); exports.Welcome = (req, res) => { try { const Msg = "Welcome....!"; console.log(Msg); logMsg.info("Api Call Success"); res.send({'status':200 , message:"Success." ,'data': Msg}); } catch(err) { res.status(500).send({'status':404, message: err.message || "Some error occurred while inserting statements." ,'data': "No data" }); } //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'); array = [ { "serviceID": 4, "active": 1 }, { "serviceID": 5, "active": 1 } ] value = 4; result = array.filter((item) => item.serviceID !== value); // let index = array.indexOf({"serviceID": value ,"active": 1}); // console.log(index) //removeByAttr(array, 'serviceID', value); //array[index].remove(); result = array.filter((item) => item.serviceID !== value); // dt = new Date(); // time = new moment(dt); // time.toString() // time = time.add(interval,'m'); res.send({'status':200 , message:"Success." , 'rslt' : result}); } catch(err) { res.status(500).send({'status':404, message: err.message || "Some error occurred while inserting statements." ,'data': "No data" }); } //end of try catch };