Merge branch 'master' of bitbucket.org:venbainformationtechnology/smc_cet_salespd_backend
This commit is contained in:
commit
3cace03da3
@ -1,28 +1,42 @@
|
||||
const { sequelize, GeneralSection , BreifOfBusiness , DetailsOfKeyShareHolder , FinalRemarks , FinancialInformation , FundRequirement , InstitutionDetail , OfficerDetails , Photograph , ProductInformation , PropertyInformation} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
const ApiCallHelper = require('../services/apicallhelper.js');
|
||||
|
||||
|
||||
|
||||
//GeneralSection data List Api
|
||||
exports.GeneralSectionList = async (req, res) =>
|
||||
exports.SectionList = async (req, res) =>
|
||||
{
|
||||
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)
|
||||
{
|
||||
if(data.length > 0)
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
}
|
||||
else {
|
||||
res.send({'status':404,'message':"failed",'data':"No data"});
|
||||
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)
|
||||
{
|
||||
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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data" ,'data': "No 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 data." ,'data': "No data" });
|
||||
|
||||
@ -31,9 +31,9 @@ module.exports = app => {
|
||||
//GeneralSection List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/GeneralSectionList:
|
||||
* /api/SectionList:
|
||||
* get:
|
||||
* summary: General Section Data List
|
||||
* summary: General Section Data List with app child section data's
|
||||
* description: Get General Section Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
@ -42,17 +42,11 @@ module.exports = app => {
|
||||
* type: string
|
||||
* required: true
|
||||
* example: MW112233
|
||||
* - in: query
|
||||
* name: main_loan_applicant
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* example: AKSHAR ENTERPRISE
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/GeneralSectionList", SalesPdController.GeneralSectionList);
|
||||
router.get("/SectionList", SalesPdController.SectionList);
|
||||
|
||||
//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