Compare commits

..

10 Commits

Author SHA1 Message Date
suseendhiran17
58c358cfb1 susee:log 2023-07-19 18:07:34 +05:30
suseendhiran17
e6be9b19f7 susee:log 2023-07-19 16:07:04 +05:30
suseendhiran17
e3571d7d42 Swagger array of object update : suseendhiran 2022-07-29 10:21:42 +05:30
suseendhiran17
b6c81a9d23 updateRepaymentTrackRecord : suseendhiran 2022-07-28 10:18:23 +05:30
suseendhiran17
af7326dab4 suseendhiran , change update api 2022-07-13 14:24:56 +05:30
suseendhiran17
2c7f0e831c change create and update api , susee 2022-04-26 16:47:05 +05:30
suseendhiran17
f4cefa0268 change create and update api , susee 2022-04-25 16:21:05 +05:30
suseendhiran17
aeffbf45b3 change create and update api , susee 2022-04-25 16:13:18 +05:30
suseendhiran17
d2bccc4043 add api , susee 2022-04-23 12:32:57 +05:30
suseendhiran17
078b6a2796 susee 2022-04-22 10:26:11 +05:30
12 changed files with 1325 additions and 5808 deletions

View File

@ -1,6 +1,9 @@
const { sequelize,Test,ObligationMaster,ObligationBankStatement} = require('../models') const { sequelize,Test,ObligationMaster,ObligationBankStatement,EmiTracking,RepaymentTrackRecordMaster,RepaymentDropdownMaster,RepaymentTrackRecord} = require('../models')
const { logMsg } = require('../services/logger.js'); const { logMsg } = require('../services/logger.js');
var swaggerSpecToPdf = require("swagger-spec-to-pdf") var swaggerSpecToPdf = require("swagger-spec-to-pdf");
const { Console } = require('winston/lib/winston/transports');
const fs = require('fs');
const path = require('path');
// get all Obligation master data // get all Obligation master data
@ -31,7 +34,7 @@ exports.GetObligationBankStatement = async (req, res) =>
{ {
try try
{ {
await ObligationBankStatement.findAll({where : {los_id : req.query.los_id , is_active : 1} }) ObligationBankStatement.findAll({where : {los_id : req.query.los_id , is_active : 1},order: [['item_order', 'ASC']] })
.then(data => .then(data =>
{ {
res.send({'status':200,'message':"success",'data':data}); res.send({'status':200,'message':"success",'data':data});
@ -95,15 +98,108 @@ exports.CreateObligationBankStatement = async (req, res) =>
} //end of try catch } //end of try catch
}; };
// update bank statement ( is_active = 0) then create new bank statement // update Obligation Bank Statement
exports.UpdateObligationBankStatement = async (req, res) => exports.UpdateObligationBankStatement = async (req, res) =>
{ {
try try
{ {
id = req.body.id; req.body.forEach( async (element , index ) =>
delete req.body.id {
await ObligationBankStatement.update({is_active : 0 },{ where: { id: id }}); ObligationBankStatement.update( element , { where: { id: element.id }}).then(data =>
ObligationBankStatement.create(req.body).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 =>
{ {
res.send({'status':200,'message':"success",'data':data}); res.send({'status':200,'message':"success",'data':data});
}) })
@ -120,4 +216,221 @@ exports.UpdateObligationBankStatement = 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
};

29
app/models/EmiTracking.js Normal file
View File

@ -0,0 +1,29 @@
'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
}

View File

@ -1,10 +1,10 @@
'use strict' 'use strict'
const { Model } = require('sequelize') const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => { module.exports = (sequelize, DataTypes) => {
class OblicationBankStatement extends Model { class ObligationBankStatement extends Model {
} }
OblicationBankStatement.init( ObligationBankStatement.init(
{ {
los_id: { type: DataTypes.STRING }, los_id: { type: DataTypes.STRING },
lender: { type: DataTypes.STRING }, lender: { type: DataTypes.STRING },
@ -33,15 +33,16 @@ module.exports = (sequelize, DataTypes) => {
emi_tracking_month_4: { type: DataTypes.INTEGER }, emi_tracking_month_4: { type: DataTypes.INTEGER },
emi_tracking_month_5: { type: DataTypes.INTEGER }, emi_tracking_month_5: { type: DataTypes.INTEGER },
emi_tracking_month_6: { type: DataTypes.INTEGER }, emi_tracking_month_6: { type: DataTypes.INTEGER },
item_order : { type: DataTypes.INTEGER },
is_active: { type: DataTypes.INTEGER } is_active: { type: DataTypes.INTEGER }
}, },
{ {
sequelize, sequelize,
tableName: 'obligation_bank_statement', tableName: 'obligation_bank_statement',
modelName: 'OblicationBankStatement', modelName: 'ObligationBankStatement',
} }
) )
return OblicationBankStatement return ObligationBankStatement
} }

View File

@ -1,10 +1,10 @@
'use strict' 'use strict'
const { Model } = require('sequelize') const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => { module.exports = (sequelize, DataTypes) => {
class OblicationMaster extends Model { class ObligationMaster extends Model {
} }
OblicationMaster.init( ObligationMaster.init(
{ {
master_name: { type: DataTypes.STRING }, master_name: { type: DataTypes.STRING },
value: { type: DataTypes.STRING }, value: { type: DataTypes.STRING },
@ -13,12 +13,12 @@ module.exports = (sequelize, DataTypes) => {
{ {
sequelize, sequelize,
tableName: 'obligation_master', tableName: 'obligation_master',
modelName: 'OblicationMaster', modelName: 'ObligationMaster',
} }
) )
return OblicationMaster return ObligationMaster
} }

View File

@ -0,0 +1,26 @@
'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
}

View File

@ -0,0 +1,32 @@
'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
}

View File

@ -0,0 +1,28 @@
'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
}

View File

@ -203,6 +203,10 @@ router.post("/createObligationMaster",Mycontroller.CreateObligationMaster)
* type: integer * type: integer
* description: emiTrackingMonth_6 * description: emiTrackingMonth_6
* example: 1 * example: 1
* item_order:
* type: integer
* description: ordering key
* example: 1
* is_active: * is_active:
* type: integer * type: integer
* description: isActive * description: isActive
@ -234,124 +238,130 @@ router.post("/createObligationMaster",Mycontroller.CreateObligationMaster)
* @swagger * @swagger
* definitions: * definitions:
* updateObligationBankStatement: * updateObligationBankStatement:
* type: object * type: array
* properties: * items:
* id: * type: object
* type: integer * properties:
* description: id * id:
* example: 1 * type: integer
* los_id: * description: id
* type: string * example: 1
* description: losid * los_id:
* example: 123ab * type: string
* lender: * description: losid
* type: string * example: 123ab
* description: lender * lender:
* example: name * type: string
* loan_type: * description: lender
* type: string * example: name
* description: loantype * loan_type:
* example: Credit Card * type: string
* loan_availed_sanctioned_amount: * description: loantype
* type: integer * example: Credit Card
* description: loanAvailedSanctionedAmount * loan_availed_sanctioned_amount:
* example: 10000 * type: integer
* name_of_bank: * description: loanAvailedSanctionedAmount
* type: string * example: 10000
* description: bankName * name_of_bank:
* example: sbi * type: string
* loan_in_name_of_ac_type: * description: bankName
* type: string * example: sbi
* description: nameOfAcType * loan_in_name_of_ac_type:
* example: Applicant * type: string
* loan_ownership_status: * description: nameOfAcType
* type: string * example: Applicant
* description: LoanOwnershipStatus * loan_ownership_status:
* example: Joint * type: string
* roi: * description: LoanOwnershipStatus
* type: string * example: Joint
* description: roi * roi:
* example: 10% * type: string
* avg_peak_util_of_the_OD_or_CC: * description: roi
* type: string * example: 10%
* description: avgPeakUtilOfTheOD_or_CC * avg_peak_util_of_the_OD_or_CC:
* example: abc * type: string
* nature_of_loan: * description: avgPeakUtilOfTheOD_or_CC
* type: string * example: abc
* description: natureOfLoan * nature_of_loan:
* example: Unsecured * type: string
* loan_identification_source: * description: natureOfLoan
* type: string * example: Unsecured
* description: loanIdentificationSource * loan_identification_source:
* example: Credit Bureau Report * type: string
* sanction_date: * description: loanIdentificationSource
* type: string * example: Credit Bureau Report
* description: sanctionDate * sanction_date:
* example: "10-2-2020" * type: string
* principal_outstanding: * description: sanctionDate
* type: integer * example: "10-2-2020"
* description: principalOutstanding * principal_outstanding:
* example: 1 * type: integer
* monthly_oblig: * description: principalOutstanding
* type: integer * example: 1
* description: monthlyOblig * monthly_oblig:
* example: 1 * type: integer
* total_loan_tenure_months: * description: monthlyOblig
* type: integer * example: 1
* description: totalLoanTenureMonths * total_loan_tenure_months:
* example: 1 * type: integer
* no_of_instalments_paid: * description: totalLoanTenureMonths
* type: integer * example: 1
* description: noOfInstalmentsPaid * no_of_instalments_paid:
* example: 1 * type: integer
* balance_tenor_months: * description: noOfInstalmentsPaid
* type: integer * example: 1
* description: balanceTenorMonths * balance_tenor_months:
* example: 1 * type: integer
* loan_status_or_remarks: * description: balanceTenorMonths
* type: string * example: 1
* description: loanStatusOrRemarks * loan_status_or_remarks:
* example: Positive * type: string
* consider_in_oblig: * description: loanStatusOrRemarks
* type: string * example: Positive
* description: considerInOblig * consider_in_oblig:
* example: No * type: string
* reason_for_not_considering_in_oblig: * description: considerInOblig
* type: string * example: No
* description: reasonForNotConsideringInOblig * reason_for_not_considering_in_oblig:
* example: Already Closed * type: string
* charge_filed_with_roc: * description: reasonForNotConsideringInOblig
* type: string * example: Already Closed
* description: chargeFiledWithRoc * charge_filed_with_roc:
* example: Yes * type: string
* emi_tracking_month_1: * description: chargeFiledWithRoc
* type: integer * example: Yes
* description: emiTrackingMonth_1 * emi_tracking_month_1:
* example: 1 * type: integer
* emi_tracking_month_2: * description: emiTrackingMonth_1
* type: integer * example: 1
* description: emiTrackingMonth_2 * emi_tracking_month_2:
* example: 1 * type: integer
* emi_tracking_month_3: * description: emiTrackingMonth_2
* type: integer * example: 1
* description: emiTrackingMonth_3 * emi_tracking_month_3:
* example: 1 * type: integer
* emi_tracking_month_4: * description: emiTrackingMonth_3
* type: integer * example: 1
* description: emiTrackingMonth_4 * emi_tracking_month_4:
* example: 1 * type: integer
* emi_tracking_month_5: * description: emiTrackingMonth_4
* type: integer * example: 1
* description: emiTrackingMonth_5 * emi_tracking_month_5:
* example: 1 * type: integer
* emi_tracking_month_6: * description: emiTrackingMonth_5
* type: integer * example: 1
* description: emiTrackingMonth_6 * emi_tracking_month_6:
* example: 1 * type: integer
* is_active: * description: emiTrackingMonth_6
* type: integer * example: 1
* description: isActive * item_order:
* example: 1 * type: integer
* description: ordering key
* example: 1
* is_active:
* type: integer
* description: isActive
* example: 1
*/ */
/** /**
* @swagger * @swagger
@ -375,9 +385,299 @@ 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 // routes started here
app.use('/api', router); app.use('/api', router);

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>

5772
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,11 +12,16 @@
"dependencies": { "dependencies": {
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"date-fns": "^2.28.0",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"ejs": "^3.1.9",
"excel-date-to-js": "^1.1.4", "excel-date-to-js": "^1.1.4",
"express": "^4.17.1", "express": "^4.17.1",
"fs": "0.0.1-security",
"log4js": "^6.3.0", "log4js": "^6.3.0",
"moment": "^2.29.4",
"mssql": "^7.2.0", "mssql": "^7.2.0",
"path": "^0.12.7",
"request": "^2.88.2", "request": "^2.88.2",
"sequelize": "^6.6.5", "sequelize": "^6.6.5",
"swagger-jsdoc": "^6.1.0", "swagger-jsdoc": "^6.1.0",

View File

@ -1,7 +1,9 @@
require('dotenv').config(); require('dotenv').config();
const express = require('express') const express = require('express')
var moment = require('moment')
var swaggerSpecToPdf = require("swagger-spec-to-pdf") var swaggerSpecToPdf = require("swagger-spec-to-pdf")
const app = express() const app = express();
const path = require('path');
//it is used to clear cache //it is used to clear cache
app.use(function(req, res, next) { app.use(function(req, res, next) {
res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0") res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
@ -11,6 +13,9 @@ app.use(function(req, res, next) {
}) })
const {logMsg} = require('./app/services/logger.js'); 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 swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express'); const swaggerUi = require('swagger-ui-express');
@ -63,3 +68,9 @@ app.listen({ port: PORT_NUMBER }, async () => {
}) })