Compare commits
No commits in common. "caf68920277eb91adb0ddf2451c44314db2716b7" and "1323db4660e299661daf3085eeea4b4e48a35216" have entirely different histories.
caf6892027
...
1323db4660
@ -1,7 +1,5 @@
|
|||||||
const { sequelize,Workingnotes} = require('../models')
|
const { sequelize,Workingnotes} = require('../models')
|
||||||
const { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
exports.createNotes = async (req, res) =>
|
exports.createNotes = async (req, res) =>
|
||||||
{
|
{
|
||||||
@ -14,8 +12,10 @@ exports.createNotes = async (req, res) =>
|
|||||||
notes = JSON.stringify(value);
|
notes = JSON.stringify(value);
|
||||||
data = {
|
data = {
|
||||||
losid: req.body.losid,
|
losid: req.body.losid,
|
||||||
|
module_name: req.body.module_name,
|
||||||
|
entity_reference: req.body.entity_reference,
|
||||||
notes: notes,
|
notes: notes,
|
||||||
sheet_no : value.index + 1,
|
sheet_no : value.name,
|
||||||
user_id: req.body.user_id,
|
user_id: req.body.user_id,
|
||||||
createdby: req.body.createdby
|
createdby: req.body.createdby
|
||||||
};
|
};
|
||||||
@ -45,11 +45,7 @@ exports.updateNotes = async (req, res) =>
|
|||||||
|
|
||||||
for (const value of req.body.notes)
|
for (const value of req.body.notes)
|
||||||
{
|
{
|
||||||
sheet_no = value.index + 1;
|
notesData = await Workingnotes.findOne({where :{losid : req.body.losid , module_name : req.body.module_name, sheet_no : value.name , is_active:1}});
|
||||||
notesData = await Workingnotes.findOne({where :{losid : req.body.losid , sheet_no : sheet_no , is_active:1}});
|
|
||||||
|
|
||||||
if(notesData != undefined)
|
|
||||||
{
|
|
||||||
id = notesData.dataValues.id;
|
id = notesData.dataValues.id;
|
||||||
notes = JSON.stringify(value);
|
notes = JSON.stringify(value);
|
||||||
|
|
||||||
@ -58,23 +54,6 @@ exports.updateNotes = async (req, res) =>
|
|||||||
.then(data=>{ logMsg.info("Notes update Success");})
|
.then(data=>{ logMsg.info("Notes update Success");})
|
||||||
.catch(err=>{ logMsg.info("Notes update Failed");});
|
.catch(err=>{ logMsg.info("Notes update Failed");});
|
||||||
|
|
||||||
}else{
|
|
||||||
notes = JSON.stringify(value);
|
|
||||||
data = {
|
|
||||||
losid: req.body.losid,
|
|
||||||
notes: notes,
|
|
||||||
sheet_no : value.index + 1,
|
|
||||||
user_id: req.body.user_id,
|
|
||||||
createdby: req.body.createdby
|
|
||||||
};
|
|
||||||
// insert working notes data
|
|
||||||
await Workingnotes.create(data)
|
|
||||||
.then(data=>{ logMsg.info("Notes insert Success");})
|
|
||||||
.catch(err=>{ logMsg.info("Notes insert Failed");});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,9 +72,18 @@ exports.notesList = async (req, res) =>
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
notesData = await Workingnotes.findAll({where :{losid : req.query.losid, is_active:1}}).catch(err=>{console.log(err);});
|
|
||||||
|
|
||||||
|
|
||||||
|
if(req.query.entity_reference == undefined)
|
||||||
|
{
|
||||||
|
notesData = await Workingnotes.findAll({where :{losid : req.query.losid , module_name : req.query.module_name , is_active:1}});
|
||||||
|
console.log(JSON.parse(notesData[2].notes))
|
||||||
res.send({'status':200 , message:"Success." ,'data': notesData});
|
res.send({'status':200 , message:"Success." ,'data': notesData});
|
||||||
|
}else{
|
||||||
|
notesData = await Workingnotes.findAll({where :{losid : req.query.losid , module_name : req.query.module_name , entity_reference : req.query.entity_reference, is_active:1}});
|
||||||
|
res.send({'status':200 , message:"Success." ,'data': notesData});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
res.status(500).send({'status':404,
|
res.status(500).send({'status':404,
|
||||||
@ -108,135 +96,233 @@ exports.notesList = async (req, res) =>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
exports.deleteNotes = async (req, res) =>
|
const myData = [ {
|
||||||
|
"name": "sheet1",
|
||||||
|
"freeze": "A1",
|
||||||
|
"styles": [
|
||||||
{
|
{
|
||||||
try
|
"font": {
|
||||||
{
|
"italic": true
|
||||||
for (const value of req.body.id)
|
|
||||||
{
|
|
||||||
// update working notes data (is_active = 0)
|
|
||||||
await Workingnotes.update({is_active: 0} , { where: { id: value } })
|
|
||||||
.then(data=>{ logMsg.info("Notes is_active = 0 update Success");})
|
|
||||||
.catch(err=>{ logMsg.info("Notes is_active = 0 update Failed");});
|
|
||||||
}
|
}
|
||||||
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
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exports.readLogFileName = async (req , res) =>
|
|
||||||
{
|
{
|
||||||
try
|
"color": "#f7ccac"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
folderName = req;
|
"color": "#f7ccac",
|
||||||
const logFilePath = 'storage/log';
|
"bgcolor": "#93d051"
|
||||||
|
},
|
||||||
const fileNames = fs.readdirSync(logFilePath);
|
{
|
||||||
// Remove the first element (0th index)
|
"color": "#7030a0",
|
||||||
const [, ...data] = fileNames;
|
"bgcolor": "#93d051"
|
||||||
return data;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(err)
|
],
|
||||||
{
|
"merges": [],
|
||||||
res.status(500).send({'status':404,
|
"rows": {
|
||||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
"0": {
|
||||||
});
|
"cells": {
|
||||||
} //end of try catch
|
"0": {
|
||||||
};
|
"text": "ddsd"
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
exports.readLogFile = async (req , res) =>
|
"text": "fdfdf",
|
||||||
{
|
"style": 0
|
||||||
try
|
},
|
||||||
{
|
"2": {
|
||||||
folderName = req.body.folder;
|
"text": "ddd"
|
||||||
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)
|
},
|
||||||
{
|
"1": {
|
||||||
res.status(500).send({'status':404,
|
"cells": {
|
||||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
"6": {
|
||||||
});
|
"text": "dfdfd"
|
||||||
} //end of try catch
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
exports.viewLandingPage = async (req , res) =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
moduleName = [ { "module":"WORKING NOTES","folder":"smc_cet_workingnotes_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)
|
},
|
||||||
{
|
"2": {
|
||||||
res.status(500).send({'status':404,
|
"cells": {
|
||||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
"4": {
|
||||||
});
|
"text": "dfdf"
|
||||||
} //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)
|
},
|
||||||
|
"4": {
|
||||||
|
"cells": {
|
||||||
|
"6": {
|
||||||
|
"text": "dfd"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"cells": {
|
||||||
|
"3": {
|
||||||
|
"text": "dfddf"
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"text": "df"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"6": {
|
||||||
|
"cells": {
|
||||||
|
"8": {
|
||||||
|
"text": "dfdf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"9": {
|
||||||
|
"cells": {
|
||||||
|
"2": {
|
||||||
|
"text": "dfdf"
|
||||||
|
},
|
||||||
|
"6": {
|
||||||
|
"text": "dfdf",
|
||||||
|
"style": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10": {
|
||||||
|
"cells": {
|
||||||
|
"4": {
|
||||||
|
"text": "ddsd"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11": {
|
||||||
|
"cells": {
|
||||||
|
"3": {
|
||||||
|
"text": "fff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"12": {
|
||||||
|
"cells": {
|
||||||
|
"1": {
|
||||||
|
"text": "dfdf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"len": 100
|
||||||
|
},
|
||||||
|
"cols": {
|
||||||
|
"len": 26
|
||||||
|
},
|
||||||
|
"validations": [],
|
||||||
|
"autofilter": {}
|
||||||
|
},{
|
||||||
|
"name": "sheet2",
|
||||||
|
"freeze": "A1",
|
||||||
|
"styles": [
|
||||||
{
|
{
|
||||||
res.status(500).send({'status':404,
|
"font": {
|
||||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
"italic": true
|
||||||
});
|
}
|
||||||
} //end of try catch
|
},
|
||||||
};
|
{
|
||||||
|
"color": "#f7ccac"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "#f7ccac",
|
||||||
|
"bgcolor": "#93d051"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "#7030a0",
|
||||||
|
"bgcolor": "#93d051"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"merges": [],
|
||||||
|
"rows": {
|
||||||
|
"0": {
|
||||||
|
"cells": {
|
||||||
|
"0": {
|
||||||
|
"text": "123"
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"text": "123",
|
||||||
|
"style": 0
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"text": "123"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"cells": {
|
||||||
|
"6": {
|
||||||
|
"text": "dfdfd"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"cells": {
|
||||||
|
"4": {
|
||||||
|
"text": "dfdf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"4": {
|
||||||
|
"cells": {
|
||||||
|
"6": {
|
||||||
|
"text": "dfd"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"cells": {
|
||||||
|
"3": {
|
||||||
|
"text": "dfddf"
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"text": "df"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"6": {
|
||||||
|
"cells": {
|
||||||
|
"8": {
|
||||||
|
"text": "dfdf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"9": {
|
||||||
|
"cells": {
|
||||||
|
"2": {
|
||||||
|
"text": "dfdf"
|
||||||
|
},
|
||||||
|
"6": {
|
||||||
|
"text": "dfdf",
|
||||||
|
"style": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10": {
|
||||||
|
"cells": {
|
||||||
|
"4": {
|
||||||
|
"text": "ddsd"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11": {
|
||||||
|
"cells": {
|
||||||
|
"3": {
|
||||||
|
"text": "fff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"12": {
|
||||||
|
"cells": {
|
||||||
|
"1": {
|
||||||
|
"text": "dfdf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"len": 100
|
||||||
|
},
|
||||||
|
"cols": {
|
||||||
|
"len": 26
|
||||||
|
},
|
||||||
|
"validations": [],
|
||||||
|
"autofilter": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -17,6 +17,8 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
Workingnotes.init(
|
Workingnotes.init(
|
||||||
{
|
{
|
||||||
losid: { type: DataTypes.STRING },
|
losid: { type: DataTypes.STRING },
|
||||||
|
module_name: { type: DataTypes.STRING },
|
||||||
|
entity_reference: { type: DataTypes.STRING },
|
||||||
notes: { type: DataTypes.STRING },
|
notes: { type: DataTypes.STRING },
|
||||||
sheet_no: { type: DataTypes.STRING },
|
sheet_no: { type: DataTypes.STRING },
|
||||||
user_id: { type: DataTypes.INTEGER },
|
user_id: { type: DataTypes.INTEGER },
|
||||||
|
|||||||
@ -33,6 +33,16 @@ module.exports = app => {
|
|||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
* required: true
|
* required: true
|
||||||
|
* - in: query
|
||||||
|
* name: module_name
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* required: true
|
||||||
|
* - in: query
|
||||||
|
* name: entity_reference
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* required: false
|
||||||
* example:
|
* example:
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
@ -49,6 +59,14 @@ module.exports = app => {
|
|||||||
* type: string
|
* type: string
|
||||||
* description: losid
|
* description: losid
|
||||||
* example: MW112233
|
* example: MW112233
|
||||||
|
* module_name:
|
||||||
|
* type: string
|
||||||
|
* description: gst (module_name)
|
||||||
|
* example: gst
|
||||||
|
* entity_reference:
|
||||||
|
* type: string
|
||||||
|
* description: (gst_no/cin_no)->entity_reference key
|
||||||
|
* example: cin756kjbjh76
|
||||||
* notes:
|
* notes:
|
||||||
* type: array
|
* type: array
|
||||||
* description:
|
* description:
|
||||||
@ -66,8 +84,8 @@ module.exports = app => {
|
|||||||
* @swagger
|
* @swagger
|
||||||
* /api/createNotes:
|
* /api/createNotes:
|
||||||
* post:
|
* post:
|
||||||
* summary:
|
* summary: Pull SalesPd Data
|
||||||
* description:
|
* description: Pull SalesPd Data
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
@ -91,6 +109,14 @@ module.exports = app => {
|
|||||||
* type: string
|
* type: string
|
||||||
* description: losid
|
* description: losid
|
||||||
* example: MW112233
|
* example: MW112233
|
||||||
|
* module_name:
|
||||||
|
* type: string
|
||||||
|
* description: gst (module_name)
|
||||||
|
* example: gst
|
||||||
|
* entity_reference:
|
||||||
|
* type: string
|
||||||
|
* description: (gst_no/cin_no)->entity_reference key
|
||||||
|
* example: cin756kjbjh76
|
||||||
* notes:
|
* notes:
|
||||||
* type: array
|
* type: array
|
||||||
* description:
|
* description:
|
||||||
@ -103,17 +129,13 @@ module.exports = app => {
|
|||||||
* type: integer
|
* type: integer
|
||||||
* description:
|
* description:
|
||||||
* example: 1
|
* example: 1
|
||||||
* createdby:
|
|
||||||
* type: integer
|
|
||||||
* description:
|
|
||||||
* example: 1
|
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /api/updateNotes:
|
* /api/updateNotes:
|
||||||
* post:
|
* post:
|
||||||
* summary:
|
* summary: Pull SalesPd Data
|
||||||
* description:
|
* description: Pull SalesPd Data
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
@ -128,45 +150,8 @@ module.exports = app => {
|
|||||||
router.post("/updateNotes", Notescontroller.updateNotes);
|
router.post("/updateNotes", Notescontroller.updateNotes);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @swagger
|
|
||||||
* definitions:
|
|
||||||
* deleteNotes:
|
|
||||||
* type: object
|
|
||||||
* properties:
|
|
||||||
* id:
|
|
||||||
* type: array
|
|
||||||
* description: id of notes object
|
|
||||||
* example: []
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @swagger
|
|
||||||
* /api/deleteNotes:
|
|
||||||
* post:
|
|
||||||
* summary:
|
|
||||||
* description:
|
|
||||||
* requestBody:
|
|
||||||
* content:
|
|
||||||
* application/json:
|
|
||||||
* schema:
|
|
||||||
* $ref: '#/definitions/deleteNotes'
|
|
||||||
* responses:
|
|
||||||
* 200:
|
|
||||||
* description: success
|
|
||||||
* 500:
|
|
||||||
* description: failed
|
|
||||||
*/
|
|
||||||
router.post("/deleteNotes", Notescontroller.deleteNotes);
|
|
||||||
|
|
||||||
|
|
||||||
router.get("/getfilename", Notescontroller.readLogFileName);
|
|
||||||
|
|
||||||
router.post("/readlogs", Notescontroller.readLogFile);
|
|
||||||
|
|
||||||
router.get("/view", Notescontroller.viewLandingPage);
|
|
||||||
|
|
||||||
router.post("/deletelog", Notescontroller.deleteLogFile);
|
|
||||||
|
|
||||||
// routes started here
|
// routes started here
|
||||||
app.use('/api', router);
|
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>
|
|
||||||
91
package-lock.json
generated
91
package-lock.json
generated
@ -600,6 +600,7 @@
|
|||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"color-convert": "^2.0.1"
|
"color-convert": "^2.0.1"
|
||||||
},
|
},
|
||||||
@ -608,6 +609,7 @@
|
|||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"color-name": "~1.1.4"
|
"color-name": "~1.1.4"
|
||||||
}
|
}
|
||||||
@ -615,7 +617,8 @@
|
|||||||
"color-name": {
|
"color-name": {
|
||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -922,6 +925,7 @@
|
|||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-styles": "^4.1.0",
|
"ansi-styles": "^4.1.0",
|
||||||
"supports-color": "^7.1.0"
|
"supports-color": "^7.1.0"
|
||||||
@ -930,12 +934,14 @@
|
|||||||
"has-flag": {
|
"has-flag": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"supports-color": {
|
"supports-color": {
|
||||||
"version": "7.2.0",
|
"version": "7.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"has-flag": "^4.0.0"
|
"has-flag": "^4.0.0"
|
||||||
}
|
}
|
||||||
@ -1249,14 +1255,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
"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": {
|
"emoji-regex": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
@ -1404,32 +1402,6 @@
|
|||||||
"moment": "^2.29.1"
|
"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": {
|
"fill-range": {
|
||||||
"version": "7.0.1",
|
"version": "7.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||||
@ -1493,11 +1465,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
"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": {
|
"fs-constants": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||||
@ -1968,24 +1935,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
"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": {
|
"js-yaml": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||||
@ -2605,15 +2554,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
|
"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": {
|
"path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
@ -3494,21 +3434,6 @@
|
|||||||
"prepend-http": "^2.0.0"
|
"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": {
|
"util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
|||||||
@ -13,12 +13,9 @@
|
|||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"ejs": "^3.1.9",
|
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"fs": "0.0.1-security",
|
|
||||||
"log4js": "^6.3.0",
|
"log4js": "^6.3.0",
|
||||||
"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",
|
||||||
|
|||||||
23
server.js
23
server.js
@ -1,11 +1,6 @@
|
|||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
const app = express();
|
const app = express()
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
//logger
|
|
||||||
const {logMsg} = require('./app/services/logger.js');
|
|
||||||
|
|
||||||
//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")
|
||||||
@ -13,18 +8,13 @@ app.use(function(req, res, next) {
|
|||||||
res.set("Expires", 0)
|
res.set("Expires", 0)
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
const {logMsg} = require('./app/services/logger.js');
|
||||||
|
|
||||||
//body-parser
|
|
||||||
const bodyParser = require('body-parser')
|
|
||||||
app.use(bodyParser.json({ limit: '50mb' }));
|
|
||||||
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
|
|
||||||
|
|
||||||
app.set('views', path.join(__dirname, 'app\\views'));
|
|
||||||
app.set('view engine', 'ejs');
|
|
||||||
|
|
||||||
//swagger
|
|
||||||
const swaggerJsdoc = require('swagger-jsdoc');
|
const swaggerJsdoc = require('swagger-jsdoc');
|
||||||
const swaggerUi = require('swagger-ui-express');
|
const swaggerUi = require('swagger-ui-express');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
definition: {
|
definition: {
|
||||||
openapi: '3.0.0',
|
openapi: '3.0.0',
|
||||||
@ -35,8 +25,11 @@ const options = {
|
|||||||
},
|
},
|
||||||
apis: ['./app/routes/routes.js'], // files containing annotations as above
|
apis: ['./app/routes/routes.js'], // files containing annotations as above
|
||||||
};
|
};
|
||||||
|
|
||||||
const swaggerDocument = swaggerJsdoc(options);
|
const swaggerDocument = swaggerJsdoc(options);
|
||||||
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /:
|
* /:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user