From 7eb804d455873501b9ac82a54b8b96a762be9e31 Mon Sep 17 00:00:00 2001 From: suseendhiran17 <58357088+suseendhiran17@users.noreply.github.com> Date: Mon, 27 Jun 2022 17:37:04 +0530 Subject: [PATCH] susee , landing page api & loan detail api --- .../entity.applicant.controller.js | 35 +++++++++++++++++-- app/controllers/test.controller.js | 26 +++++++++++--- app/models/LoanDetail.js | 2 +- app/routes/routes.js | 34 ++++++++++++------ 4 files changed, 78 insertions(+), 19 deletions(-) diff --git a/app/controllers/entity.applicant.controller.js b/app/controllers/entity.applicant.controller.js index 06935ac..09501c5 100644 --- a/app/controllers/entity.applicant.controller.js +++ b/app/controllers/entity.applicant.controller.js @@ -483,12 +483,12 @@ exports.updateEnquiriesAndDisbursementsDetails = async (req, res) => }; -//LoanNumberDetails List Api -exports.LoanNumberDetailsList = async (req, res) => +//landingPageApi(All Loan detail list ) List Api +exports.landingPageApi = async (req, res) => { try { - LoanDetail.findAll({raw: true , where : { losid : req.query.losid , is_active : 1}}).then(data => + LoanDetail.findAll({raw: true , where : { is_active : 1}}).then(data => { if(data.length > 0) { @@ -1048,6 +1048,35 @@ exports.OtherParametersList = async (req, res) => }; +//LoanDeatilList List Api +exports.LoanDeatilList = async (req, res) => +{ + try + { + LoanDetail.findAll({raw: true , where : { losid : req.query.losid , is_active : 1}}).then(data => + { + if(data.length > 0) + { + res.send({'status':200,'message':"success",'data':data}); + } + else { + res.send({'status':404,'message':"failed",'data':"No data"}); + } + + + }) + .catch(err => { + res.send({'status':404, + message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" }); + }); + + } catch(err) { + res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data" }); + } //end of try catch + +}; + + diff --git a/app/controllers/test.controller.js b/app/controllers/test.controller.js index eed5e80..c74c824 100644 --- a/app/controllers/test.controller.js +++ b/app/controllers/test.controller.js @@ -18,20 +18,36 @@ exports.Welcome = (req, res) => }; + + + + + + + + + + + + + // IF( -// AND( variance_in_mv1_and_mv2 > 10% OR (mark_valuation_1 = "",mark_valuation_1 = 0, mark_valuation_2 ="",mark_valuation_2 =0,third_val_not_req="",third_val_not_req=0)), +// AND( variance_in_mv1_and_mv2 > 10% , OR (mark_valuation_1 = "",mark_valuation_1 = 0, mark_valuation_2 ="",mark_valuation_2 =0,third_val_not_req="",third_val_not_req=0) ), // "Inputs Required", // IF( // OR( override="", override ="Average"), -// IF( variance_in_mv1_and_mv2 <= 10% ,( mark_valuation_1 + mark_valuation_2 )/2 , -// ( third_val_not_req + mark_valuation_2 + mark_valuation_1 - MAX(third_val_not_req , mark_valuation_2, mark_valuation_1))/2), +// IF( variance_in_mv1_and_mv2 <= 10% , +// ( mark_valuation_1 + mark_valuation_2 )/2 , +// ( third_val_not_req + mark_valuation_2 + mark_valuation_1 - MAX(third_val_not_req , mark_valuation_2, mark_valuation_1))/2), -// IF( override ="Lower",IF(variance_in_mv1_and_mv2 <= 10% , +// IF( override ="Lower", +// IF(variance_in_mv1_and_mv2 <= 10% , // MIN(mark_valuation_1, mark_valuation_2 ), // MIN(third_val_not_req ,mark_valuation_2,mark_valuation_1)), -// IF( override ="Higher",IF(variance_in_mv1_and_mv2 <= 10% , +// IF( override ="Higher" +// ,IF(variance_in_mv1_and_mv2 <= 10% , // MAX(mark_valuation_1,mark_valuation_2), // MAX(third_val_not_req ,mark_valuation_2,mark_valuation_1)))) // ) diff --git a/app/models/LoanDetail.js b/app/models/LoanDetail.js index e7426fe..79c0cae 100644 --- a/app/models/LoanDetail.js +++ b/app/models/LoanDetail.js @@ -6,7 +6,7 @@ module.exports = (sequelize, DataTypes) => { } LoanDetail.init( { - losid: { type: DataTypes.INTEGER }, + losid: { type: DataTypes.STRING }, // loan_no: { type: DataTypes.INTEGER }, product : { type: DataTypes.STRING }, date_of_login: { type: DataTypes.INTEGER }, diff --git a/app/routes/routes.js b/app/routes/routes.js index 611366c..5b3f163 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -67,26 +67,18 @@ router.get("/entityApplicantNameList", Entitycontroller.EntityApplicantNameList) router.get("/MainApplicantDetailsList", Entitycontroller.MainApplicantDetailsList); -// Loan Details List Api +// landingPageApi List Api /** * @swagger * /api/landingPageApi: * get: * summary: Loan Numbers Details List * description: Get loan Number Details List -* parameters: -* - in: query -* name: losid -* schema: -* type: string -* required: true -* description: id of the entity Details (primart key of entity) -* example: MW112233 * responses: * 200: * description: success */ -router.get("/landingPageApi", Entitycontroller.LoanNumberDetailsList); +router.get("/landingPageApi", Entitycontroller.landingPageApi); @@ -2332,6 +2324,28 @@ router.post("/updateOtherParameters", Entitycontroller.updateOtherParameters); router.get("/otherParametersList", Entitycontroller.OtherParametersList); +// LoanDeatilList List Api +/** +* @swagger +* /api/LoanDeatilList: +* get: +* summary: Loan Numbers Details List +* description: Get loan Number Details List +* parameters: +* - in: query +* name: losid +* schema: +* type: string +* required: true +* description: id of the loan detail Details (primart key of entity) +* example: MW112233 +* responses: +* 200: +* description: success +*/ +router.get("/LoanDeatilList", Entitycontroller.LoanDeatilList); + +