lisiApis:gwm
This commit is contained in:
parent
e941885c38
commit
13d1650482
301
app/controllers/salespd.controller.js
Normal file
301
app/controllers/salespd.controller.js
Normal file
@ -0,0 +1,301 @@
|
||||
const { sequelize, GeneralSection , BreifOfBusiness , DetailsOfKeyShareHolder , FinalRemarks , FinancialInformation , FundRequirement , InstitutionDetail , OfficerDetails , Photograph , ProductInformation , PropertyInformation} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
|
||||
|
||||
|
||||
//GeneralSection data List Api
|
||||
exports.GeneralSectionList = 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 =>
|
||||
{
|
||||
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" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//BreifOfBusiness data List Api
|
||||
exports.BreifOfBusinessList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
BreifOfBusiness.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//DetailsOfKeyShareHolder data List Api
|
||||
exports.DetailsOfKeyShareHolderList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
DetailsOfKeyShareHolder.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//FinalRemarks data List Api
|
||||
exports.FinalRemarksList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
FinalRemarks.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//FinancialInformation data List Api
|
||||
exports.FinancialInformationList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
FinancialInformation.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//FundRequirement data List Api
|
||||
exports.FundRequirementList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
FundRequirement.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//InstitutionDetail data List Api
|
||||
exports.InstitutionDetailList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
InstitutionDetail.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//OfficerDetails data List Api
|
||||
exports.OfficerDetailsList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
OfficerDetails.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//Photograph data List Api
|
||||
exports.PhotographList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Photograph.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//ProductInformation data List Api
|
||||
exports.ProductInformationList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
ProductInformation.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
//PropertyInformation data List Api
|
||||
exports.PropertyInformationList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
PropertyInformation.findAll({raw: true , where:{pd_id:req.query.pd_id,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 data" ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
const { sequelize, GeneralSection ,FundRequirement , DetailsOfKeyShareHolder , BreifOfBusiness , FinancialInformation , PropertyInformationn , FinalRemarks , OfficerDetails , Photograph , InstitutionDetail , ProductInformation} = require('../models');
|
||||
//const { sequelize, GeneralSection ,FundRequirement , DetailsOfKeyShareHolder , BreifOfBusiness , FinancialInformation , PropertyInformationn , FinalRemarks , OfficerDetails , Photograph , InstitutionDetail , ProductInformation} = require('../models');
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class GeneralSection extends Model {
|
||||
|
||||
@ -12,6 +12,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
autoIncrement : true,
|
||||
primaryKey: true
|
||||
},
|
||||
losid: { type: DataTypes.STRING },
|
||||
application_id: { type: DataTypes.STRING },
|
||||
main_loan_applicant: { type: DataTypes.STRING },
|
||||
company_name: { type: DataTypes.STRING },
|
||||
@ -58,7 +59,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
GeneralSection.hasMany(models.PropertyInformationn, {
|
||||
GeneralSection.hasMany(models.PropertyInformation, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class PropertyInformationn extends Model {
|
||||
class PropertyInformation extends Model {
|
||||
|
||||
}
|
||||
PropertyInformationn.init(
|
||||
PropertyInformation.init(
|
||||
{
|
||||
pd_id: { type: DataTypes.INTEGER },
|
||||
property_address: { type: DataTypes.STRING },
|
||||
@ -23,9 +23,9 @@ module.exports = (sequelize, DataTypes) => {
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'sales_property_information',
|
||||
modelName: 'PropertyInformationn',
|
||||
modelName: 'PropertyInformation',
|
||||
}
|
||||
)
|
||||
|
||||
return PropertyInformationn
|
||||
return PropertyInformation
|
||||
}
|
||||
@ -2,6 +2,7 @@ module.exports = app => {
|
||||
const request = require("request");
|
||||
const cors=require('cors');
|
||||
const Mycontroller = require("../controllers/test.controller.js");
|
||||
const SalesPdController = require("../controllers/salespd.controller.js");
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
var router = require("express").Router();
|
||||
|
||||
@ -25,6 +26,241 @@ module.exports = app => {
|
||||
router.get('/salespd',Mycontroller.SalesPd)
|
||||
|
||||
|
||||
|
||||
|
||||
//GeneralSection List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/GeneralSectionList:
|
||||
* get:
|
||||
* summary: General Section Data List
|
||||
* description: Get General Section Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: losid
|
||||
* schema:
|
||||
* 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);
|
||||
|
||||
//BreifOfBusiness List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/BreifOfBusinessList:
|
||||
* get:
|
||||
* summary: BreifOfBusiness Data List
|
||||
* description: Get BreifOfBusiness Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/BreifOfBusinessList", SalesPdController.BreifOfBusinessList);
|
||||
|
||||
//DetailsOfKeyShareHolder List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/DetailsOfKeyShareHolderList:
|
||||
* get:
|
||||
* summary: DetailsOfKeyShareHolder Data List
|
||||
* description: Get DetailsOfKeyShareHolder Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/DetailsOfKeyShareHolderList", SalesPdController.DetailsOfKeyShareHolderList);
|
||||
|
||||
//FinalRemarks List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/FinalRemarksList:
|
||||
* get:
|
||||
* summary: FinalRemarks Data List
|
||||
* description: Get FinalRemarks Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/FinalRemarksList", SalesPdController.FinalRemarksList);
|
||||
|
||||
//FinancialInformation List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/FinancialInformationList:
|
||||
* get:
|
||||
* summary: FinancialInformation Data List
|
||||
* description: Get FinancialInformation Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/FinancialInformationList", SalesPdController.FinancialInformationList);
|
||||
|
||||
//FundRequirement List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/FundRequirementList:
|
||||
* get:
|
||||
* summary: FundRequirement Data List
|
||||
* description: Get FundRequirement Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/FundRequirementList", SalesPdController.FundRequirementList);
|
||||
|
||||
//InstitutionDetail List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/InstitutionDetailList:
|
||||
* get:
|
||||
* summary: InstitutionDetail Data List
|
||||
* description: Get InstitutionDetail Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/InstitutionDetailList", SalesPdController.InstitutionDetailList);
|
||||
|
||||
//OfficerDetails List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/OfficerDetailsList:
|
||||
* get:
|
||||
* summary: OfficerDetails Data List
|
||||
* description: Get OfficerDetails Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/OfficerDetailsList", SalesPdController.OfficerDetailsList);
|
||||
|
||||
//Photograph List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/PhotographList:
|
||||
* get:
|
||||
* summary: Photograph Data List
|
||||
* description: Get Photograph Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/PhotographList", SalesPdController.PhotographList);
|
||||
|
||||
//ProductInformation List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/ProductInformationList:
|
||||
* get:
|
||||
* summary: ProductInformation Data List
|
||||
* description: Get ProductInformation Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/ProductInformationList", SalesPdController.ProductInformationList);
|
||||
|
||||
//PropertyInformation List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/PropertyInformationList:
|
||||
* get:
|
||||
* summary: PropertyInformation Data List
|
||||
* description: Get PropertyInformation Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: pd_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 36
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/PropertyInformationList", SalesPdController.PropertyInformationList);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// routes started here
|
||||
app.use('/api', router);
|
||||
};
|
||||
|
||||
5010
package-lock.json
generated
5010
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@ const options = {
|
||||
definition: {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: 'Smc_cet_financials',
|
||||
title: 'Smc_cet_salesPd',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
@ -56,7 +56,7 @@ require("./app/routes/routes.js")(app);
|
||||
|
||||
const PORT_NUMBER = process.env.SERVER_PORT
|
||||
app.listen({ port: PORT_NUMBER }, async () => {
|
||||
console.log('Server up on http://localhost:8080')
|
||||
console.log('Server up on http://localhost:'+PORT_NUMBER)
|
||||
|
||||
//await sequelize.authenticate()
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user