Compare commits
No commits in common. "58c358cfb1b16b5a22e4f6ca316685cb654fab9d" and "14b396e387aed983d92afc68be658bb488a058fe" have entirely different histories.
58c358cfb1
...
14b396e387
@ -1,9 +1,6 @@
|
||||
const { sequelize,Test,ObligationMaster,ObligationBankStatement,EmiTracking,RepaymentTrackRecordMaster,RepaymentDropdownMaster,RepaymentTrackRecord} = require('../models')
|
||||
const { sequelize,Test,ObligationMaster,ObligationBankStatement} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
var swaggerSpecToPdf = require("swagger-spec-to-pdf");
|
||||
const { Console } = require('winston/lib/winston/transports');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
var swaggerSpecToPdf = require("swagger-spec-to-pdf")
|
||||
|
||||
|
||||
// get all Obligation master data
|
||||
@ -34,7 +31,7 @@ exports.GetObligationBankStatement = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
ObligationBankStatement.findAll({where : {los_id : req.query.los_id , is_active : 1},order: [['item_order', 'ASC']] })
|
||||
await ObligationBankStatement.findAll({where : {los_id : req.query.los_id , is_active : 1} })
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
@ -98,108 +95,15 @@ exports.CreateObligationBankStatement = async (req, res) =>
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
// update Obligation Bank Statement
|
||||
// update bank statement ( is_active = 0) then create new bank statement
|
||||
exports.UpdateObligationBankStatement = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
req.body.forEach( async (element , index ) =>
|
||||
{
|
||||
ObligationBankStatement.update( element , { where: { id: element.id }}).then(data =>
|
||||
{
|
||||
if (req.body.length - 1 == index)
|
||||
{
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// get all Obligation bank statement
|
||||
exports.GetEmiTrackingMonth = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await EmiTracking.findOne({where : {los_id : req.query.los_id , is_active : 1} })
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Obligation Emi Tracking Month List api call Success");
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching Obligation Emi Tracking Month." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching Obligation Emi Tracking Month." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
|
||||
// create new Obligation master
|
||||
exports.CreateObligationEmiTrackingMonth = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var dateStore = [ ]
|
||||
var date = new Date(req.body.month_6);
|
||||
for (let i = 0; i < 5; i++)
|
||||
{
|
||||
var a = date.setMonth(date.getMonth() - 1);
|
||||
var b = date.toLocaleDateString("en-GB")
|
||||
var yourdate = b.split("/").reverse().join("-");
|
||||
dateStore.push(yourdate)
|
||||
}
|
||||
EmiTracking.create({los_id : req.body.los_id , month_1 : dateStore[4] , month_2 : dateStore[3] , month_3 : dateStore[2] ,month_4 : dateStore[1] , month_5 : dateStore[0] , month_6 : req.body.month_6 })
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data': data});
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create Obligation EmiTracking." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create Obligation EmiTracking." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
// update EMi Tracking
|
||||
exports.UpdateObligationEmiTracking = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var dateArr = [ ];
|
||||
var dateObj = { };
|
||||
var mon_6_date = new Date(req.body.month_6);
|
||||
for (let i = 0; i < 5; i++)
|
||||
{
|
||||
mon_6_date.setMonth(mon_6_date.getMonth() - 1);
|
||||
get_local_date = mon_6_date.toLocaleDateString("en-GB");
|
||||
get_all_dates = get_local_date.split("/").reverse().join("-");
|
||||
dateArr.push(get_all_dates)
|
||||
}
|
||||
Object.assign(dateObj, { los_id : req.body.los_id, month_1: dateArr[4], month_2: dateArr[3], month_3: dateArr[2], month_4: dateArr[1], month_5: dateArr[0], month_6: req.body.month_6 })
|
||||
EmiTracking.update(dateObj , {where: { id: req.body.id , is_active : 1 } })
|
||||
.then(data =>
|
||||
id = req.body.id;
|
||||
delete req.body.id
|
||||
await ObligationBankStatement.update({is_active : 0 },{ where: { id: id }});
|
||||
ObligationBankStatement.create(req.body).then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
})
|
||||
@ -216,221 +120,4 @@ exports.UpdateObligationEmiTracking = async (req, res) =>
|
||||
|
||||
|
||||
|
||||
// get all Obligation repayment dropdown master data
|
||||
exports.RepaymentTrackRecordMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await RepaymentTrackRecordMaster.findAll({where : { is_active : 1},
|
||||
include : [ {model: RepaymentDropdownMaster }]
|
||||
})
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Master Data List api call Success");
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching Repayment TrackRecord masterdata." ,'data': "No data" });
|
||||
});
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching Repayment TrackRecord masterdata masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
// create new RepaymentTrackRecordMaster
|
||||
exports.CreateRepaymentTrackRecordMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await RepaymentTrackRecord.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 create Obligation RepaymentTrackRecord." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create Obligation RepaymentTrackRecord." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
// updat RepaymentTrackRecord
|
||||
exports.UpdateRepaymentTrackRecord = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
req.body.forEach(async(element,index,array) => {
|
||||
id = element.id;
|
||||
delete element.id
|
||||
RepaymentTrackRecord.update(element,{ where: { id: id }})
|
||||
.then(data=>{
|
||||
if (array.length - 1 == index )
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
}
|
||||
})
|
||||
.catch(err=>{
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create Obligation RepaymentTrackRecord." ,'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
|
||||
|
||||
}
|
||||
|
||||
|
||||
// get all Obligation repayment track record data
|
||||
exports.GetRepaymentTrackRecord = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await RepaymentTrackRecord.findAll({where : { los_id : req.query.los_id , is_active : 1}
|
||||
})
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Master Data List api call Success");
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching Repayment TrackRecord data." ,'data': "No data" });
|
||||
});
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching Repayment TrackRecord masterdata data." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
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":"OBLIGATION","folder":"smc_cet_obligation_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
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class EmiTracking extends Model {
|
||||
|
||||
}
|
||||
EmiTracking.init(
|
||||
{
|
||||
los_id: { type: DataTypes.STRING },
|
||||
month_1: { type: DataTypes.DATE },
|
||||
month_2: { type: DataTypes.DATE },
|
||||
month_3: { type: DataTypes.DATE },
|
||||
month_4: { type: DataTypes.DATE },
|
||||
month_5: { type: DataTypes.DATE },
|
||||
month_6: { type: DataTypes.DATE },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'emi_tracking_months',
|
||||
modelName: 'EmiTracking',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
return EmiTracking
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class ObligationBankStatement extends Model {
|
||||
class OblicationBankStatement extends Model {
|
||||
|
||||
}
|
||||
ObligationBankStatement.init(
|
||||
OblicationBankStatement.init(
|
||||
{
|
||||
los_id: { type: DataTypes.STRING },
|
||||
lender: { type: DataTypes.STRING },
|
||||
@ -33,16 +33,15 @@ module.exports = (sequelize, DataTypes) => {
|
||||
emi_tracking_month_4: { type: DataTypes.INTEGER },
|
||||
emi_tracking_month_5: { type: DataTypes.INTEGER },
|
||||
emi_tracking_month_6: { type: DataTypes.INTEGER },
|
||||
item_order : { type: DataTypes.INTEGER },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'obligation_bank_statement',
|
||||
modelName: 'ObligationBankStatement',
|
||||
modelName: 'OblicationBankStatement',
|
||||
}
|
||||
)
|
||||
|
||||
return ObligationBankStatement
|
||||
return OblicationBankStatement
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class ObligationMaster extends Model {
|
||||
class OblicationMaster extends Model {
|
||||
|
||||
}
|
||||
ObligationMaster.init(
|
||||
OblicationMaster.init(
|
||||
{
|
||||
master_name: { type: DataTypes.STRING },
|
||||
value: { type: DataTypes.STRING },
|
||||
@ -13,12 +13,12 @@ module.exports = (sequelize, DataTypes) => {
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'obligation_master',
|
||||
modelName: 'ObligationMaster',
|
||||
modelName: 'OblicationMaster',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
return ObligationMaster
|
||||
return OblicationMaster
|
||||
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class RepaymentDropdownMaster extends Model {
|
||||
|
||||
}
|
||||
RepaymentDropdownMaster.init(
|
||||
{
|
||||
track_record_items_key: { type: DataTypes.STRING },
|
||||
value: { type: DataTypes.INTEGER },
|
||||
sub_value: { type: DataTypes.INTEGER },
|
||||
result: { type: DataTypes.INTEGER },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'repayment_track_record_dropdown_master',
|
||||
modelName: 'RepaymentDropdownMaster',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
return RepaymentDropdownMaster
|
||||
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
const {RepaymentDropdownMaster} = require('../models')
|
||||
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class RepaymentTrackRecordMaster extends Model {
|
||||
|
||||
}
|
||||
RepaymentTrackRecordMaster.init(
|
||||
{
|
||||
track_record_items: { type: DataTypes.STRING },
|
||||
track_record_items_key: { type: DataTypes.STRING },
|
||||
banking_and_gst: { type: DataTypes.INTEGER },
|
||||
banking_v2: { type: DataTypes.INTEGER },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'repayment_track_record_master',
|
||||
modelName: 'RepaymentTrackRecordMaster',
|
||||
}
|
||||
)
|
||||
|
||||
RepaymentTrackRecordMaster.associate = models => {
|
||||
RepaymentTrackRecordMaster.hasMany(models.RepaymentDropdownMaster, {
|
||||
foreignKey: 'track_record_items_key',
|
||||
sourceKey : 'id'
|
||||
});
|
||||
}
|
||||
return RepaymentTrackRecordMaster
|
||||
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class RepaymentTrackRecord extends Model {
|
||||
|
||||
}
|
||||
RepaymentTrackRecord.init(
|
||||
{
|
||||
los_id: { type: DataTypes.STRING },
|
||||
program: { type: DataTypes.STRING },
|
||||
track_record_items_key: { type: DataTypes.STRING },
|
||||
value: { type: DataTypes.STRING },
|
||||
sub_value: { type: DataTypes.STRING },
|
||||
result: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'repayment_track_record',
|
||||
modelName: 'RepaymentTrackRecord',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
return RepaymentTrackRecord
|
||||
|
||||
}
|
||||
@ -203,10 +203,6 @@ router.post("/createObligationMaster",Mycontroller.CreateObligationMaster)
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_6
|
||||
* example: 1
|
||||
* item_order:
|
||||
* type: integer
|
||||
* description: ordering key
|
||||
* example: 1
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
@ -238,8 +234,6 @@ router.post("/createObligationMaster",Mycontroller.CreateObligationMaster)
|
||||
* @swagger
|
||||
* definitions:
|
||||
* updateObligationBankStatement:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
@ -354,10 +348,6 @@ router.post("/createObligationMaster",Mycontroller.CreateObligationMaster)
|
||||
* type: integer
|
||||
* description: emiTrackingMonth_6
|
||||
* example: 1
|
||||
* item_order:
|
||||
* type: integer
|
||||
* description: ordering key
|
||||
* example: 1
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
@ -385,299 +375,9 @@ router.post("/updateObligationBankStatement",Mycontroller.UpdateObligationBankSt
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/getEmiTrackingMonth:
|
||||
* get:
|
||||
* summary: Get Obligation Emi Traking Month List
|
||||
* description: Get Obligation Emi Traking Month List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: los_id
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Obligation Emi Traking Month List
|
||||
* example: 12abc
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/getEmiTrackingMonth",Mycontroller.GetEmiTrackingMonth)
|
||||
|
||||
|
||||
// get Obligation burear bankstatement
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/getObligationBankStatement:
|
||||
* get:
|
||||
* summary: Get Obligation Bank Statement List
|
||||
* description: Get Obligation Bank Statement
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: los_id
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Obligation Bank Statement
|
||||
* example: 12abc
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/getObligationBankStatement",Mycontroller.GetObligationBankStatement)
|
||||
|
||||
|
||||
// create Obligation Emi Tracking
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* createObligationEmiTrackingMonth:
|
||||
* type: object
|
||||
* properties:
|
||||
* los_id:
|
||||
* type: string
|
||||
* description: los_id
|
||||
* example: 123ab
|
||||
* month_6:
|
||||
* type: string
|
||||
* description: month_1
|
||||
* example: "2022-04-12"
|
||||
* format: date
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/createObligationEmiTrackingMonth:
|
||||
* post:
|
||||
* summary: create Obligation Emi Tracking Month details
|
||||
* description: create a Obligation Emi Tracking Month
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/createObligationEmiTrackingMonth'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: New create Obligation Emi Tracking Month
|
||||
* 500:
|
||||
* description: failure in inserting Obligation Emi Tracking Month
|
||||
*/
|
||||
router.post("/createObligationEmiTrackingMonth",Mycontroller.CreateObligationEmiTrackingMonth)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* updateObligationEmiTracking:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: integer
|
||||
* description: id
|
||||
* example: 1
|
||||
* los_id:
|
||||
* type: string
|
||||
* description: los_id
|
||||
* example: MW112233
|
||||
* month_6:
|
||||
* type: string
|
||||
* description: month_1
|
||||
* example: "2022-04-12"
|
||||
* format: date
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/updateObligationEmiTracking:
|
||||
* post:
|
||||
* summary: update Obligation Obligation EmiTracking details
|
||||
* description: update Obligation Obligation EmiTracking details
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/updateObligationEmiTracking'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: update Obligation Obligation EmiTracking details
|
||||
* 500:
|
||||
* description: failure in updating Obligation EmiTracking details
|
||||
*/
|
||||
router.post("/updateObligationEmiTracking",Mycontroller.UpdateObligationEmiTracking)
|
||||
|
||||
|
||||
// get Obligation burear bankstatement
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/getRepaymentTrackRecordMaster:
|
||||
* get:
|
||||
* summary: Get Obligation Repayment TrackRecord List
|
||||
* description: Get Obligation Repayment TrackRecord
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/getRepaymentTrackRecordMaster",Mycontroller.RepaymentTrackRecordMaster)
|
||||
|
||||
|
||||
// create Obligation Emi Tracking
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* createRepaymentTrackRecordMaster:
|
||||
* type: object
|
||||
* properties:
|
||||
* los_id:
|
||||
* type: string
|
||||
* description: los_id
|
||||
* example: 123abc
|
||||
* program:
|
||||
* type: string
|
||||
* description: result
|
||||
* example: banking_and_gst
|
||||
* track_record_items_key:
|
||||
* type: string
|
||||
* description: track record items
|
||||
* example: "bounce_in_last_6_months"
|
||||
* value:
|
||||
* type: string
|
||||
* description: value
|
||||
* example: Nil
|
||||
* sub_value:
|
||||
* type: string
|
||||
* description: sub value
|
||||
* example: Paid Within 5 days
|
||||
* result:
|
||||
* type: string
|
||||
* description: result
|
||||
* example: No Deviation
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/createRepaymentTrackRecordMaster:
|
||||
* post:
|
||||
* summary: create Repayment TrackRecord Master details
|
||||
* description: create a Repayment TrackRecord Master
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/createRepaymentTrackRecordMaster'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: New create Repayment TrackRecord Master
|
||||
* 500:
|
||||
* description: failure in inserting Repayment TrackRecord Master
|
||||
*/
|
||||
router.post("/createRepaymentTrackRecordMaster",Mycontroller.CreateRepaymentTrackRecordMaster)
|
||||
|
||||
|
||||
// Update Repayment Track Record
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* UpdateRepaymentTrackRecord:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: integer
|
||||
* description: id
|
||||
* example: 1
|
||||
* los_id:
|
||||
* type: string
|
||||
* description: los_id
|
||||
* example: 123abc
|
||||
* program:
|
||||
* type: string
|
||||
* description: result
|
||||
* example: banking_and_gst
|
||||
* track_record_items_key:
|
||||
* type: string
|
||||
* description: track record items
|
||||
* example: "bounce_in_last_6_months"
|
||||
* value:
|
||||
* type: string
|
||||
* description: value
|
||||
* example: Nil
|
||||
* sub_value:
|
||||
* type: string
|
||||
* description: sub value
|
||||
* example: Paid Within 5 days
|
||||
* result:
|
||||
* type: string
|
||||
* description: result
|
||||
* example: No Deviation
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: isActive
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/UpdateRepaymentTrackRecord:
|
||||
* post:
|
||||
* summary: update Repayment TrackRecord details
|
||||
* description: update a Repayment TrackRecord
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/UpdateRepaymentTrackRecord'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: update Repayment TrackRecord Master
|
||||
* 500:
|
||||
* description: failure in inserting Repayment TrackRecord Master
|
||||
*/
|
||||
router.post("/UpdateRepaymentTrackRecord",Mycontroller.UpdateRepaymentTrackRecord)
|
||||
|
||||
|
||||
// get Obligation burear bankstatement
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/getRepaymentTrackRecord:
|
||||
* get:
|
||||
* summary: Get Obligation Repayment Track Record List
|
||||
* description: Get Obligation Repayment Track Record List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: los_id
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Obligation Repayment Track Record List
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/getRepaymentTrackRecord",Mycontroller.GetRepaymentTrackRecord)
|
||||
|
||||
|
||||
router.get("/getfilename", Mycontroller.readLogFileName);
|
||||
|
||||
router.post("/readlogs", Mycontroller.readLogFile);
|
||||
|
||||
router.get("/view", Mycontroller.viewLandingPage);
|
||||
|
||||
router.post("/deletelog", Mycontroller.deleteLogFile);
|
||||
|
||||
// routes started here
|
||||
app.use('/api', router);
|
||||
|
||||
@ -1,346 +0,0 @@
|
||||
<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">×</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>
|
||||
5772
package-lock.json
generated
5772
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,16 +12,11 @@
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"date-fns": "^2.28.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"ejs": "^3.1.9",
|
||||
"excel-date-to-js": "^1.1.4",
|
||||
"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",
|
||||
|
||||
13
server.js
13
server.js
@ -1,9 +1,7 @@
|
||||
require('dotenv').config();
|
||||
const express = require('express')
|
||||
var moment = require('moment')
|
||||
var swaggerSpecToPdf = require("swagger-spec-to-pdf")
|
||||
const app = express();
|
||||
const path = require('path');
|
||||
const app = express()
|
||||
//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")
|
||||
@ -13,9 +11,6 @@ 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');
|
||||
|
||||
@ -68,9 +63,3 @@ app.listen({ port: PORT_NUMBER }, async () => {
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user