Compare commits

...

10 Commits

Author SHA1 Message Date
sriramv
9757731cb0 loanApiIntegration:GWM 2023-07-27 17:50:55 +05:30
sriramv
ccacbeb2bf loanApiIntegration:GWM 2023-07-27 17:44:35 +05:30
sriramv
389ebca32c loanApiIntegration:GWM 2023-07-27 17:41:05 +05:30
sriramv
948d014fba loanApiIntegration:GWM 2023-07-27 17:14:39 +05:30
sriramv
7a7d82ebbe loanApiIntegration:GWM 2023-07-27 17:12:51 +05:30
suseendhiran17
3eec72f88b susee:log 2023-07-19 18:06:38 +05:30
suseendhiran17
f86efad33e susee:log 2023-07-19 16:06:02 +05:30
sriramv
f46482e510 Apirename:GWM 2023-02-10 11:48:39 +05:30
sriramv
b7db3786d1 Apirename:GWM 2023-02-10 11:44:46 +05:30
sriramv
4f163e40d4 GWM 2022-08-06 10:45:05 +05:30
8 changed files with 649 additions and 40 deletions

View File

@ -4,25 +4,27 @@ const Helper = require('../services/cibil.controller.helper.js');
const DataInsertHelper = require('../services/cibil.datainsert.helper.js');
const { Op } = require('sequelize');
const moment = require('moment');
const fs = require('fs');
const path = require('path');
// landing page list of all pan number and reference number from commercial & consumer against losid
exports.LandingPageDetailsList =async (req, res) =>
{
try
{
// consumer = await sequelize.query("SELECT con_borrower_detail.ConsumerNameField1 as name,con_borrower_detail.MemberReferenceNumber as ReferenceNumber, con_id_detail.IDNumber as PanNumber FROM con_borrower_detail LEFT JOIN con_id_detail ON con_borrower_detail.MemberReferenceNumber = con_id_detail.MemberReferenceNumber and con_id_detail.IDType = 'Income Tax ID Number' where con_borrower_detail.losid = '"+req.query.losid+"'").catch(err=>{ });
// commercial = await sequelize.query("SELECT EnqInfoBorrowerName as name,ApplicationRefno as ReferenceNumber, EnqInfoPan as PanNumber FROM com_borrower_profile where losid = '"+req.query.losid+"'").catch(err=>{ });
// LandingPageData = {commercialData : commercial[0] , consumerData : consumer[0]}
LandingPageData = await InBorrowerDetail.findAll({where:{losid:req.query.losid}});
res.send({'status':200 , message:"Success." ,'data': LandingPageData});
// exports.LandingPageDetailsList =async (req, res) =>
// {
// try
// {
// // consumer = await sequelize.query("SELECT con_borrower_detail.ConsumerNameField1 as name,con_borrower_detail.MemberReferenceNumber as ReferenceNumber, con_id_detail.IDNumber as PanNumber FROM con_borrower_detail LEFT JOIN con_id_detail ON con_borrower_detail.MemberReferenceNumber = con_id_detail.MemberReferenceNumber and con_id_detail.IDType = 'Income Tax ID Number' where con_borrower_detail.losid = '"+req.query.losid+"'").catch(err=>{ });
// // commercial = await sequelize.query("SELECT EnqInfoBorrowerName as name,ApplicationRefno as ReferenceNumber, EnqInfoPan as PanNumber FROM com_borrower_profile where losid = '"+req.query.losid+"'").catch(err=>{ });
// // LandingPageData = {commercialData : commercial[0] , consumerData : consumer[0]}
// LandingPageData = await InBorrowerDetail.findAll({where:{losid:req.query.losid}});
// res.send({'status':200 , message:"Success." ,'data': LandingPageData});
} catch(err) {
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
}); } //end of try catch
// } catch(err) {
// res.status(500).send({'status':404,
// message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
// }); } //end of try catch
};
// };
@ -626,15 +628,17 @@ exports.LoansDetailsMergeUnmergeApi =async (req, res) =>
//unmerge loans
request_object.unmergeData.forEach(async(unmergeValue,unmergeIndex,unmergeArray) => {
let Unique_Group_string = Math.random().toString(36).slice(2, 10).toUpperCase();
await InCreditFacility.update({grp_str:Unique_Group_string},{where:{losid:request_object.losid,ReferenceNumber:unmergeValue.refno,grp_str:unmergeValue.grp_str}}).catch(err=>{});
await OutputActiveAndClosedLoans.update({grp_str:Unique_Group_string},{where:{losid:request_object.losid,ref_no:unmergeValue.refno,grp_str:unmergeValue.grp_str}}).catch(err=>{});
await InCreditFacility.update({grp_str:Unique_Group_string},{where:{losid:request_object.losid,ReferenceNumber:unmergeValue.refno,grp_str:unmergeValue.grp_str},limit : 1})
.catch(err=>{logMsg.info("");});
await OutputActiveAndClosedLoans.update({grp_str:Unique_Group_string},{where:{losid:request_object.losid,ref_no:unmergeValue.refno,grp_str:unmergeValue.grp_str},limit : 1})
.catch(err=>{logMsg.info("");});
console.log(unmergeValue.refno);
});
}else { logMsg.info("There is no any unmerge data selected for losid= "+request_object.losid); }
if(request_object.mergeData.length != 0)
{
//merge loans
//merge loans (3 types of merge 1.SINGLE_TO_GROUP 2.GROUP_TO_GROUP 3.SINGLE_TO_SINGLE)
request_object.mergeData.forEach(async(mergeValue,mergeIndex,mergeArray) => {
if(mergeValue.type == 'SINGLE_TO_GROUP')
{
@ -724,21 +728,38 @@ else{
exports.starter = async (req, res) =>
exports.LandingPageDetailsList = async (req, res) =>
{
try
{
ResData = await Helper.loanDetailsDataApiCall(req.query.losid);
PanList = [];
if (ResData.status == "Successful" && ResData.lstLoanApplication.length != 0)
{
ResData.lstApplicantKYCDetail.forEach(async(value,index,array) => {
if (value.kycType.trim() == "Non-Individual")
{
lstEntityKYCDetailObj = { losid:req.query.losid, PAN : value.panNo,entity_type : value.kycType.trim() }
await PanList.push(lstEntityKYCDetailObj);
} else if (value.kycType.trim() == "Individual")
{
lstApplicantKYCDetailObj = { losid:req.query.losid, PAN : value.panNo,entity_type : value.kycType.trim(),}
await PanList.push(lstApplicantKYCDetailObj);
}
});
} // end of if lstLoanApplication
PanList = await Helper.panListApiCall(req.query.losid);
if(PanList.length != 0)
{
console.log(PanList);
var CibilDataInsert = new Promise(async(resolve, reject) => {
PanList.forEach(async(PanListValue,PanListIndex,PanListArray) => {
//define cibil type based on entity type
if(PanListValue.entity_type == "Individual"){ CibilType = 1; }else{CibilType = 2;}
Object.assign(PanListValue, {cibil_type:CibilType})
if(PanListValue.entity_type == "Individual"){ CibilType = 1; }else if(PanListValue.entity_type == "Non-Individual"){CibilType = 2;}
await Object.assign(PanListValue, {cibil_type:CibilType})
BorrowerDetailData = await InBorrowerDetail.findOne({where:{losid:PanListValue.losid , PAN:PanListValue.PAN ,cibil_type:CibilType}});
if(BorrowerDetailData)
@ -751,6 +772,7 @@ exports.starter = async (req, res) =>
{
//create Intermediate table borrower details (only losid,pan,cibil_type,entity_type)
await InBorrowerDetail.create(PanListValue).then(async(PanListData)=>{
console.log(PanListData);
//call cibil data api and insert cibil data in to input tables
if(PanListData.cibil_type == 1)
{
@ -809,13 +831,11 @@ exports.starter = async (req, res) =>
}
else
{
res.send({'status':404 , message:"Failed." ,'data':"No data"});
res.send({'status':404 , message:"Failed." ,'data':"Applicant Details not found from MainApp"});
}
} catch(err) {
res.status(500).send({'status':404,
res.send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
});
} //end of try catch
@ -824,6 +844,120 @@ exports.starter = async (req, res) =>
exports.readLogFileName = async (req , res) =>
{
try
{
folderName = req;
const logFilePath = 'storage/log';
const fileNames = fs.readdirSync(logFilePath);
// Remove the first element (0th index)
const [, ...data] = fileNames;
return data;
}
catch(err)
{
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
});
} //end of try catch
};
exports.readLogFile = async (req , res) =>
{
try
{
folderName = req.body.folder;
fileName = req.body.file;
const logFilePath = 'storage/log/'+fileName;
fs.readFile(logFilePath, 'utf8', (err, data) => {
if (err) {
console.error(err);
res.status(500).send({'status':404,'message': err.message || "Error reading log file." ,'data': "No data"});
}
res.send({'status':200 , message:"Success." ,'data': data});
});
}
catch(err)
{
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
});
} //end of try catch
};
exports.viewLandingPage = async (req , res) =>
{
try
{
moduleName = [ { "module":"CIBIL","folder":"smc_cet_cibil_backend"} ];
img = []
for(const [index,val] of moduleName.entries())
{
fileName = await this.readLogFileName(val.folder);
for (let i = 0; i < fileName.length; i++)
{
filePath = 'storage/log/'+fileName[i];
const logData = fs.readFileSync(filePath);
// Convert the file content to Base64
const base64Data = logData.toString('base64');
// Create Base64 URL from Base64 data
const base64Url = `data:application/octet-stream;base64,${encodeURIComponent(base64Data)}`;
img.push(base64Url)
}
moduleName[index] = await Object.assign(val,{'file':fileName , 'img':img});
};
res.render( 'module' , { 'data' : moduleName } ,function (err, html ) {
res.send(html)
})
}
catch(err)
{
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
});
} //end of try catch
};
exports.deleteLogFile = async (req , res) =>
{
try
{
folderName = req.body.folder;
fileName = req.body.file;
// folderName = 'smc_cet_creditpd_backend';
// fileName = 'msg.log.2023-07-10';
const logFilePath = 'storage/log/'+fileName;
fs.unlink(logFilePath, (err) => {
if (err) {
console.error(`Error deleting file: ${err}`);
return;
}
console.log('File deleted successfully.');
res.send({'status':200 , message:"Success." ,'data': 'No data'});
});
}
catch(err)
{
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
});
} //end of try catch
};

View File

@ -415,6 +415,14 @@ router.get("/ConsolidatedActiveAndClosedLoansReviewAction", Cibilcontroller.Cons
router.post("/LoansDetailsMergeUnmergeApi", Cibilcontroller.LoansDetailsMergeUnmergeApi);
router.get("/getfilename", Cibilcontroller.readLogFileName);
router.post("/readlogs", Cibilcontroller.readLogFile);
router.get("/view", Cibilcontroller.viewLandingPage);
router.post("/deletelog", Cibilcontroller.deleteLogFile);
// routes started here
app.use('/api', router);
};

View File

@ -11,7 +11,8 @@ function createSkeleton(statement_end_date)
{
end_date = "'"+statement_end_date+"'";
let date = new Date(end_date);
date.setDate(01);
let day = '01';
date.setDate(parseInt(day));
years_skeleton = [];
for(let i=0;i<36;i++)
@ -97,6 +98,37 @@ try {
}
}
async function loanDetailsDataApiCall(losid) {
try {
LOAN_URL = process.env.LOS_DATA_URL;
token = await getLoginToken();
request_object = {
"losid": losid
};
return new Promise((resolve, reject) => {
request({
url: LOAN_URL,
method: "POST",
headers: { Authorization: 'Bearer ' + token },
json: true,
body: request_object
}, function (error, response, body){
// let data = JSON.parse(response); console.log(response);
// if(data.status == 'Successful')
// {
// resolve(data);
// }
resolve(body);
});
});
}
catch (error) {
console.log(error);
}
}
async function cibilOutputGenerateApiCall(losid,ref_no,cibil_type,ActionDataArray,output_type) {
try {
@ -205,6 +237,7 @@ module.exports = {
cibilOutputGenerateApiCall : cibilOutputGenerateApiCall,
panListApiCall : panListApiCall ,
getLoginToken : getLoginToken,
convertDateFormat : convertDateFormat
convertDateFormat : convertDateFormat,
loanDetailsDataApiCall:loanDetailsDataApiCall
}

View File

@ -1243,7 +1243,7 @@ async function commercialIntermediateDataInsert(losid,refNo)
{
BorrowerProfileData = await BorrowerProfile.findAll({attributes: ['losid','ApplicationRefno','EnqInfoBorrowerName','EnqInfoPan'],raw:true ,where:{losid:losid,ApplicationRefno:refNo}});
BorrowerProfileData = await BorrowerProfile.findAll({attributes: ['ReportHeaderReportOrderDate','losid','ApplicationRefno','EnqInfoBorrowerName','EnqInfoPan'],raw:true ,where:{losid:losid,ApplicationRefno:refNo}});
BorrowerProfileData.forEach(async(value,index,array) => {
BorrowerProfileDataObj = {
@ -1262,9 +1262,8 @@ async function commercialIntermediateDataInsert(losid,refNo)
//month bucket count skeleton creation
//DateTimeProcessed = BorrowerProfileData[0].CPSInsLtstCFOpndDate;
end_date = '2022-05-05'
sk = await Helper.createSkeleton(end_date);
DateTimeProcessed = BorrowerProfileData[0].ReportHeaderReportOrderDate;
sk = await Helper.createSkeleton(DateTimeProcessed);

346
app/views/module.ejs Normal file
View File

@ -0,0 +1,346 @@
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style>
body {
background: #f3f3f3;
padding: 30px 20px;
}
/* Dashboard Cards */
.dashboard-cards {
position: relative;
padding-bottom: 50px;
margin: 0 !important;
}
.dashboard-cards .card {
background: #ffffff;
display: inline-block;
-webkit-perspective: 1000;
perspective: 1000;
z-index: 20;
padding: 0 !important;
margin: 5px 5px 10px 5px;
position: relative;
text-align: left;
-webkit-transition: all 0.3s 0s ease-in;
transition: all 0.3s 0s ease-in;
z-index: 1;
/* width: calc(33.33333333% - 10px); */
cursor: pointer;
transition: all 0.3s ease;
}
.dashboard-cards .card:hover {
box-shadow: 0 15px 10px -10px rgba(31, 31, 31, 0.5);
transition: all 0.3s ease;
}
.dashboard-cards .card .card-title {
background: #ffffff;
padding: 20px 15px;
position: relative;
z-index: 0;
}
.dashboard-cards .card .card-title h2 {
font-size: 24px;
letter-spacing: -0.05em;
margin: 0;
padding: 0;
}
.dashboard-cards .card .card-title h2 small {
display: block;
font-size: 14px;
margin-top: 8px;
letter-spacing: -0.025em;
}
.dashboard-cards .card .card-description {
position: relative;
font-size: 14px;
border-top: 1px solid #ddd;
padding: 10px 15px 0 15px;
}
.dashboard-cards .card .card-actions {
box-shadow: 0 2px 0px 0 rgba(0, 0, 0, 0.075);
padding: 10px;
text-align: center;
}
.dashboard-cards .card .card-flap {
background: #d9d9d9;
position: absolute;
width: 100%;
-webkit-transform-origin: top;
transform-origin: top;
/* -webkit-transform: rotateX(-90deg);
transform: rotateX(-90deg); */
}
.dashboard-cards .card .flap1 {
-webkit-transition: all 0.3s 0.3s ease-out;
transition: all 0.3s 0.3s ease-out;
z-index: -1;
}
.dashboard-cards .card .flap2 {
-webkit-transition: all 0.3s 0s ease-out;
transition: all 0.3s 0s ease-out;
z-index: -2;
}
.dashboard-cards.showing .card {
cursor: pointer;
opacity: 0.6;
-webkit-transform: scale(0.88);
transform: scale(0.88);
}
.dashboard-cards .no-touch .dashboard-cards.showing .card:hover {
opacity: 0.94;
-webkit-transform: scale(0.92);
transform: scale(0.92);
}
.dashboard-cards .card.d-card-show {
opacity: 1 !important;
-webkit-transform: scale(1) !important;
transform: scale(1) !important;
}
.dashboard-cards .card.d-card-show .card-flap {
background: #ffffff;
-webkit-transform: rotateX(0deg);
transform: rotateX(0deg);
}
.dashboard-cards .card.d-card-show .flap1 {
-webkit-transition: all 0.3s 0s ease-out;
transition: all 0.3s 0s ease-out;
}
.dashboard-cards .card.d-card-show .flap2 {
-webkit-transition: all 0.3s 0.2s ease-out;
transition: all 0.3s 0.2s ease-out;
}
.dashboard-cards .card .task-count {
width: 40px;
height: 40px;
position: absolute;
top: 14px;
right: 10px;
background: #ecf0f1;
text-align: center;
line-height: 40px;
border-radius: 100%;
color: #333333;
font-weight: 600;
transition: all .2s ease;
}
/* Task List */
.dashboard-cards .task-list {
padding: 0 !important;
}
.dashboard-cards .task-list li {
padding: 10px 0;
padding-left: 10px;
margin: 3px 0;
list-style-type: none;
border-bottom: 1px solid #e9ebed;
border-left: 3px solid #f36525;
transition: all .2s ease;
}
.dashboard-cards .task-list li:hover {
background: #ecf0f1;
transition: all .2s ease;
}
.dashboard-cards .task-list li span {
float: right;
color: #f36525;
margin-right: 5px;
}
.dashboard-cards.showing .card.d-card-show .task-count {
color: #ffffff;
background: #f36525;
transition: all .2s ease;
}
.dashboard-cards .card-actions .btn {
color: #333;
}
.dashboard-cards .card-actions .btn:hover {
color: #f36525;
}
.fileName{
display: inline-block;
}
.delete,.download{
float: right;
margin-top: 5px;
margin-right: 1rem;
}
.download{
font-size: 25px;
margin-top: 10px;
}
</style>
<body>
<div class='row dashboard-cards'>
<% for (let i = 0; i < data.length; i++) { %>
<div class='card col-md-2'></div>
<div class='card col-md-8'>
<div class='card-title'>
<h2>
LOGS
<!-- <small>You have 14 pending tasks</small> -->
</h2>
<div class='task-count'>
<%= data[i].file.length %>
</div>
</div>
<div class='card-flap flap1'>
<% for (let j = 0; j < data[i].file.length; j++) { %>
<div class='card-description'>
<ul class='task-list'>
<li id="<%= data[i].file[j]+'|'+data[i].folder %>" class="fileName">
<%= data[i].file[j] %>
</li>
<button type="button" id="<%= data[i].file[j]+'|'+data[i].folder %>" class="btn btn-danger delete">Delete</button>
<a onclick="downloadImage('<%= data[i].img[j] %>' , '<%= data[i].file[j] %>')"><i class="fa fa-download download"></i></a>
</ul>
</div>
<% } %>
<div class='card-flap flap2'>
<div class='card-actions'>
<a class='btn' href='#'>Close</a>
</div>
</div>
</div>
</div>
<div class='card col-md-2'></div>
<% } %>
</div>
<!-- Modal btn -->
<button type="button" style="display: none;" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Large Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body" style="white-space: pre-wrap;">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
<script>
$(document).ready(function () {
var zindex = 10;
$("div.card").click(function (e) {
e.preventDefault();
var isShowing = false;
if ($(this).hasClass("d-card-show")) {
isShowing = true;
}
if ($("div.dashboard-cards").hasClass("showing")) {
// a card is already in view
$("div.card.d-card-show").removeClass("d-card-show");
if (isShowing) {
// this card was showing - reset the grid
$("div.dashboard-cards").removeClass("showing");
} else {
// this card isn't showing - get in with it
$(this).css({ zIndex: zindex }).addClass("d-card-show");
}
zindex++;
} else {
// no dashboard-cards in view
$("div.dashboard-cards").addClass("showing");
$(this).css({ zIndex: zindex }).addClass("d-card-show");
zindex++;
}
});
});
$(".fileName").click(function(){
data = $(this).attr('id').split("|");
var getUrl = window.location;
path_name = getUrl.pathname.slice(0,-4)+'readlogs';
$.ajax({
type: "post",
url: path_name,
data: {'file' : data[0] , 'folder' : data[1]},
success: function(response) {
$('.modal-title').html(data[0]);
$('.modal-body').html(response.data);
$('#myModal').modal('show');
},
error: function(jqXHR, textStatus, err) {
alert('text status '+textStatus+', err '+err)
}
});
});
$(".delete").click(function(){
data = $(this).attr('id').split("|");
var getUrl = window.location;
path_name = getUrl.pathname.slice(0,-4)+'deletelog';
alert(path_name)
$.ajax({
type: "post",
url: path_name,
data: {'file' : data[0] , 'folder' : data[1]},
success: function(response) {
console.log(response);
location.reload();
},
error: function(jqXHR, textStatus, err) {
alert('text status '+textStatus+', err '+err)
}
});
});
function downloadImage(data,fileName)
{
const base64Image = data; // Replace this with your actual Base64 image data
const downloadLink = document.createElement('a');
downloadLink.href = base64Image;
downloadLink.download = fileName; // Replace with the desired file name and extension
downloadLink.click();
}
</script>
</html>

88
package-lock.json generated
View File

@ -674,7 +674,6 @@
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
@ -1001,7 +1000,6 @@
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
@ -1010,14 +1008,12 @@
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
@ -1114,7 +1110,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
@ -1356,6 +1351,14 @@
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"ejs": {
"version": "3.1.9",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz",
"integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==",
"requires": {
"jake": "^10.8.5"
}
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@ -1488,6 +1491,32 @@
"moment": "^2.29.1"
}
},
"filelist": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
"requires": {
"minimatch": "^5.0.1"
},
"dependencies": {
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"requires": {
"balanced-match": "^1.0.0"
}
},
"minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"requires": {
"brace-expansion": "^2.0.1"
}
}
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@ -1556,6 +1585,11 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
},
"fs-constants": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
@ -2026,6 +2060,24 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"jake": {
"version": "10.8.7",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz",
"integrity": "sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==",
"requires": {
"async": "^3.2.3",
"chalk": "^4.0.2",
"filelist": "^1.0.4",
"minimatch": "^3.1.2"
},
"dependencies": {
"async": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
}
}
},
"js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
@ -2643,6 +2695,15 @@
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"path": {
"version": "0.12.7",
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
"integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
"requires": {
"process": "^0.11.1",
"util": "^0.10.3"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@ -3475,6 +3536,21 @@
"prepend-http": "^2.0.0"
}
},
"util": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
"requires": {
"inherits": "2.0.3"
},
"dependencies": {
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
}
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View File

@ -13,10 +13,13 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"ejs": "^3.1.9",
"express": "^4.17.1",
"fs": "0.0.1-security",
"log4js": "^6.3.0",
"moment": "^2.29.4",
"mssql": "^7.2.0",
"path": "^0.12.7",
"request": "^2.88.2",
"sequelize": "^6.6.5",
"swagger-jsdoc": "^6.1.0",

View File

@ -1,6 +1,13 @@
require('dotenv').config();
const express = require('express')
const app = express()
const app = express();
const path = require('path');
// Enable CORS for all routes
const cors = require('cors');
app.use(cors());
//it is used to clear cache
app.use(function(req, res, next) {
res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
@ -10,6 +17,9 @@ app.use(function(req, res, next) {
})
const {logMsg} = require('./app/services/logger.js');
app.set('views', path.join(__dirname, 'app\\views'));
app.set('view engine', 'ejs');
const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');