This commit is contained in:
suseendhiran17 2022-06-22 12:02:37 +05:30
parent 4c46bac572
commit ece5bf1fb1
6 changed files with 5219 additions and 22 deletions

View File

@ -762,7 +762,7 @@ exports.MainApplicantDetailsList = async (req, res) =>
};
//New
//create Property & LTV Details Api
exports.createPropertyAndLtv = async (req, res) =>
@ -845,6 +845,59 @@ exports.PropertyAndLtvList = async (req, res) =>
//create LoanDetail Api
exports.createLoanDetail = async (req, res) =>
{
try
{
LoanDetail.create(req.body).then(data =>
{
res.send({'status':200,'message':"success",'data':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
};
//update LoanDetail Api
exports.updateLoanDetail = async (req, res) =>
{
try
{
id = req.body.id;
updatedby = req.body.updatedby;
delete req.body.id;
delete req.body.updatedby;
// update old value is_active = 0 where requested id
await LoanDetail.update({ updatedby : updatedby ,is_active : 0 },{ where: { id: id }});
// create new entry
LoanDetail.create(req.body).then(data =>
{
res.send({'status':200,'message':"success",'data':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
}

View File

@ -46,3 +46,24 @@ exports.createModel = async (req, res) =>
};
exports.excel = async ( req , res ) => {
// Requiring the module
const reader = require('xlsx')
// Reading our test file
const file = reader.readFile('./Commercial_CIBIL_Raw_Data 1.xlsx')
let data = []
const sheets = file.SheetNames[0]
console.log(sheets);
for(let i = 0; i < sheets.length; i++)
{
const temp = reader.utils.sheet_to_json(
file.Sheets[file.SheetNames[0]])
temp.forEach((res) => {
data.push(res)
})
}
res.send(data[0].ApplicationRefno)
}

View File

@ -7,7 +7,7 @@ module.exports = (sequelize, DataTypes) => {
LoanDetail.init(
{
losid: { type: DataTypes.INTEGER },
loan_no: { type: DataTypes.INTEGER },
// loan_no: { type: DataTypes.INTEGER },
product : { type: DataTypes.STRING },
date_of_login: { type: DataTypes.INTEGER },
sourcing_channel_type: { type: DataTypes.INTEGER },

View File

@ -20,7 +20,7 @@ module.exports = app => {
*/
router.get("/demo", Testcontroller.Welcome);
// router.get("/createModel", Testcontroller.createModel);
// router.get("/excel", Testcontroller.excel);
// entity_applicant_name list for banking module
/**
@ -1679,7 +1679,7 @@ router.post("/CreateCheckTypeMaster", Mastercontroller.CreateCheckTypeMaster);
*/
router.post("/CreateRelationMaster", Mastercontroller.CreateRelationMaster); // line 31
//New
// create Property & LTV Details
/**
@ -2003,6 +2003,232 @@ router.get("/PropertyAndLtvList", Entitycontroller.PropertyAndLtvList);
// create LoanDetail
/**
* @swagger
* definitions:
* createLoanDetail:
* type: object
* properties:
* losid:
* type: string
* description:
* example: MW112233
* product:
* type: string
* description:
* example: LFMP
* date_of_login:
* type: integer
* description:
* example: 2021/05/05
* sourcing_channel_type:
* type: integer
* description:
* example: Connector
* sourcing_channel_name:
* type: integer
* description:
* example: Test Name
* proposal:
* type: integer
* description:
* example: Fresh
* sanction_date_of_earlier_exposure:
* type: integer
* description:
* example:
* current_outstnd_bal_of_earlier_exposure:
* type: integer
* description:
* example:
* emi_of_earlier_exposure:
* type: integer
* description:
* example:
* additional_loan_amnt_applied_for:
* type: integer
* description:
* example: 5000000
* insurance_premium_amnt_being_funded:
* type: integer
* description:
* example: 500000
* insurance_premium_loan_applied_for:
* type: integer
* description:
* example: 1
* additional_loan_amnt_applied_for_and_insu_premium:
* type: integer
* description:
* example: 5500000
* load_tenure_applied_for_months:
* type: integer
* description:
* example: 30
* rate_of_interest_per_annum:
* type: integer
* description:
* example: 1
* emi_per_lac_of_loan:
* type: integer
* description:
* example:
* purpose_of_loan:
* type: integer
* description:
* example:
* emi_of_loan_applied_for:
* type: integer
* description:
* example:
* createdby:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
* is_active:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/createLoanDetail:
* post:
* summary: create LoanDetail
* description: create LoanDetail details
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/createLoanDetail'
* responses:
* 200:
* description: New LoanDetail inserted
* 500:
* description: failure in inserting LoanDetail
*/
router.post("/createLoanDetail", Entitycontroller.createLoanDetail);
// update Property & LTV Details
/**
* @swagger
* definitions:
* updateLoanDetail:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 2
* losid:
* type: string
* description:
* example: MW112233
* product:
* type: string
* description:
* example: LFMP
* date_of_login:
* type: integer
* description:
* example: 2021/05/05
* sourcing_channel_type:
* type: integer
* description:
* example: Connector
* sourcing_channel_name:
* type: integer
* description:
* example: Test Name
* proposal:
* type: integer
* description:
* example: Fresh
* sanction_date_of_earlier_exposure:
* type: integer
* description:
* example:
* current_outstnd_bal_of_earlier_exposure:
* type: integer
* description:
* example:
* emi_of_earlier_exposure:
* type: integer
* description:
* example:
* additional_loan_amnt_applied_for:
* type: integer
* description:
* example: 5000000
* insurance_premium_amnt_being_funded:
* type: integer
* description:
* example: 500000
* insurance_premium_loan_applied_for:
* type: integer
* description:
* example: 1
* additional_loan_amnt_applied_for_and_insu_premium:
* type: integer
* description:
* example: 5500000
* load_tenure_applied_for_months:
* type: integer
* description:
* example: 30
* rate_of_interest_per_annum:
* type: integer
* description:
* example: 1
* emi_per_lac_of_loan:
* type: integer
* description:
* example:
* purpose_of_loan:
* type: integer
* description:
* example:
* emi_of_loan_applied_for:
* type: integer
* description:
* example:
* createdby:
* type: integer
* description:
* example: 1
* updatedby:
* type: integer
* description:
* example: 1
* is_active:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateLoanDetail:
* post:
* summary: update LoanDetail
* description: update LoanDetail
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateLoanDetail'
* responses:
* 200:
* description: New LoanDetail inserted
* 500:
* description: failure in inserting LoanDetail
*/
router.post("/updateLoanDetail", Entitycontroller.updateLoanDetail);
// routes started here
app.use('/api', router);
};

4930
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,8 @@
"swagger-jsdoc": "^6.1.0",
"swagger-ui-express": "^4.1.6",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.5"
"winston-daily-rotate-file": "^4.5.5",
"xlsx": "^0.18.5"
},
"devDependencies": {
"nodemon": "^2.0.12"