gwm
This commit is contained in:
parent
13d1650482
commit
6c97e9f375
@ -1,14 +1,22 @@
|
|||||||
const { sequelize, GeneralSection , BreifOfBusiness , DetailsOfKeyShareHolder , FinalRemarks , FinancialInformation , FundRequirement , InstitutionDetail , OfficerDetails , Photograph , ProductInformation , PropertyInformation} = require('../models')
|
const { sequelize, GeneralSection , BreifOfBusiness , DetailsOfKeyShareHolder , FinalRemarks , FinancialInformation , FundRequirement , InstitutionDetail , OfficerDetails , Photograph , ProductInformation , PropertyInformation} = require('../models')
|
||||||
const { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
const ApiCallHelper = require('../services/apicallhelper.js');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//GeneralSection data List Api
|
//GeneralSection data List Api
|
||||||
exports.GeneralSectionList = async (req, res) =>
|
exports.SectionList = async (req, res) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GeneralSection.findAll({raw: true , where:{losid:req.query.losid,main_loan_applicant:req.query.main_loan_applicant,is_active : 1}}).then(data =>
|
applicantDetails = await ApiCallHelper.MainApplicantDetails(req.query.losid);
|
||||||
|
MainApplicantDetails = JSON.parse(applicantDetails);
|
||||||
|
|
||||||
|
if(MainApplicantDetails.status == 200)
|
||||||
|
{
|
||||||
|
GeneralSection.findAll({ where:{losid:req.query.losid,main_loan_applicant:MainApplicantDetails.data.name,is_active : 1},
|
||||||
|
include: [ {model: FundRequirement }, {model: DetailsOfKeyShareHolder }, {model: DetailsOfKeyShareHolder }, {model: BreifOfBusiness }, {model: FinancialInformation }, {model: PropertyInformation }, {model: FinalRemarks }, {model: OfficerDetails }, {model: Photograph }, {model: InstitutionDetail }, {model: ProductInformation }] })
|
||||||
|
.then(data =>
|
||||||
{
|
{
|
||||||
if(data.length > 0)
|
if(data.length > 0)
|
||||||
{
|
{
|
||||||
@ -20,10 +28,16 @@ exports.GeneralSectionList = async (req, res) =>
|
|||||||
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.send({'status':404,
|
res.send({'status':404,message: err.message || "Some error occurred while retrieving data" ,'data': "No data" });
|
||||||
message: err.message || "Some error occurred while retrieving data" ,'data': "No data" });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res.send({'status':404,'message':"failed",'data':"No data"});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||||
} //end of try catch
|
} //end of try catch
|
||||||
|
|||||||
@ -31,9 +31,9 @@ module.exports = app => {
|
|||||||
//GeneralSection List Api
|
//GeneralSection List Api
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /api/GeneralSectionList:
|
* /api/SectionList:
|
||||||
* get:
|
* get:
|
||||||
* summary: General Section Data List
|
* summary: General Section Data List with app child section data's
|
||||||
* description: Get General Section Data List
|
* description: Get General Section Data List
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: query
|
* - in: query
|
||||||
@ -42,17 +42,11 @@ module.exports = app => {
|
|||||||
* type: string
|
* type: string
|
||||||
* required: true
|
* required: true
|
||||||
* example: MW112233
|
* example: MW112233
|
||||||
* - in: query
|
|
||||||
* name: main_loan_applicant
|
|
||||||
* schema:
|
|
||||||
* type: string
|
|
||||||
* required: true
|
|
||||||
* example: AKSHAR ENTERPRISE
|
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: success
|
* description: success
|
||||||
*/
|
*/
|
||||||
router.get("/GeneralSectionList", SalesPdController.GeneralSectionList);
|
router.get("/SectionList", SalesPdController.SectionList);
|
||||||
|
|
||||||
//BreifOfBusiness List Api
|
//BreifOfBusiness List Api
|
||||||
/**
|
/**
|
||||||
|
|||||||
32
app/services/apicallhelper.js
Normal file
32
app/services/apicallhelper.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
const request = require('request');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function MainApplicantDetails(losid) {
|
||||||
|
try {
|
||||||
|
const url = "https://demo.devopsmcfinance.com/cet_mainapp/api/MainApplicantDetailsList?losid="+losid;
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request({
|
||||||
|
url: url,
|
||||||
|
method: "GET"
|
||||||
|
|
||||||
|
}, function (error, response, body) {
|
||||||
|
resolve(body);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
MainApplicantDetails: MainApplicantDetails
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user