diff --git a/.env b/.env index b8dd40d..f289b13 100644 --- a/.env +++ b/.env @@ -2,7 +2,7 @@ DB_PORT = 3306 DB_HOST=elder.cetbof2tejqh.us-west-2.rds.amazonaws.com DB_USER=admin DB_PASS=vwFB.T{*rBOb -MYSQL_DB=elder +MYSQL_DB=eldernew APP_PORT=3000 JSONSALTA=hbn111 -JSONRSALTA=hbn1112 +JSONRSALTA=hbn1112 \ No newline at end of file diff --git a/GroupProject11_backend.zip b/GroupProject11_backend.zip new file mode 100644 index 0000000..b93c71a Binary files /dev/null and b/GroupProject11_backend.zip differ diff --git a/api/agent/agent.conrollers.js b/api/agent/agent.conrollers.js index 7e55c89..f614b0f 100644 --- a/api/agent/agent.conrollers.js +++ b/api/agent/agent.conrollers.js @@ -1,9 +1,12 @@ const { getAgentByAgentID, + getAgentByElderID, + getQulifyAgentByElderID, getAgent, createAgent, updateAgent, deleteAgent, + updateDisqulifyAgent, } = require("./agent.services"); const { sign } = require("jsonwebtoken"); @@ -30,6 +33,44 @@ module.exports = { }); }); }, + getAgentByElderID: (req, res) => { + const elder_id = req.params.elder_id; + getAgentByElderID(elder_id, (err, results) => { + if (err) { + console.log(err); + return; + } + if (!results) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + return res.json({ + success: 1, + data: results, + }); + }); + }, + getQulifyAgentByElderID: (req, res) => { + const elder_id = req.auth.result.id; + getQulifyAgentByElderID(elder_id, (err, results) => { + if (err) { + console.log(err); + return; + } + if (!results) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + return res.json({ + success: 1, + data: results, + }); + }); + }, getAgent: (req, res) => { // console.log(req.auth); @@ -63,6 +104,7 @@ module.exports = { }, createAgent: (req, res) => { const body = req.body; + //req.body.elder_id = req.auth.result.id; createAgent(body, (err, result) => { if (err) { console.log(err); @@ -77,9 +119,98 @@ module.exports = { }); }); }, - updateAgent: (req, res) => { + + updateCorrectAgent: (req, res) => { + const eid = req.body.elder_id; + getAgentByElderID(eid, (err, resultsA) => { + if (err) { + console.log(err); + return; + } + if (!resultsA) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + if (resultsA.agent_id != req.body.agent_id) { + deleteAgent(resultsA, (error, results) => { + if (error) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "database Connection error", + }); + } + if (!results) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + + const body = { + added_gramanildari_id: req.auth.result.id, + gramaniladari_verify_comment: req.body.gramaniladari_verify_comment, + agent_id: req.body.agent_id, + }; + updateAgent(body, (err, results) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection error", + }); + } + + if (!results) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + + return res.status(200).json({ + success: 1, + message: "Delete and Updated Succecfully", + data: results, + }); + }); + }); + } else { + const body = { + added_gramanildari_id: req.auth.result.id, + gramaniladari_verify_comment: req.body.gramaniladari_verify_comment, + agent_id: req.body.agent_id, + }; + updateAgent(body, (err, results) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection error", + }); + } + + if (!results) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + + return res.status(200).json({ + success: 1, + message: "Updated Succecfully", + data: results, + }); + }); + } + }); + }, + updateDisqulifyAgent: (req, res) => { const body = req.body; - updateAgent(body, (err, results) => { + updateDisqulifyAgent(body, (err, results) => { if (err) { console.log(err); return res.status(500).json({ @@ -102,6 +233,7 @@ module.exports = { }); }); }, + deleteAgent: (req, res) => { const body = req.body; deleteAgent(body, (error, results) => { diff --git a/api/agent/agent.routers.js b/api/agent/agent.routers.js index 10419b4..0c64423 100644 --- a/api/agent/agent.routers.js +++ b/api/agent/agent.routers.js @@ -1,18 +1,25 @@ const router = require("express").Router(); const { getAgentByAgentID, + getAgentByElderID, + getQulifyAgentByElderID, getAgent, createAgent, - updateAgent, + updateCorrectAgent, deleteAgent, + updateDisqulifyAgent } = require("./agent.conrollers"); const { checkToken } = require("../../auth/token_validation"); +router.get("/qulify", checkToken, getQulifyAgentByElderID); +router.get("/elder/:elder_id", checkToken, getAgentByElderID); +router.get("/aid/:elder_id", checkToken, getAgentByAgentID); router.post("/", checkToken, createAgent); router.get("/", checkToken, getAgent); -router.get("/:elder_id", checkToken, getAgentByAgentID); -router.patch("/", checkToken, updateAgent); + +router.patch("/disq", checkToken, updateDisqulifyAgent); +router.patch("/", checkToken, updateCorrectAgent); router.delete("/", checkToken, deleteAgent); module.exports = router; diff --git a/api/agent/agent.services.js b/api/agent/agent.services.js index 1512816..cca5b2b 100644 --- a/api/agent/agent.services.js +++ b/api/agent/agent.services.js @@ -2,7 +2,31 @@ const pool = require("../../config/database"); module.exports = { getAgentByAgentID: (elder_id, callBack) => { pool.query( - "SELECT * FROM `agent` WHERE `agent_id` =?", + "SELECT * FROM `agent` WHERE `is_deleted` = '0' AND`agent_id` =?", + [elder_id], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results[0]); + } + ); + }, + getAgentByElderID: (elder_id, callBack) => { + pool.query( + "SELECT * FROM `agent` WHERE `elder_id` =? AND `is_deleted` = 0", + [elder_id], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results[0]); + } + ); + }, + getQulifyAgentByElderID: (elder_id, callBack) => { + pool.query( + "SELECT * FROM `agent` WHERE `agent_is_avilable`='1' AND `added_gramanildari_id` IS NOT NULL AND `elder_id` =? AND `is_deleted` = 0", [elder_id], (error, results, fields) => { if (error) { @@ -26,7 +50,7 @@ module.exports = { }, createAgent: (data, callBack) => { pool.query( - "INSERT INTO `agent`( `elder_id`, `name`, `nic`, `address`, `phone`, `email`,`relation_with_elder`) VALUES (?, ?, ?, ?, ?, ? , ?)", + "INSERT INTO `agent`( `elder_id`, `name`, `nic`, `address`, `phone`, `email`,`pic`,`relation_with_elder`) VALUES (?, ?, ?, ?, ?, ? ,?, ?)", [ data.elder_id, data.name, @@ -34,6 +58,7 @@ module.exports = { data.address, data.phone, data.email, + data.pic, data.relation_with_elder, ], (error, results, fields) => { @@ -46,15 +71,10 @@ module.exports = { }, updateAgent: (data, callBack) => { pool.query( - "UPDATE `agent` SET `elder_id`=?,`name`=?,`nic`=?,`address`=?,`phone`=?,`email`=? ,`relation_with_elder`=? WHERE `agent_id`=?", + "UPDATE `agent` SET `agent_is_avilable`='1',`added_gramanildari_id`=?, `gramaniladari_verify_comment`=? WHERE `agent_id`=?", [ - data.elder_id, - data.name, - data.nic, - data.address, - data.phone, - data.email, - data.relation_with_elder, + data.added_gramanildari_id, + data.gramaniladari_verify_comment, data.agent_id, ], (error, results, fields) => { @@ -65,6 +85,21 @@ module.exports = { } ); }, + updateDisqulifyAgent: (data, callBack) => { + pool.query( + "UPDATE `agent` SET `agent_is_avilable`='0', `gramaniladari_verify_comment`=? WHERE `agent_id`=?", + [ + data.gramaniladari_verify_comment, + data.agent_id + ], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + }, deleteAgent: (data, callBack) => { pool.query( "UPDATE `agent` SET `is_deleted`='1' WHERE `agent_id`=?", diff --git a/api/application.rar b/api/application.rar deleted file mode 100644 index b266518..0000000 Binary files a/api/application.rar and /dev/null differ diff --git a/api/application/application.controller.js b/api/application/application.controller.js index d5ac849..c61519f 100644 --- a/api/application/application.controller.js +++ b/api/application/application.controller.js @@ -1,20 +1,22 @@ - - const { - getApplicationStatus, - getApplicationsForFofficer, - selectApplicaton, - getSelectedApplicationsForFofficer, - removeApplicaton, - completeApplication - } = require("./application.service"); - const {insertMarks,insertFinalMarks} = require("../marks/marks.service"); - const { checkPermision } = require("../../auth/roleauth"); + getApplicationStatus, + getApplicationsForFofficer, + selectApplicaton, + getSelectedApplicationsForFofficer, + removeApplicaton, + completeApplication, + getAppliationDHead, + verifyApplicationByHead, + refreshPrirityList, + getGramacomment +} = require("./application.service"); +const { insertMarks, insertFinalMarks } = require("../marks/marks.service"); +const { checkPermision } = require("../../auth/roleauth"); module.exports = { getApplicationStatus: (req, res) => { - const elder_id = req.auth.result.user_id; - getApplicationStatus(elder_id, (err, results) => { + const elder_id = req.auth.result.id; + getApplicationStatus(elder_id, (err, results) => { if (err) { console.log(err); return; @@ -29,212 +31,249 @@ module.exports = { if (results.validity_by_gramaniladari == 0) { return res.json({ success: 1, - presentage:0, - correction:results.correction, - title:"elder.gramaniladari" + presentage: 0, + correction: results.correction, + title: "elder.gramaniladari", }); } if (results.validity_by_divisional_officer == 0) { return res.json({ success: 1, - presentage:20, - correction:results.correction, - title:"elder.divisional_officer" + presentage: 20, + correction: results.correction, + title: "elder.divisional_officer", }); } if (results.validity_by_divisional_head == 0) { return res.json({ success: 1, - presentage:70, - correction:results.correction, - title:"elder.divisional_head" + presentage: 70, + correction: results.correction, + title: "elder.divisional_head", }); } - if (results.validity_by_divisional_head == 1) { return res.json({ success: 1, - presentage:100, - title:"elder.divisional_head" + presentage: 100, + title: "elder.divisional_head", }); } if (results.validity_by_divisional_officer == 1) { return res.json({ success: 1, - presentage:70, - title:"elder.divisional_officer" + presentage: 70, + title: "elder.divisional_officer", }); } if (results.validity_by_gramaniladari == 1) { return res.json({ success: 1, - presentage:20, - title:"elder.gramaniladari" + presentage: 20, + title: "elder.gramaniladari", }); } -z + return res.json({ success: 1, - presentage:0 + presentage: 0, }); }); }, - getAppliationDofficer: (req, res) => { - const page = req.query.page - const per_page =req.query.per_page - const limitf=((page-1)*per_page)+1 - const limitl=page*per_page - checkPermision( {role_id: req.auth.result.role_id,cap_id: 21,}, (err, results) => { - if (err) { - console.log(err); - } - if (!results) { - return res.json({ - success: 0, - error: "Unauthorized access", - }); - } - }); - let divitionalid = new Promise((resolove, reject) => { - getApplicationsForFofficer(req.auth.result.id,limitf,limitl,req.query.grama_division, (err,results,count) =>{ - if (err){ + getAppliationDofficer: (req, res) => { + const page = req.query.page; + const per_page = req.query.per_page; + const limitf = (page - 1) * per_page + 1; + const limitl = page * per_page; + checkPermision( + { role_id: req.auth.result.role_id, cap_id: 21 }, + (err, results) => { + if (err) { console.log(err); - reject(err) - } - if(!results){ - reject("ERROR NO USER DATA") } - //pagenation - //console.log(results) - let data={}; - let last_page=Math.floor(count/req.query.per_page) - if(last_page === 0){ - last_page=1; + if (!results) { + return res.json({ + success: 0, + error: "Unauthorized access", + }); } - let prev_page_url = req.protocol + "://" + req.get('host') + req.originalUrl; - let next_page_url=prev_page_url; - if(req.query.page !=1){ - next_page_url=req.protocol + "://" + req.get('host') + req.baseUrl+req._parsedUrl.pathname +"?"+"page="+(parseInt(req.query.page)+1)+"&"+"per_page="+per_page ; + } + ); + let divitionalid = new Promise((resolove, reject) => { + getApplicationsForFofficer( + req.auth.result.id, + limitf, + limitl, + req.query.grama_division, + (err, results, count) => { + if (err) { + console.log(err); + reject(err); + } + if (!results) { + reject("ERROR NO USER DATA"); + } + //pagenation + //console.log(results) + let data = {}; + let last_page = Math.floor(count / req.query.per_page); + if (last_page === 0) { + last_page = 1; + } + let prev_page_url = + req.protocol + "://" + req.get("host") + req.originalUrl; + let next_page_url = prev_page_url; + if (req.query.page != 1) { + next_page_url = + req.protocol + + "://" + + req.get("host") + + req.baseUrl + + req._parsedUrl.pathname + + "?" + + "page=" + + (parseInt(req.query.page) + 1) + + "&" + + "per_page=" + + per_page; + } + data.next_page_url = next_page_url; + data.prev_page_url = prev_page_url; + data.total = count; + data.last_page = last_page; + data.from = limitf; + data.to = limitl; + data.results = results; + //console.log(data) + resolove(data); } - data.next_page_url=next_page_url - data.prev_page_url=prev_page_url - data.total=count; - data.last_page=last_page - data.from=limitf - data.to=limitl - data.results=results - //console.log(data) - resolove(data); - }); + ); }); - - divitionalid.then((dat) =>{ - - return res.json({ - status: true, - next_page_url:dat.next_page_url, - prev_page_url:dat.prev_page_url, - total:dat.total, - last_page:dat.last_page, - from:dat.from, - to:dat.to, - data:dat.results - - }); - }).catch((error) =>{console.log(error)}); - - - - - }, - getSelectedAppliationDofficer: (req, res) => { - const page = req.query.page - const per_page =req.query.per_page - const limitf=((page-1)*per_page)+1 - const limitl=page*per_page - checkPermision( {role_id: req.auth.result.role_id,cap_id: 21,}, (err, results) => { - if (err) { - console.log(err); - } - if (!results) { + divitionalid + .then((dat) => { return res.json({ - success: 0, - error: "Unauthorized access", + status: true, + next_page_url: dat.next_page_url, + prev_page_url: dat.prev_page_url, + total: dat.total, + last_page: dat.last_page, + from: dat.from, + to: dat.to, + data: dat.results, }); - } - }); - let divitionalid = new Promise((resolove, reject) => { - - getSelectedApplicationsForFofficer(req.auth.result.id,limitf,limitl,req.query.grama_division, (err,results,count) =>{ - if (err){ + }) + .catch((error) => { + console.log(error); + }); + }, + getSelectedAppliationDofficer: (req, res) => { + const page = req.query.page; + const per_page = req.query.per_page; + const limitf = (page - 1) * per_page + 1; + const limitl = page * per_page; + checkPermision( + { role_id: req.auth.result.role_id, cap_id: 21 }, + (err, results) => { + if (err) { console.log(err); - reject(err) - } - if(!results){ - reject("ERROR NO USER DATA") } - //pagenation - //console.log(results) - let data={}; - let last_page=Math.floor(count/req.query.per_page) - if(last_page === 0){ - last_page=1; + if (!results) { + return res.json({ + success: 0, + error: "Unauthorized access", + }); } - let prev_page_url = req.protocol + "://" + req.get('host') + req.originalUrl; - let next_page_url=prev_page_url; - if(req.query.page !=1){ - next_page_url=req.protocol + "://" + req.get('host') + req.baseUrl+req._parsedUrl.pathname +"?"+"page="+(parseInt(req.query.page)+1)+"&"+"per_page="+per_page ; + } + ); + let divitionalid = new Promise((resolove, reject) => { + getSelectedApplicationsForFofficer( + req.auth.result.id, + limitf, + limitl, + req.query.grama_division, + (err, results, count) => { + if (err) { + console.log(err); + reject(err); + } + if (!results) { + reject("ERROR NO USER DATA"); + } + //pagenation + //console.log(results) + let data = {}; + let last_page = Math.floor(count / req.query.per_page); + if (last_page === 0) { + last_page = 1; + } + let prev_page_url = + req.protocol + "://" + req.get("host") + req.originalUrl; + let next_page_url = prev_page_url; + if (req.query.page != 1) { + next_page_url = + req.protocol + + "://" + + req.get("host") + + req.baseUrl + + req._parsedUrl.pathname + + "?" + + "page=" + + (parseInt(req.query.page) + 1) + + "&" + + "per_page=" + + per_page; + } + data.next_page_url = next_page_url; + data.prev_page_url = prev_page_url; + data.total = count; + data.last_page = last_page; + data.from = limitf; + data.to = limitl; + data.results = results; + //console.log(data) + resolove(data); } - data.next_page_url=next_page_url - data.prev_page_url=prev_page_url - data.total=count; - data.last_page=last_page - data.from=limitf - data.to=limitl - data.results=results - //console.log(data) - resolove(data); - }); + ); }); - - divitionalid.then((dat) =>{ - //console.log(dat) - // console.log(req.auth); - return res.json({ - status: true, - next_page_url:dat.next_page_url, - prev_page_url:dat.prev_page_url, - total:dat.total, - last_page:dat.last_page, - from:dat.from, - to:dat.to, - data:dat.results - - }); - }).catch((error) =>{console.log(error)}); - - - - - }, - selectApplicaton: (req, res) => { - checkPermision( {role_id: req.auth.result.role_id,cap_id: 22,}, (err, results) => { - if (err) { - console.log(err); - } - if (!results) { + divitionalid.then((dat) => { + //console.log(dat) + // console.log(req.auth); return res.json({ - success: 0, - error: "Unauthorized access", + status: true, + next_page_url: dat.next_page_url, + prev_page_url: dat.prev_page_url, + total: dat.total, + last_page: dat.last_page, + from: dat.from, + to: dat.to, + data: dat.results, }); + }) + .catch((error) => { + console.log(error); + }); + }, + selectApplicaton: (req, res) => { + checkPermision( + { role_id: req.auth.result.role_id, cap_id: 22 }, + (err, results) => { + if (err) { + console.log(err); + } + if (!results) { + return res.json({ + success: 0, + error: "Unauthorized access", + }); + } } - }); + ); const vid = req.params.vid; - selectApplicaton(vid,req.auth.result.id, (err, results) => { + selectApplicaton(vid, req.auth.result.id, (err, results) => { if (err) { console.log(err); return; @@ -245,20 +284,22 @@ z message: "updated successfully", }); }); - }, removeApplicaton: (req, res) => { - checkPermision( {role_id: req.auth.result.role_id,cap_id: 22,}, (err, results) => { - if (err) { - console.log(err); - } - if (!results) { - return res.json({ - success: 0, - error: "Unauthorized access", - }); + checkPermision( + { role_id: req.auth.result.role_id, cap_id: 22 }, + (err, results) => { + if (err) { + console.log(err); + } + if (!results) { + return res.json({ + success: 0, + error: "Unauthorized access", + }); + } } - }); + ); const vid = req.params.vid; removeApplicaton(vid, (err, results) => { if (err) { @@ -271,84 +312,250 @@ z message: "updated successfully", }); }); - }, - submitApplicationReview:(req,res) =>{ - checkPermision( {role_id: req.auth.result.role_id,cap_id: 22,}, (err, results) => { - if (err) { - console.log(err); + submitApplicationReview: (req, res) => { + checkPermision( + { role_id: req.auth.result.role_id, cap_id: 22 }, + (err, results) => { + if (err) { + console.log(err); + } + if (!results) { + return res.json({ + success: 0, + error: "Unauthorized access", + }); + } } - if (!results) { - return res.json({ - success: 0, - error: "Unauthorized access", - }); - } - }); - const app=req.body; - const dataarr=app.data - let total=null - dataarr.forEach(element => { - if(!element.marks){ + ); + const app = req.body; + const dataarr = app.data; + let total = null; + dataarr.forEach((element) => { + if (!element.marks) { return res.json({ success: 0, error: element, }); } - total=total+element.marks; + total = total + element.marks; }); let insMarks = new Promise((resolove, reject) => { - - insertMarks(app.vid,dataarr, (err,results) =>{ - if(err){ - reject(err); - } - resolove(results) - - }); - + insertMarks(app.vid, dataarr, (err, results) => { + if (err) { + reject(err); + } + resolove(results); + }); }); let insFinalMarks = new Promise((resolove, reject) => { - avg=(total/dataarr.length) - - insertFinalMarks(app.vid,avg*10,(err,results) =>{ - if(err){ + avg = total / dataarr.length; + + insertFinalMarks(app.vid, avg * 10, (err, results) => { + if (err) { reject(err); } - resolove(results) - + resolove(results); }); - - }); let compApplication = new Promise((resolove, reject) => { completeApplication(app.vid, (err, results) => { if (err) { reject(err); } - resolove(results) + resolove(results); + }); + }); + + insMarks + .then((dat) => { + insFinalMarks + .then((dat1) => { + compApplication + .then((dat2) => { + return res.json({ + success: 1, + message: "updated successfully", + }); + }) + .catch((error) => { + console.log("errmk" + error); + }); + }) + .catch((error) => { + console.log("errmk" + error); + }); + }) + .catch((error) => { + console.log("errmk" + error); }); - + }, + getAppliationDHead: (req, res) => { + const page = req.query.page; + const per_page = req.query.per_page; + const limitf = (page - 1) * per_page + 1; + const limitl = page * per_page; + //did not set permision + checkPermision( + { role_id: req.auth.result.role_id, cap_id: 21 }, + (err, results) => { + if (err) { + console.log(err); + } + if (!results) { + return res.json({ + success: 0, + error: "Unauthorized access", + }); + } + } + ); + let divitionalid = new Promise((resolove, reject) => { + getAppliationDHead( + req.auth.result.id, + limitf, + limitl, + req.query.grama_division, + (err, results, count) => { + if (err) { + console.log(err); + reject(err); + } + if (!results) { + reject("ERROR NO USER DATA"); + } + //pagenation + //console.log(results) + let data = {}; + let last_page = Math.floor(count / req.query.per_page); + if (last_page === 0) { + last_page = 1; + } + let prev_page_url = + req.protocol + "://" + req.get("host") + req.originalUrl; + let next_page_url = prev_page_url; + if (req.query.page != 1) { + next_page_url = + req.protocol + + "://" + + req.get("host") + + req.baseUrl + + req._parsedUrl.pathname + + "?" + + "page=" + + (parseInt(req.query.page) + 1) + + "&" + + "per_page=" + + per_page; + } + data.next_page_url = next_page_url; + data.prev_page_url = prev_page_url; + data.total = count; + data.last_page = last_page; + data.from = limitf; + data.to = limitl; + data.results = results; + //console.log(data) + resolove(data); + } + ); }); - insMarks.then((dat) =>{ - insFinalMarks.then((dat1) =>{ - compApplication.then((dat2) =>{ + divitionalid + .then((dat) => { + return res.json({ + status: true, + next_page_url: dat.next_page_url, + prev_page_url: dat.prev_page_url, + total: dat.total, + last_page: dat.last_page, + from: dat.from, + to: dat.to, + data: dat.results, + }); + }) + .catch((error) => { + console.log(error); + }); + }, + verifyApplicationByHead: (req, res) => { + // checkPermision( + // { role_id: req.auth.result.role_id, cap_id: 22 }, + // (err, results) => { + // if (err) { + // console.log(err); + // } + // if (!results) { + // return res.json({ + // success: 0, + // error: "Unauthorized access", + // }); + // } + // } + // ); + const vid = req.params.vid; + const divheadid = req.auth.result.user_id; - + verifyApplicationByHead(vid,divheadid, (err, results) => { + if (err) { + console.log(err); + return; + } + refreshPrirityList("G1", (err, results) => { + if (err) { + console.log(err); + return; + } + console.log(results); return res.json({ success: 1, message: "updated successfully", }); + }); + }); + }, + refreshPrirityList: (req, res) => { + // checkPermision( + // { role_id: req.auth.result.role_id, cap_id: 22 }, + // (err, results) => { + // if (err) { + // console.log(err); + // } + // if (!results) { + // return res.json({ + // success: 0, + // error: "Unauthorized access", + // }); + // } + // } + // ); + + refreshPrirityList("G1", (err, results) => { + if (err) { + console.log(err); + return; + } + return res.json({ + success: 1, + message: results, + }); + }); + }, + getGramacomment: (req, res) => { + const vid = req.params.vid; + getGramacomment(vid, (err, results) => { + if (err) { + console.log(err); + return; + } - - }).catch((error) =>{console.log("errmk"+error)}); - }).catch((error) =>{console.log("errmk"+error)}); - - }).catch((error) =>{console.log("errmk"+error)}); - - + return res.json({ + success: 1, + message: results.gc, + }); + }); }, + }; diff --git a/api/application/application.router.js b/api/application/application.router.js index 9131cc3..bd2030b 100644 --- a/api/application/application.router.js +++ b/api/application/application.router.js @@ -5,7 +5,11 @@ const { selectApplicaton, getSelectedAppliationDofficer, removeApplicaton, - submitApplicationReview + submitApplicationReview, + getAppliationDHead, + verifyApplicationByHead, + refreshPrirityList, + getGramacomment } = require("./application.controller"); const { checkToken } = require("../../auth/token_validation"); @@ -14,7 +18,10 @@ router.get("/dappdetails", checkToken, getAppliationDofficer); router.get("/dsappdetails", checkToken, getSelectedAppliationDofficer); router.patch("/selectapplicaton/:vid", checkToken, selectApplicaton); router.patch("/removeapplicaton/:vid", checkToken, removeApplicaton); - +router.get("/dhappdetails", checkToken, getAppliationDHead); +router.get("/verifydhead/:vid", checkToken, verifyApplicationByHead); +router.get("/priority", refreshPrirityList); +router.get("/gramanildharicomment/:vid", getGramacomment); router.post("/applicationreview", checkToken, submitApplicationReview); diff --git a/api/application/application.service.js b/api/application/application.service.js index 2614c4e..31ef0f2 100644 --- a/api/application/application.service.js +++ b/api/application/application.service.js @@ -21,7 +21,6 @@ module.exports = { [elder_id], (error, results, fields) => { if (error) { - console.log(results); return callBack(error); } return callBack(null, results[0]); @@ -129,7 +128,6 @@ module.exports = { } ); }, - removeApplicaton: (vid, callBack) => { pool.query( `UPDATE verification_of_elders SET divisional_officer_id = NULL WHERE vid=?`, @@ -140,7 +138,6 @@ module.exports = { if (error) { return callBack(error); } - console.log(vid) return callBack(null, results[0]); } ); @@ -155,18 +152,158 @@ module.exports = { if (error) { return callBack(error); } - console.log(vid) return callBack(null, results[0]); } ); }, + getAppliationDHead: (officer_id,limitf,limitl,grama_division, callBack) => { + if(grama_division){ + sqlc= `SELECT COUNT(verification_of_elders.elder_id) AS total FROM verification_of_elders,elder where elder.elder_id IN( SELECT elder_id FROM elder WHERE divisional_secratory_id IN( SELECT divisional_secratary_id FROM divisional_secratory_officer WHERE officer_id=?) ) AND validity_by_divisional_head IS NULL AND validity_by_divisional_officer=1 AND elder.elder_id = verification_of_elders.elder_id` + sql=`SELECT verification_of_elders.vid,verification_of_elders.elder_id,elder.name,elder.gramaniladari_division_id FROM verification_of_elders,elder where elder.elder_id IN( SELECT elder_id FROM elder WHERE gramaniladari_division_id=${grama_division} AND divisional_secratory_id IN( SELECT divisional_secratary_id FROM divisional_secratory_officer WHERE officer_id=?) ) AND validity_by_divisional_head IS NULL AND validity_by_divisional_officer=1 AND elder.elder_id = verification_of_elders.elder_id LIMIT ?,?` + } + else{ + sqlc= `SELECT COUNT(verification_of_elders.elder_id) AS total FROM verification_of_elders,elder where elder.elder_id IN( SELECT elder_id FROM elder WHERE divisional_secratory_id IN( SELECT divisional_secratary_id FROM divisional_secratory_officer WHERE officer_id=?) ) AND validity_by_divisional_head IS NULL AND validity_by_divisional_officer=1 AND elder.elder_id = verification_of_elders.elder_id` + sql=`SELECT verification_of_elders.vid,verification_of_elders.elder_id,elder.name,elder.gramaniladari_division_id FROM verification_of_elders,elder where elder.elder_id IN( SELECT elder_id FROM elder WHERE divisional_secratory_id IN( SELECT divisional_secratary_id FROM divisional_secratory_officer WHERE officer_id=?) ) AND validity_by_divisional_head IS NULL AND validity_by_divisional_officer=1 AND elder.elder_id = verification_of_elders.elder_id LIMIT ?,?` + } + pool.query( + sqlc + , + [officer_id], + (error, count, fields) => { + if (error) { + return callBack(error); + //return callBack(error); + } + //second + + pool.query( + sql + , + [officer_id,limitf-1,limitl-1], + (error, results, fields) => { + if (error) { + return callBack(error); + //return callBack(error); + } + return callBack(null,results, count[0].total); + // return callBack(null, results[0]); + + } + ); + + // return callBack(null, results[0]); + + } + ); + }, + verifyApplicationByHead: (vid,divheadid, callBack) => { + pool.query( + `UPDATE verification_of_elders SET divisional_head_id=? ,validity_by_divisional_head=1 WHERE vid=?`, + [ + divheadid, + vid + ], + (error, results, fields) => { + if (error) { + return callBack(error); + } + console.log(results) + return callBack(null, results[0]); + } + ); + }, + refreshPrirityList: (divisionalid, callBack) => { + pool.query( + `SELECT count_of_benifishers_elders AS count FROM divisional_secratory_office WHERE divisional_secratary_id=?` + , + [divisionalid], + (error, count, fields) => { + if (error) { + return callBack(error); + //return callBack(error); + } + + //second + sql=`SELECT COUNT(*) AS tot FROM benifesher WHERE is_deleted=0 AND divisional_sec =?` + pool.query(sql,[divisionalid], + (error, tot, fields) => { + if (error) { + return callBack(error); + } + c=count[0].count-tot[0].tot + if(c>0){ + sqla=`SELECT elder.elder_id,elder.divisional_secratory_id,finalmarks.final_marks FROM elder,verification_of_elders,finalmarks WHERE + elder.elder_id=verification_of_elders.elder_id AND verification_of_elders.vid=finalmarks.v_id AND verification_of_elders.validity_by_divisional_head=1 AND elder.divisional_secratory_id=? and elder.elder_id NOT IN(SELECT benifesher.elder_id from benifesher) ORDER BY finalmarks.final_marks DESC,finalmarks.added ASC LIMIT ?` + pool.query(sqla, [divisionalid,c], + (error, data, fields) => { + if (error) { + return callBack(error); + //return callBack(error); + } + if(data.length==0){ + return callBack(null,"wow") + + } + arr=[]; + sqlv="INSERT INTO benifesher(elder_id, divisional_sec) VALUES (?,?)" + i=0; + data.forEach(element => { + if(i==1){ + sqlv +=",(?,?)" ; + } + arr.push(element.elder_id) + arr.push(element.divisional_secratory_id) + i=1 + }); + pool.query(sqlv, arr, + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null,results); + } + ); + + + } + ); + - + } + //return callBack(null,0); + + + + + } + ); + + + + + } + ); + }, + getGramacomment: (vid, callBack) => { + pool.query( + `SELECT gramaniladari_comment AS gc FROM verification_of_elders WHERE vid=?`, + [vid], + (error, results, fields) => { + if (error) { + //console.log(results); + return callBack(error); + } + return callBack(null, results[0]); + } + ); + }, + + diff --git a/api/deaths_complains/deaths_complains.controllers.js b/api/deaths_complains/deaths_complains.controllers.js index 8fc58d1..802c36c 100644 --- a/api/deaths_complains/deaths_complains.controllers.js +++ b/api/deaths_complains/deaths_complains.controllers.js @@ -3,7 +3,11 @@ const { informDeath, sendComplain, getDeaths, - getComplains + getComplains, + sendPostComplain, + getPostComplains, + updateDeath, + updateComplain } = require("./deaths_complains.services"); @@ -43,6 +47,22 @@ module.exports = { }); }); }, + sendPostComplain: (req, res) => { + const body = req.body; + sendPostComplain(body, (error, results) => { + if (error) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Database Connection error ", + }); + } + return res.status(200).json({ + success: 1, + data: results, + }); + }); + }, getDeaths: (req, res) => { getDeaths( (err, results) => { if(err){ @@ -72,5 +92,85 @@ module.exports = { data: results, }); }); - } + }, + getPostComplains: (req, res) => { + getPostComplains( (err, results) => { + if(err){ + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection error ", + }); + } + return res.status(200).json({ + success: 1, + status: true, + total: 5, + last_page: 1, + per_page: 8, + current_page: 1, + next_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + prev_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + from: 1, + to: 8, + data: results, + }); + }); + }, + updateDeath: (req, res) => { + + updateDeath(elder_id, (err, result) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + + if (!result) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + + return res.status(200).json({ + success: 1, + message: "Updated SuccesFully", + data: result, + }); + }); + }, + updateComplain: (req, res) => { + const body = { + viewed_officer_id : req.auth.result.id, + elder_id : req.params.id + }; + console.log(body); + updateComplain(body, (err, result) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + + if (!result) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + + return res.status(200).json({ + success: 1, + message: "Updated SuccesFully", + data: result, + }); + }); + }, }; diff --git a/api/deaths_complains/deaths_complains.routers.js b/api/deaths_complains/deaths_complains.routers.js index 32d475f..c189046 100644 --- a/api/deaths_complains/deaths_complains.routers.js +++ b/api/deaths_complains/deaths_complains.routers.js @@ -4,15 +4,22 @@ const { informDeath, sendComplain, getDeaths, - getComplains + getComplains, + sendPostComplain, + getPostComplains, + updateDeath, + updateComplain } = require("./deaths_complains.controllers"); const { checkToken } = require("../../auth/token_validation"); router.get("/deaths", checkToken, getDeaths); router.get("/complains", checkToken, getComplains); +router.get("/postcomplains", checkToken, getPostComplains); router.post("/informdeath", checkToken, informDeath); router.post("/sendcomplain", checkToken, sendComplain); - +router.post("/sendpostcomplain", checkToken, sendPostComplain); +router.patch("/:id", checkToken, updateDeath); +router.patch("/comp/:id", checkToken, updateComplain); module.exports = router; diff --git a/api/deaths_complains/deaths_complains.services.js b/api/deaths_complains/deaths_complains.services.js index 1298f2f..421c0b8 100644 --- a/api/deaths_complains/deaths_complains.services.js +++ b/api/deaths_complains/deaths_complains.services.js @@ -36,9 +36,25 @@ module.exports = { } ); }, + sendPostComplain: (data,callBack) => { + pool.query( + "INSERT INTO complains(elder_id,gramaniladari_division_id,post_office_id,viewed_officer_id,complain) VALUES (?,'null',?,'null',?)", + [ + data.elder_id, + data.post_office_id, + data.complain, + ], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + }, getDeaths: (callBack) => { pool.query( - "SELECT elder.name AS ename,gramaniladari_division.name AS gname,inform_death.death_certificate_no,inform_death.death_reason,inform_death.death_date FROM inform_death,gramaniladari_division,elder WHERE inform_death.elder_id = elder.elder_id AND gramaniladari_division.gramaniladari_division_id = inform_death.gramaniladari_division_id AND inform_death.is_view_officer = '0' AND inform_death.is_deleted = '0'", + "SELECT elder.name AS ename,elder.elder_id,gramaniladari_division.name AS gname,inform_death.death_certificate_no,inform_death.death_reason,inform_death.death_date FROM inform_death,gramaniladari_division,elder WHERE inform_death.elder_id = elder.elder_id AND gramaniladari_division.gramaniladari_division_id = inform_death.gramaniladari_division_id AND inform_death.is_view_officer = '0' AND inform_death.is_deleted = '0'", [], (error, results, fields) => { if(error){ @@ -50,7 +66,7 @@ module.exports = { }, getComplains: (callBack) => { pool.query( - "SELECT elder.name AS ename,gramaniladari_division.name AS gname,complains.complain FROM complains,gramaniladari_division,elder WHERE complains.elder_id = elder.elder_id AND complains.gramaniladari_division_id = gramaniladari_division.gramaniladari_division_id AND complains.is_viewed = '0' AND complains.is_deleted = '0'", + "SELECT elder.elder_id,elder.name AS ename,gramaniladari_division.name AS gname,complains.complain FROM complains,gramaniladari_division,elder WHERE complains.elder_id = elder.elder_id AND complains.gramaniladari_division_id = gramaniladari_division.gramaniladari_division_id AND complains.is_viewed = '0' AND complains.is_deleted = '0'", [], (error, results, fields) => { if(error){ @@ -60,4 +76,43 @@ module.exports = { } ); }, + getPostComplains: (callBack) => { + pool.query( + "SELECT elder.elder_id,elder.name AS ename,post_office_table.name AS pname,complains.complain FROM complains,post_office_table,elder WHERE complains.elder_id = elder.elder_id AND complains.post_office_id = post_office_table.post_office_id AND complains.is_viewed = '0' AND complains.is_deleted = '0'", + [], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, results); + } + ); + }, + updateDeath: (elder_id, callBack) => { + pool.query( + "UPDATE inform_death SET is_view_officer='1',is_deleted='1' WHERE elder_id=?", + [ elder_id ], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, results); + } + ); + }, + updateComplain: (data, callBack) => { + pool.query( + "UPDATE complains SET viewed_officer_id=?,is_viewed='1',is_deleted='1' WHERE elder_id=?", + [ + data.viewed_officer_id, + data.elder_id, + ], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, results); + } + ); + }, }; diff --git a/api/divisional-office/divisional-office.conrollers.js b/api/divisional-office/divisional-office.conrollers.js index d2d3a1c..bfa619d 100644 --- a/api/divisional-office/divisional-office.conrollers.js +++ b/api/divisional-office/divisional-office.conrollers.js @@ -7,8 +7,15 @@ const { getApplicationToVerifyByDivision, getDivisionsToSelectBox, getBenifisherListTodiv, + getConstant, + updateConstant, + officeDetails } = require("./divisional-office.services"); +const { + getOfficerByOfficerID +} = require("../divisional_secratary_officer/divisional_officer.service"); + const { sign } = require("jsonwebtoken"); const { checkPermision } = require("../../auth/roleauth"); @@ -200,4 +207,63 @@ module.exports = { }); }); }, + getConstant: (req,res) => { + getConstant((err, result) => { + if (err) { + console.log(err); + return; + } + return res.json({ + success: 1, + data: result, + }); + }); + }, + updateConstant: (req, res) => { + const body = req.body; + updateConstant(body, (err, results) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection error", + }); + } + + if (!results) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + + return res.status(200).json({ + success: 1, + message: "Updated Succecfully", + data: results, + }); + }); + }, + officeDetails: (req,res) => { + const officer_id = req.auth.result.id; + getOfficerByOfficerID(officer_id, (err, result) => { + if (err) { + console.log(err); + return; + } + if(result){ + const office_id = result.divisional_secratary_id; + officeDetails(office_id, (err, resultO) => { + if (err) { + console.log(err); + return; + } + return res.json({ + success: 1, + data: resultO, + }); + }); + } + }); + }, }; diff --git a/api/divisional-office/divisional-office.routers.js b/api/divisional-office/divisional-office.routers.js index 859d454..d940812 100644 --- a/api/divisional-office/divisional-office.routers.js +++ b/api/divisional-office/divisional-office.routers.js @@ -8,18 +8,25 @@ const { getApplicationToVerifyByDivision, getDivisionsToSelectBox, getBenifisherListTodiv, + getConstant, + updateConstant, + officeDetails } = require("./divisional-office.conrollers"); const { checkToken } = require("../../auth/token_validation"); router.get("/selectbox", checkToken, getDivisionsToSelectBox); router.post("/", checkToken, createDivisionalOffice); - +router.get("/office", checkToken, officeDetails); +router.get("/cons", checkToken, getConstant); router.get("/", checkToken, getDivisionalOffices); router.get("/benifisherlist/:off_id", checkToken, getBenifisherListTodiv); router.get("/list/:div_off_id", checkToken, getApplicationToVerifyByDivision); router.get("/:div_off_id", checkToken, getDivisionalOfficeByID); + router.patch("/", checkToken, updateDivisionalOffice); +router.patch("/cons", checkToken, updateConstant); + router.delete("/", checkToken, deleteDivisionalOffice); module.exports = router; diff --git a/api/divisional-office/divisional-office.services.js b/api/divisional-office/divisional-office.services.js index fd182dd..200baee 100644 --- a/api/divisional-office/divisional-office.services.js +++ b/api/divisional-office/divisional-office.services.js @@ -117,4 +117,45 @@ module.exports = { } ); }, + getConstant:(callBack) => { + pool.query( + "SELECT * FROM constants", + [], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, results); + } + ); + }, + updateConstant:(data,callBack) => { + pool.query( + "UPDATE constants SET value=? WHERE name=?", + [ + data.value, + data.name + ], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, results); + } + ); + }, + officeDetails:(office_id,callBack) => { + pool.query( + "SELECT COUNT(post_office_table.post_office_id) AS post,divisional_secratory_office.name,divisional_secratory_office.count_of_benifishers_elders FROM divisional_secratory_office,post_office_table WHERE divisional_secratory_office.divisional_secratary_id = post_office_table.divisional_id AND post_office_table.is_deleted = '0' AND divisional_secratory_office.is_deleted = '0' AND divisional_secratory_office.divisional_secratary_id = ?", + [ + office_id + ], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, results); + } + ); + }, }; diff --git a/api/divisional_secratary_officer/divisional_officer.controller.js b/api/divisional_secratary_officer/divisional_officer.controller.js index cddffe4..905f8da 100644 --- a/api/divisional_secratary_officer/divisional_officer.controller.js +++ b/api/divisional_secratary_officer/divisional_officer.controller.js @@ -4,37 +4,53 @@ const { createOfficers, updateOfficers, deleteOfficers, + getOfficersFromVID, } = require("./divisional_officer.service"); const { create } = require("../officers/officer.service"); +const { createOffUser } = require("../users/user.service"); +const { genSaltSync, hashSync, compareSync } = require("bcrypt"); const { sign } = require("jsonwebtoken"); const { checkPermision } = require("../../auth/roleauth"); module.exports = { createOfficers: (req, res) => { - const bodyDiv = req.body.DivOfficer; - createOfficers(bodyDiv, (errDiv, resultsDiv) => { - if (errDiv) { - console.log(errDiv); + const bodyUser = req.body.User; + console.log(bodyUser.uname); + const salt = genSaltSync(10); + bodyUser.pword = hashSync(bodyUser.pword, salt); + createOffUser(bodyUser, (err, resultsUser) => { + if (err) { + console.log(err); return res.status(500).json({ success: 0, message: "Database Connection Error", }); } - const bodyO = req.body.Officer; - create(bodyO, (errO, resultsO) => { - if (errO) { - console.log(errO); + const bodyDiv = req.body.DivOfficer; + createOfficers(bodyDiv, (errDiv, resultsDiv) => { + if (errDiv) { + console.log(errDiv); return res.status(500).json({ success: 0, message: "Database Connection Error", }); } - return res.status(200).json({ - success: 1, - data: resultsO, + const bodyO = req.body.Officer; + create(bodyO, (errO, resultsO) => { + if (errO) { + console.log(errO); + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + return res.status(200).json({ + success: 1, + data: resultsO, + }); }); }); }); @@ -121,4 +137,23 @@ module.exports = { }); }); }, + getOfficersFromVID: (req, res) => { + const vid = req.params.vid; + getOfficersFromVID(vid, (err, results) => { + if (err) { + console.log(err); + return; + } + if (!results) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + return res.json({ + success: 1, + data: results, + }); + }); + }, }; diff --git a/api/divisional_secratary_officer/divisional_officer.router.js b/api/divisional_secratary_officer/divisional_officer.router.js index bfebd7a..f5c13b2 100644 --- a/api/divisional_secratary_officer/divisional_officer.router.js +++ b/api/divisional_secratary_officer/divisional_officer.router.js @@ -5,6 +5,7 @@ const { getOfficers, updateOfficers, deleteOfficers, + getOfficersFromVID, } = require("./divisional_officer.controller"); const { checkToken } = require("../../auth/token_validation"); @@ -15,5 +16,6 @@ router.get("/:officer_id", checkToken, getOfficerByOfficerID); router.get("/", checkToken, getOfficers); router.patch("/", checkToken, updateOfficers); router.delete("/", checkToken, deleteOfficers); +router.get("/relofficervid/:vid", checkToken, getOfficersFromVID ); module.exports = router; diff --git a/api/divisional_secratary_officer/divisional_officer.service.js b/api/divisional_secratary_officer/divisional_officer.service.js index b7ef68b..66775b2 100644 --- a/api/divisional_secratary_officer/divisional_officer.service.js +++ b/api/divisional_secratary_officer/divisional_officer.service.js @@ -43,7 +43,6 @@ module.exports = { } ); }, - getOfficers: (callBack) => { pool.query( `SELECT * FROM divisional_secratory_officer`, @@ -87,4 +86,16 @@ module.exports = { } ); }, + getOfficersFromVID:(vid, callBack) => { + pool.query( + `SELECT * FROM divisional_secratory_officer WHERE officer_id=?`, + [vid], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results[0]); + } + ); + }, }; diff --git a/api/elders/elder.controller.js b/api/elders/elder.controller.js index 8dd8ffe..53d9545 100644 --- a/api/elders/elder.controller.js +++ b/api/elders/elder.controller.js @@ -6,13 +6,27 @@ const { deleteElders, elderRegistration, elderDetailstoPayId, + getElderDetail, + searchElders + } = require("./elder.service"); const { checkPermision } = require("../../auth/roleauth"); const { createAgent } = require("../agent/agent.services"); +const { create } = require("../users/user.service") const { createverifyFirstElder, + updateverifyElder } = require("../verify_elder/verify_elder.service"); +const { updateIdByUserId } = require("../users/user.service"); + + + +const { genSaltSync, hashSync, compareSync } = require("bcrypt"); + + + + module.exports = { getElderByElderID: (req, res) => { const elder_id = req.params.elder_id; @@ -34,6 +48,26 @@ module.exports = { }); }, + getElderDetail: (req, res) => { + const elder_id = req.auth.result.id; + getElderByElderID(elder_id, (err, results) => { + if (err) { + console.log(err); + return; + } + if (!results) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + return res.json({ + success: 1, + data: results, + }); + }); + }, + elderDetailstoPayId: (req, res) => { const pay_id = req.params.pay_id; elderDetailstoPayId(pay_id, (err, results) => { @@ -53,6 +87,25 @@ module.exports = { }); }); }, + + searchElders: (req, res) => { + const body = req.body; + + searchElders(body, (error, results) => { + if (error) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Database Connection error ", + }); + } + return res.status(200).json({ + success: 1, + data: results, + }); + }); + }, + createElders: (req, res) => { const body = req.body; @@ -159,6 +212,62 @@ module.exports = { }); }); }, + updateElderRegistration: ((req, res) => { + + const body = req.body.elder; + body.elder_id = req.auth.result.id; + updateElders(body, (err, result) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + + if (!result) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + const bodyV = req.body.verify; + bodyV.elder_id = req.auth.result.id; + console.log(bodyV); + updateverifyElder(bodyV, (errV, resultV) => { + if (errV) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + + if (!resultV) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + + + return res.status(200).json({ + success: 1, + message: "Updated Both SuccesFully", + data: resultV, + }); + + }); + + // return res.status(200).json({ + // success: 1, + // message: "Updated SuccesFully", + // data: result, + // }); + }); + + + }), elderRegistration: (req, res) => { const bodyE = req.body.elder; createElders(bodyE, (errorE, resultE) => { @@ -192,11 +301,25 @@ module.exports = { message: "Databse Connection Error", }); } - - return res.status(200).json({ - success: 1, - message: " SuccesFully Inserted Elder Agent Verified Elder ", - data: resultV, + const dataU = { + id: resultE.insertId, + profile:bodyE.profile, + user_id: req.auth.result.user_id, + }; + updateIdByUserId(dataU, (errU, resultU) => { + if (errU) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Databse Connection Error", + }); + } + return res.status(200).json({ + success: 1, + message: + " SuccesFully Inserted Elder Agent Verified Elder And User Table", + data: resultU, + }); }); }); }); @@ -212,13 +335,144 @@ module.exports = { }); } - return res.status(200).json({ - success: 1, - message: " SuccesFully Inserted Elder an Verified Elder ", - data: resultV, + const dataU = { + id: resultE.insertId, + profile:bodyE.profile, + user_id: req.auth.result.user_id, + }; + + updateIdByUserId(dataU, (errU, resultU) => { + if (errU) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Databse Connection Error", + }); + } + return res.status(200).json({ + success: 1, + message: + " SuccesFully Inserted Elder an Verified Elder and User Updated ", + data: resultU, + }); }); }); } }); }, + gramaDivElderRegistration: (req, res) => { + const bodyUE = req.body.user; + console.log(bodyUE.user_name); + const salt = genSaltSync(10); + bodyUE.password = hashSync(bodyUE.password, salt); + + create(bodyUE, 10, 10, (err, resultUE) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database connection errror", + }); + } + + + const bodyE = req.body.elder; + createElders(bodyE, (errorE, resultE) => { + if (errorE) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Databse Connection Error", + }); + } + + const bodyA = req.body.agent; + if (bodyA.available) { + bodyA.elder_id = resultE.insertId; + createAgent(bodyA, (errorA, resultA) => { + if (errorA) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Databse Connection Error", + }); + } + + const bodyV = req.body.verify; + bodyV.elder_id = resultE.insertId; + createverifyFirstElder(bodyV, (errorV, resultV) => { + if (errorV) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Databse Connection Error", + }); + } + + const dataU = { + id: resultE.insertId, + profile: bodyE.profile, + user_id: resultUE.insertId, + }; + + updateIdByUserId(dataU, (errU, resultU) => { + if (errU) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Databse Connection Error", + }); + } + + + return res.status(200).json({ + success: 1, + message: + " SuccesFully Inserted Elder Agent Verified Elder User Table", + data: resultV, + }); + }); + }); + + }); + } else { + const bodyV = req.body.verify; + bodyV.elder_id = resultE.insertId; + createverifyFirstElder(bodyV, (errorV, resultV) => { + if (errorV) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Databse Connection Error", + }); + } + + const dataU = { + id: resultE.insertId, + profile: bodyE.profile, + user_id: resultUE.insertId, + }; + + updateIdByUserId(dataU, (errU, resultU) => { + if (errU) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Databse Connection Error", + }); + } + + + return res.status(200).json({ + success: 1, + message: + " SuccesFully Inserted Elder an Verified Elder Updated ", + data: resultV, + }); + }); + }); + } + }); + }); + }, }; diff --git a/api/elders/elder.router.js b/api/elders/elder.router.js index c90700b..465d25f 100644 --- a/api/elders/elder.router.js +++ b/api/elders/elder.router.js @@ -7,16 +7,24 @@ const { deleteElders, elderRegistration, elderDetailstoPayId, + getElderDetail, + updateElderRegistration, + gramaDivElderRegistration, + searchElders } = require("./elder.controller"); const { checkToken } = require("../../auth/token_validation"); router.post("/", checkToken, createElders); +router.post("/search", checkToken, searchElders); router.post("/elder-registration", checkToken, elderRegistration); +router.post("/grama-div-elder-registration", checkToken, gramaDivElderRegistration); router.get("/eldertopatid/:pay_id", checkToken, elderDetailstoPayId); +router.get("/elder_detail", checkToken, getElderDetail); router.get("/:elder_id", checkToken, getElderByElderID); router.get("/", checkToken, getElders); +router.patch("/update-elder-registration", checkToken, updateElderRegistration); router.patch("/", checkToken, updateElders); router.delete("/", checkToken, deleteElders); diff --git a/api/elders/elder.service.js b/api/elders/elder.service.js index 7d45566..776a2a2 100644 --- a/api/elders/elder.service.js +++ b/api/elders/elder.service.js @@ -25,6 +25,27 @@ module.exports = { } ); }, + searchElders: (data, callBack) => { + pool.query( + "SELECT * FROM `elder` WHERE name LIKE ? and elder_id LIKE ? AND address LIKE ? and gramaniladari_division_id LIKE ? AND near_post_office_id LIKE ? AND district_id like ? AND divisional_secratory_id LIKE ? ", + [ + "%"+data.name+"%", + "%"+data.elder_id+"%" , + "%"+data.address +"%", + "%"+data.gramaniladari_division_id +"%", + "%"+data.near_post_office_id +"%", + "%"+data.district_id +"%", + "%"+data.divisional_secratory_id +"%", + ], + (error, results, fields) => { + if (error) { + return callBack(error); + } + + return callBack(null, results); + } + ); + }, createElders: (data, callBack) => { pool.query( diff --git a/api/grama-division/grama-division.controllers.js b/api/grama-division/grama-division.controllers.js index bf67083..27f0e96 100644 --- a/api/grama-division/grama-division.controllers.js +++ b/api/grama-division/grama-division.controllers.js @@ -5,13 +5,12 @@ const { updateGramaDivision, deleteGramaDivision, + getGramaDivisionsToSelectOfficers, getGramaDivisionsToSelectBox, getBenifisherListToGram, - + getBenifisherCountToGram, getGramaDivisionsIDonly, - - informDeath, - sendComplain, + getAgentVerifyList, } = require("./grama-division.services"); const { @@ -20,7 +19,10 @@ const { const { checkPermision } = require("../../auth/roleauth"); const { getverifyElderGramaID, + getverifiedElderGramaID, } = require("../verify_elder/verify_elder.service"); + +const { getNotAvilableAgentByElderID } = require("../agent/agent.services"); const { selectElderMultipleId } = require("../elders/elder.service"); module.exports = { @@ -190,8 +192,43 @@ module.exports = { }); }); }, + getBenifisherCountToGram: (req, res) => { + const grmaniladari_officer_id = req.auth.result.id; + getOfficerGramaIdByOfficerID(grmaniladari_officer_id, (errO, resultsO) => { + if (errO) { + console.log(errO); + return res.status(500).json({ + success: 0, + message: "database Connection error", + }); + } + + if (!resultsO) { + return res.json({ + success: 0, + message: "record Not Found", + }); + } + + const gram_div_id = resultsO.gramaniladari_division_id; + getBenifisherCountToGram(gram_div_id, (err, results) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "database Connection error", + }); + } + return res.json({ + success: 1, + data: results, + }); + }); + }); + }, getToBeVerifyList: (req, res) => { const gram_div_id = req.auth.result.id; + console.log(req.auth); getverifyElderGramaID(gram_div_id, (err, results) => { if (err) { console.log(err); @@ -207,8 +244,8 @@ module.exports = { }); }); }, - getGramaDivisionsToSelectBox: (req, res) => { - getGramaDivisionsToSelectBox((err, results) => { + getGramaDivisionsToSelectOfficers: (req, res) => { + getGramaDivisionsToSelectOfficers((err, results) => { if (err) { console.log(err); return; @@ -225,50 +262,66 @@ module.exports = { }); }); }, - getGramaDivisionsIDonly: (req, res) => { - getGramaDivisionsIDonly((err, results) => { + + getGramaDivisionsToSelectBox: (req, res) => { + getGramaDivisionsToSelectBox((err, results) => { if (err) { console.log(err); - return res.status(500).json({ + return; + } + if (!results) { + return res.json({ success: 0, - message: "Database Connection Errorr", + message: "Record not found", }); } - - return res.status(200).json({ + return res.json({ success: 1, data: results, }); }); }, - informDeath: (req, res) => { - const body = req.body; - informDeath(body, (error, results) => { - if (error) { - console.log(error); + getGramaDivisionsIDonly: (req, res) => { + getGramaDivisionsIDonly((err, results) => { + if (err) { + console.log(err); return res.status(500).json({ success: 0, - message: "Database Connection error ", + message: "Database Connection Errorr", }); } + return res.status(200).json({ success: 1, data: results, }); }); }, - sendComplain: (req, res) => { - const body = req.body; - sendComplain(body, (error, results) => { - if (error) { - console.log(error); + getAgentVerifyList: (req, res) => { + const officer_id = req.auth.result.id; + console.log(req.auth); + getAgentVerifyList(officer_id, (err, results) => { + if (err) { + console.log(err); return res.status(500).json({ success: 0, - message: "Database Connection error ", + message: "database Connection error", }); } - return res.status(200).json({ + + return res.json({ success: 1, + status: true, + total: 5, + last_page: 1, + per_page: 8, + current_page: 1, + next_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + prev_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + from: 1, + to: 8, data: results, }); }); diff --git a/api/grama-division/grama-division.routers.js b/api/grama-division/grama-division.routers.js index 72f63ad..a2cbc6f 100644 --- a/api/grama-division/grama-division.routers.js +++ b/api/grama-division/grama-division.routers.js @@ -6,26 +6,23 @@ const { updateGramaDivision, deleteGramaDivision, getToBeVerifyList, - + getGramaDivisionsToSelectOfficers, getGramaDivisionsToSelectBox, getBenifisherListToGram, - + getBenifisherCountToGram, getGramaDivisionsIDonly, - - informDeath, - sendComplain, + getAgentVerifyList, } = require("./grama-division.controllers"); const { checkToken } = require("../../auth/token_validation"); router.get("/gramandionly", checkToken, getGramaDivisionsIDonly); - -router.post("/informdeath", checkToken, informDeath); -router.post("/sendcomplain", checkToken, sendComplain); +router.get("/agent", checkToken, getAgentVerifyList); router.post("/", checkToken, createGramaDivision); +router.get("/selectofficer", checkToken, getGramaDivisionsToSelectOfficers); router.get("/selectbox", checkToken, getGramaDivisionsToSelectBox); router.get("/", checkToken, getGramaDivisions); - +router.get("/count", checkToken, getBenifisherCountToGram); router.get("/verifylist", checkToken, getToBeVerifyList); router.get("/benifisherlist", checkToken, getBenifisherListToGram); router.get("/:gram_div_id", checkToken, getGramaDivisionByGramaDivisionID); diff --git a/api/grama-division/grama-division.services.js b/api/grama-division/grama-division.services.js index 5af55e3..24fb23f 100644 --- a/api/grama-division/grama-division.services.js +++ b/api/grama-division/grama-division.services.js @@ -12,6 +12,7 @@ module.exports = { } ); }, + getBenifisherListToGram: (grama_div, callBack) => { pool.query( "SELECT * FROM `elder`,`benifesher` WHERE elder.elder_id = benifesher.elder_id AND benifesher.is_deleted =0 and elder.gramaniladari_division_id =?", @@ -24,6 +25,18 @@ module.exports = { } ); }, + getBenifisherCountToGram: (grama_div, callBack) => { + pool.query( + "SELECT COUNT(elder.elder_id) AS count FROM `elder`,`benifesher` WHERE elder.elder_id = benifesher.elder_id AND benifesher.is_deleted =0 and elder.gramaniladari_division_id =?", + [grama_div], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + }, createGramaDivision: (data, callBack) => { pool.query( @@ -67,10 +80,9 @@ module.exports = { if (error) { return callBack(error); } - data=[]; - results.forEach(element => { - data.push(element.gramaniladari_division_id) - + data = []; + results.forEach((element) => { + data.push(element.gramaniladari_division_id); }); //console.log(data) return callBack(null, data); @@ -110,9 +122,9 @@ module.exports = { } ); }, - getGramaDivisionsToSelectBox: (callBack) => { + getGramaDivisionsToSelectOfficers: (callBack) => { pool.query( - "SELECT `gramaniladari_division_id` as value, `name` as text FROM `gramaniladari_division` WHERE `is_deleted`='0'", + "SELECT gramaniladari_division.gramaniladari_division_id as value ,`name` as text FROM `gramaniladari_division` LEFT JOIN gramaniladari ON gramaniladari_division.gramaniladari_division_id = gramaniladari.gramaniladari_division_id WHERE gramaniladari.gramaniladari_division_id IS Null AND gramaniladari_division.is_deleted='0'", [], (error, results, fields) => { if (error) { @@ -122,17 +134,10 @@ module.exports = { } ); }, - informDeath: (data,callBack) => { + getGramaDivisionsToSelectBox: (callBack) => { pool.query( - "INSERT INTO inform_death(elder_id,gramaniladari_division_id,divisional_secratory_id,death_certificate_no,death_reason, death_date) VALUES (?,?,?,?,?,?)", - [ - data.elder_id, - data.gramaniladari_division_id, - data.divisional_secratory_id, - data.death_certificate_no, - data.death_reason, - data.death_date - ], + "SELECT `gramaniladari_division_id` as value, `name` as text FROM `gramaniladari_division` WHERE `is_deleted`='0'", + [], (error, results, fields) => { if (error) { return callBack(error); @@ -141,14 +146,10 @@ module.exports = { } ); }, - sendComplain: (data,callBack) => { + getAgentVerifyList: (officer_id, callBack) => { pool.query( - "INSERT INTO complains(elder_id,gramaniladari_division_id,post_office_id,viewed_officer_id,complain) VALUES (?,?,'null','null',?)", - [ - data.elder_id, - data.gramaniladari_division_id, - data.complain, - ], + "SELECT elder.elder_id,elder.name AS ename,agent.agent_id,agent.name AS aname,agent.address AS aaddress,agent.nic AS anic FROM elder,gramaniladari,agent WHERE elder.gramaniladari_division_id =gramaniladari.gramaniladari_division_id AND elder.elder_id = agent.elder_id AND agent.agent_is_avilable='0' AND agent.gramaniladari_verify_comment IS NULL AND gramaniladari.grmaniladari_officer_id =?", + [officer_id], (error, results, fields) => { if (error) { return callBack(error); diff --git a/api/grama_niladari_officer/officer_controller.js b/api/grama_niladari_officer/officer_controller.js index df1f1aa..0bf52f4 100644 --- a/api/grama_niladari_officer/officer_controller.js +++ b/api/grama_niladari_officer/officer_controller.js @@ -5,13 +5,16 @@ const { updateOfficer, deleteOfficer, GetGramaOfficerByOfficers, - GetGramaDetails + GetGramaDetails, + getOfficerGramaIdByOfficerID } = require("./officer_service"); -const { create } = require("../officers/officer.service"); +const { createOffUser } = require("../users/user.service"); -const { sign } = require("jsonwebtoken"); +const { create, updateOfficers } = require("../officers/officer.service"); +const { sign } = require("jsonwebtoken"); +const { genSaltSync, hashSync, compareSync } = require("bcrypt"); const { checkPermision } = require("../../auth/roleauth"); module.exports = { @@ -33,9 +36,48 @@ module.exports = { }); }, createGramaOfficer: (req, res) => { + const bodyUser = req.body.User; + console.log(bodyUser.uname); + const salt = genSaltSync(10); + bodyUser.pword = hashSync(bodyUser.pword, salt); + createOffUser(bodyUser, (err, resultsUser) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database connection errror", + }); + } + const bodyo = req.body.Officer; + create(bodyo, (erro, resultso) => { + if (erro) { + console.log(erro); + return res.status(500).json({ + success: 0, + message: "Database connection errror", + }); + } + const bodyg = req.body.GramaOfficer; + createOfficer(bodyg, (errg, resultsg) => { + if (errg) { + console.log(errg); + return res.status(500).json({ + success: 0, + message: "Database connection errror", + }); + } + return res.json({ + success: 1, + data: resultsg, + }); + }); + }); + }); + }, + updateGramaOfficer: (req, res) => { const bodyo = req.body.Officer; - create(bodyo, (erro, resultso) => { + updateOfficers(bodyo, (erro, resultso) => { if (erro) { console.log(erro); return res.status(500).json({ @@ -44,7 +86,7 @@ module.exports = { }); } const bodyg = req.body.GramaOfficer; - createOfficer(bodyg, (errg, resultsg) => { + updateOfficer(bodyg, (errg, resultsg) => { if (errg) { console.log(errg); return res.status(500).json({ @@ -52,9 +94,10 @@ module.exports = { message: "Database connection errror", }); } - console.log("pathu"); + console.log("sasa"); return res.json({ success: 1, + message: "I know", data: resultsg, }); }); @@ -175,8 +218,45 @@ module.exports = { } return res.json({ success: 1, - data: results + data: results, }); }); }, + getDiviSionByOfficerID: (req, res) => { + const o_id = req.auth.result.id; + getOfficerGramaIdByOfficerID(o_id, (err, resultD) => { + if (err) { + console.log(err); + return res.status(500).json({ + succcess: 0, + message: "Database Connection error", + }); + } + if (!resultD) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + if(resultD){ + const d_id = resultD.gramaniladari_division_id; + GetGramaDetails(d_id, (err, results) => { + if (err) { + console.log(err); + return; + } + if (!results) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + return res.json({ + success: 1, + data: results, + }); + }); + } + }); + } }; diff --git a/api/grama_niladari_officer/officer_router.js b/api/grama_niladari_officer/officer_router.js index e72a0a8..0716ef3 100644 --- a/api/grama_niladari_officer/officer_router.js +++ b/api/grama_niladari_officer/officer_router.js @@ -8,18 +8,22 @@ const { updateOfficer, deleteOfficer, GetGramaOfficerByOfficers, - GetGramaDetails + GetGramaDetails, + updateGramaOfficer, + getDiviSionByOfficerID } = require("./officer_controller"); const { checkToken } = require("../../auth/token_validation"); router.post("/", createOfficer); -router.post("/gramaofficer", createGramaOfficer); +router.post("/gramaofficer", checkToken, createGramaOfficer); router.get("/topost/:gramaniladari_division_id", checkToken, GetGramaDetails); router.get("/topost", checkToken, GetGramaOfficerByOfficers); +router.get("/div", checkToken, getDiviSionByOfficerID); router.get("/", checkToken, getOfficers); router.get("/:grmaniladari_officer_id", checkToken, getOfficerByOfficerID); +router.patch("/updategramaofficer", checkToken, updateGramaOfficer); router.patch("/", checkToken, updateOfficer); router.delete("/", checkToken, deleteOfficer); diff --git a/api/grama_niladari_officer/officer_service.js b/api/grama_niladari_officer/officer_service.js index c14cbc1..44e7da5 100644 --- a/api/grama_niladari_officer/officer_service.js +++ b/api/grama_niladari_officer/officer_service.js @@ -51,6 +51,8 @@ module.exports = { ); }, updateOfficer: (data, callBack) => { + console.log("ww"); + console.log(data); pool.query( `UPDATE gramaniladari SET gramaniladari_division_id=?,district_id=?,divisional_secratary_id=? WHERE grmaniladari_officer_id=?`, [ diff --git a/api/marks/marks.controller.js b/api/marks/marks.controller.js index 8b2d070..14509f6 100644 --- a/api/marks/marks.controller.js +++ b/api/marks/marks.controller.js @@ -1,5 +1,8 @@ const { getCriteria, + insertCriteria, + deleteCriteria, + getMarksByvID } = require("./marks.service"); const { checkPermision } = require("../../auth/roleauth"); @@ -11,7 +14,60 @@ module.exports = { console.log(err); return; } - return res.json({ + return res.status(200).json({ + status:true, + data: results, + }); + }); + + }, + insertCriteria: (req, res) => { + const body = req.body; + insertCriteria(body, (err, result) => { + if(err){ + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + return res.status(200).json({ + success: 1, + data: result, + }); + }); + }, + deleteCriteria: (req, res) => { + const cid = req.params.cri_id; + deleteCriteria(cid, (error, results) => { + if (error) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "database Connection error", + }); + } + if (!results) { + return res.json({ + success: 0, + message: "Record Not Found", + }); + } + + return res.status(200).json({ + success: 1, + message: "Deleted Succecfully", + data: results, + }); + }); + }, + getMarksByvID: (req, res) => { + const vid = req.params.vid; + getMarksByvID(vid,(err, results) => { + if (err) { + console.log(err); + return; + } + return res.status(200).json({ status:true, data: results, }); diff --git a/api/marks/marks.router.js b/api/marks/marks.router.js index 3925dba..4dfcbb0 100644 --- a/api/marks/marks.router.js +++ b/api/marks/marks.router.js @@ -1,12 +1,16 @@ const router = require("express").Router(); const { - getCriteria + getCriteria, + insertCriteria, + deleteCriteria, + getMarksByvID } = require("./marks.controller"); const { checkToken } = require("../../auth/token_validation"); router.get("/criteria", checkToken, getCriteria); - - +router.post("/", checkToken, insertCriteria); +router.patch("/:cri_id", checkToken, deleteCriteria); +router.get("/getmarks/:vid", checkToken, getMarksByvID); module.exports = router; diff --git a/api/marks/marks.service.js b/api/marks/marks.service.js index afa1a7e..d4031ec 100644 --- a/api/marks/marks.service.js +++ b/api/marks/marks.service.js @@ -13,6 +13,30 @@ module.exports = { return callBack(null, results); }); }, + insertCriteria: (data, callBack) => { + pool.query( + "INSERT INTO criteria(criteria) VALUES (?)", + [data.criteria], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, callBack); + } + ); + }, + deleteCriteria: (criteria_id, callBack) => { + pool.query( + "UPDATE criteria SET is_deleted='1' WHERE criteria_id=?", + [criteria_id], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, callBack); + } + ); + }, insertMarks: (vid,data,callBack) => { arr=[]; sql="INSERT INTO criteriamarks(criteria_id,v_id,marks) VALUES (?,?,?)" @@ -49,4 +73,16 @@ module.exports = { return callBack(null, results); }); }, + getMarksByvID: (vid, callBack) => { + pool.query( + "SELECT criteria,marks FROM criteriamarks,criteria WHERE criteriamarks.criteria_id = criteria.criteria_id AND v_id=?", + [vid], + (error, results, fields) => { + if(error){ + return callBack(error); + } + return callBack(null, results); + } + ); + }, }; diff --git a/api/notification/notification.controller.js b/api/notification/notification.controller.js new file mode 100644 index 0000000..fec6344 --- /dev/null +++ b/api/notification/notification.controller.js @@ -0,0 +1,38 @@ +const { createNotification,getNotification } = require("./notification.service"); + + +module.exports = { + createNotification: (req, res) => { + const body =req.body; + createNotification(body , (err ,results) => { + if(err){ + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + return res.status(200).json({ + success: 1, + data: results, + }); + }); + }, + getNotification: (req, res) => { + const id = req.auth.result.user_id; + // console.log( id); + getNotification( id, (err, results) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + return res.status(200).json({ + success: 1, + data: results, + }); + }); + } +} \ No newline at end of file diff --git a/api/notification/notification.router.js b/api/notification/notification.router.js new file mode 100644 index 0000000..f56c1eb --- /dev/null +++ b/api/notification/notification.router.js @@ -0,0 +1,15 @@ +const router = require("express").Router(); +const { + createNotification, + getNotification +} = require("./notification.controller"); + +const { checkToken } = require("../../auth/token_validation"); + +router.post("/",checkToken,createNotification); + router.get("/",checkToken,getNotification); + + + + +module.exports = router; \ No newline at end of file diff --git a/api/notification/notification.service.js b/api/notification/notification.service.js new file mode 100644 index 0000000..f0d579e --- /dev/null +++ b/api/notification/notification.service.js @@ -0,0 +1,28 @@ +const pool = require("../../config/database"); + +module.exports = { + createNotification: (data, callBack) => { + pool.query( + "INSERT INTO `notification`( `reciver_id`, `notificaton` ) VALUES ( ?,? )", + [data.reciver_id , data.notificaton], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + }, + getNotification: (id ,callBack) => { + pool.query( + "SELECT `reciver_id`, `notificaton` FROM `notification` WHERE `reciver_id` = ?", + [id], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + }, +} \ No newline at end of file diff --git a/api/officers/officer.service.js b/api/officers/officer.service.js index 7d89432..250b565 100644 --- a/api/officers/officer.service.js +++ b/api/officers/officer.service.js @@ -46,8 +46,8 @@ module.exports = { }, updateOfficers: (data, callBack) => { pool.query( - `UPDATE officers SET officer_id=? ,nic_no=? ,name=? ,email=? ,phone=?`, - [data.officer_id, data.nic_no, data.name, data.email, data.phone], + `UPDATE officers SET nic_no=? ,name=? ,email=? ,phone=? where officer_id=? `, + [data.nic_no, data.name, data.email, data.phone, data.officer_id], (error, results, fields) => { if (error) { return callBack(error); diff --git a/api/payment-div-to-post/payment-div-to-post.controllers.js b/api/payment-div-to-post/payment-div-to-post.controllers.js index 28255b6..3f73831 100644 --- a/api/payment-div-to-post/payment-div-to-post.controllers.js +++ b/api/payment-div-to-post/payment-div-to-post.controllers.js @@ -4,6 +4,9 @@ const { GetPyamentHistory, getDetailsByMaxPaymentId, getpaymentByYears, + getpaymentByYearMoths, + GetPyamentToPostOffByYearMonth, + getPostDetailByPayId, } = require("./payment-div-to-post.services"); const { checkPermision } = require("../../auth/roleauth"); const { @@ -66,6 +69,68 @@ module.exports = { }); }); }, + getPostDetailByPayId: (req, res) => { + const data = { + pay_id: req.params.pay_id, + }; + getPostDetailByPayId(data, (err, result) => { + if (err) { + console.log(err); + return res.status(500).json({ + succcess: 0, + message: "Database Connection error", + }); + } + + return res.status(200).json({ + success: 1, + status: true, + total: 5, + last_page: 1, + per_page: 8, + current_page: 1, + next_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + prev_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + from: 1, + to: 8, + data: result, + }); + }); + }, + + GetPyamentToPostOffByYearMonth: (req, res) => { + const data = { + year: req.params.year, + month: req.params.month, + }; + GetPyamentToPostOffByYearMonth(data, (err, result) => { + if (err) { + console.log(err); + return res.status(500).json({ + succcess: 0, + message: "Database Connection error", + }); + } + + return res.status(200).json({ + success: 1, + status: true, + total: 5, + last_page: 1, + per_page: 8, + current_page: 1, + next_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + prev_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + from: 1, + to: 8, + data: result, + }); + }); + }, GetPyamentHistory: (req, res) => { GetPyamentHistory((err, result) => { if (err) { @@ -99,6 +164,8 @@ module.exports = { }); }, getpaymentByYears: (req, res) => { + console.log("pay"); + getpaymentByYears((err, result) => { if (err) { console.log(err); @@ -113,4 +180,22 @@ module.exports = { }); }); }, + getpaymentByYearMoths: (req, res) => { + const year = req.params.year; + console.log(year); + + getpaymentByYearMoths(year, (err, result) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database Connection Error", + }); + } + return res.status(200).json({ + success: 1, + data: result, + }); + }); + }, }; diff --git a/api/payment-div-to-post/payment-div-to-post.routers.js b/api/payment-div-to-post/payment-div-to-post.routers.js index 2a64425..439904f 100644 --- a/api/payment-div-to-post/payment-div-to-post.routers.js +++ b/api/payment-div-to-post/payment-div-to-post.routers.js @@ -5,13 +5,23 @@ const { GetPyamentHistory, getDetailsByMaxPaymentId, getpaymentByYears, + getpaymentByYearMoths, + GetPyamentToPostOffByYearMonth, + getPostDetailByPayId, } = require("./payment-div-to-post.controllers"); const { checkToken } = require("../../auth/token_validation"); router.post("/", checkToken, InsertPaymetDivToPost); +router.get( + "/topostbyyearmaonth/:year/:month", + checkToken, + GetPyamentToPostOffByYearMonth +); +router.get("/postdetailbyid/:pay_id", checkToken, getPostDetailByPayId); router.get("/topost", checkToken, GetPyamentToPostOff); router.get("/max", checkToken, getDetailsByMaxPaymentId); +router.get("/month-by-years/:year", checkToken, getpaymentByYearMoths); router.get("/years", checkToken, getpaymentByYears); router.get("/", checkToken, GetPyamentHistory); diff --git a/api/payment-div-to-post/payment-div-to-post.services.js b/api/payment-div-to-post/payment-div-to-post.services.js index 41b845f..527791d 100644 --- a/api/payment-div-to-post/payment-div-to-post.services.js +++ b/api/payment-div-to-post/payment-div-to-post.services.js @@ -46,6 +46,35 @@ module.exports = { } ); }, + + getPostDetailByPayId: (data, callBack) => { + pool.query( + "SELECT post_office_table.post_office_id ,payments_devisional_to_post_office.check_no,payments_devisional_to_post_office.year ,months.month_id ,months.m_name ,post_office_table.name FROM `payments_devisional_to_post_office` ,`months` ,`post_office_table` WHERE months.month_id = payments_devisional_to_post_office.month and post_office_table.post_office_id = payments_devisional_to_post_office.post_office_id and payments_devisional_to_post_office.payment_id = ?", + [data.pay_id], + (error, results, fields) => { + if (error) { + console.log(results); + return callBack(error); + } + return callBack(null, results); + } + ); + }, + + GetPyamentToPostOffByYearMonth: (data, callBack) => { + pool.query( + "SELECT payments_devisional_to_post_office.payment_id , post_office_table.post_office_id, post_office_table.name ,post_office_table.address,post_office_table.bank_account_no, payments_devisional_to_post_office.year,payments_devisional_to_post_office.month , months.m_name ,payments_devisional_to_post_office.total_money_amount , (SUM(`sent_amount_to_post_office`) - SUM(`elders_dose_not_resive_total_money`) ) as elder_got ,SUM(`elders_dose_not_resive_total_money`) as not_recive ,sum(`no_of_elders_got_money`) as pay_count ,SUM(`amount_of_money_debited_to_centrel_bank`) as year_to_fund FROM `months` , `payments_devisional_to_post_office`,`post_office_table` WHERE months.month_id=payments_devisional_to_post_office.month and payments_devisional_to_post_office.post_office_id = post_office_table.post_office_id AND payments_devisional_to_post_office.year = ? and payments_devisional_to_post_office.month=?", + [data.year, data.month], + (error, results, fields) => { + if (error) { + console.log(results); + return callBack(error); + } + return callBack(null, results); + } + ); + }, + GetPyamentHistory: (callBack) => { pool.query( "SELECT post_office_table.name,payments_devisional_to_post_office.payment_id,payments_devisional_to_post_office.check_no,payments_devisional_to_post_office.date,payments_devisional_to_post_office.no_qualified_elders,payments_devisional_to_post_office.sent_amount_to_post_office,payments_devisional_to_post_office.year,payments_devisional_to_post_office.month,payments_devisional_to_post_office.no_of_elders_got_money,payments_devisional_to_post_office.send_date,payments_devisional_to_post_office.completed_date,payments_devisional_to_post_office.is_completed FROM payments_devisional_to_post_office,post_office_table WHERE post_office_table.post_office_id=payments_devisional_to_post_office.post_office_id ORDER BY `payments_devisional_to_post_office`.`payment_id` DESC", @@ -73,8 +102,10 @@ module.exports = { ); }, getpaymentByYears: (callBack) => { + console.log("now"); + pool.query( - "SELECT year , count(*) , SUM(`total_money_amount`) as year_tot , SUM(`amount_of_money_debited_to_centrel_bank`) as year_to_fund , SUM(`sent_amount_to_post_office`) as year_to_post FROM `payments_devisional_to_post_office` GROUP BY year ORDER BY`payments_devisional_to_post_office`.`payment_id` DESC", + "SELECT year , count(*) , SUM(`total_money_amount`) as year_tot , SUM(`amount_of_money_debited_to_centrel_bank`) as year_to_fund , SUM(`sent_amount_to_post_office`) as year_to_post ,(SUM(`sent_amount_to_post_office`) - SUM(`elders_dose_not_resive_total_money`) ) as elder_got ,SUM(`elders_dose_not_resive_total_money`) as not_recive ,sum(`no_of_elders_got_money`) as pay_count FROM `payments_devisional_to_post_office` GROUP BY year ORDER BY`payments_devisional_to_post_office`.`payment_id` DESC", [], (error, results, fields) => { if (error) { @@ -85,4 +116,17 @@ module.exports = { } ); }, + getpaymentByYearMoths: (year, callBack) => { + pool.query( + "SELECT payments_devisional_to_post_office.year ,months.month_id, months.m_name , COUNT(*) as count, SUM(payments_devisional_to_post_office.total_money_amount) as total , SUM(payments_devisional_to_post_office.amount_of_money_debited_to_centrel_bank) as fund , SUM(payments_devisional_to_post_office.sent_amount_to_post_office) as tot_post , (SUM(`sent_amount_to_post_office`) - SUM(`elders_dose_not_resive_total_money`) ) as elder_got ,SUM(`elders_dose_not_resive_total_money`) as not_recive ,sum(`no_of_elders_got_money`) as pay_count FROM `payments_devisional_to_post_office`,`months` WHERE payments_devisional_to_post_office.month = months.month_id AND payments_devisional_to_post_office.year =? GROUP by month ORDER BY payments_devisional_to_post_office.payment_id DESC", + [year], + (error, results, fields) => { + if (error) { + console.log(error); + return callBack(error); + } + return callBack(null, results); + } + ); + }, }; diff --git a/api/post-office/post-office.controllers.js b/api/post-office/post-office.controllers.js index 9885f10..0227c9d 100644 --- a/api/post-office/post-office.controllers.js +++ b/api/post-office/post-office.controllers.js @@ -9,6 +9,7 @@ const { getpostOfficePayHistory, endPostPaymentToDivPayId, getPaymentInfo, + getPostOfficeBenifisherphoneList } = require("./post-office.sevices"); const { @@ -16,6 +17,8 @@ const { } = require("../post_office_Officers/post_officer.service"); const { sign } = require("jsonwebtoken"); +const { sendMesssage } = require("../../auth/notification"); + const { checkPermision } = require("../../auth/roleauth"); module.exports = { @@ -101,6 +104,57 @@ module.exports = { }); }); }, + sendNotifySms : (req, res) => { + const off_id = req.auth.result.id; + getOfficerPostOfficeByOfficerID(off_id, (errO, resultsO) => { + if (errO) { + console.log(errO); + return; + } + if (!resultsO) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + const post_office_id = resultsO.post_office_id; + const message = req.body.message; + getPostOfficeBenifisherphoneList(post_office_id ,message, (err, results) => { + if (err) { + console.log(err); + return; + } + if (!results) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + + + results.forEach(res => { + res.number = "+94" +res.number.substring(1); + // console.log(res); + + const reqM = { + pnum: res.number, + text: res.massage + } + + sendMesssage(reqM, (resM) => { + // console.log(resM.status); + }); + }); + return res.json({ + success: 1, + data: results, + }); + + }); + }); + }, + + getPostOfficeBenifisherList: (req, res) => { const off_id = req.auth.result.id; getOfficerPostOfficeByOfficerID(off_id, (errO, resultsO) => { diff --git a/api/post-office/post-office.routers.js b/api/post-office/post-office.routers.js index 13e91b4..2fe7c30 100644 --- a/api/post-office/post-office.routers.js +++ b/api/post-office/post-office.routers.js @@ -10,15 +10,17 @@ const { getpostOfficePayHistory, endPostPaymentToDivPayId, getPaymentInfo, + sendNotifySms } = require("./post-office.controllers"); const { checkToken } = require("../../auth/token_validation"); router.get("/selectbox", checkToken, getPostOfficesToSelectBox); router.post("/", checkToken, createPostOffice); - +router.post("/notifyelders", checkToken, sendNotifySms); router.get("/", checkToken, getPostOffices); router.get("/benfisherslist", checkToken, getPostOfficeBenifisherList); + router.get("/patmentinfo/:post_office_id", checkToken, getPaymentInfo); router.get("/paymenthistory", checkToken, getpostOfficePayHistory); router.get("/:post_office_id", checkToken, getPostOfficeByPostOfficeID); diff --git a/api/post-office/post-office.sevices.js b/api/post-office/post-office.sevices.js index 34f87a1..6f89d72 100644 --- a/api/post-office/post-office.sevices.js +++ b/api/post-office/post-office.sevices.js @@ -27,7 +27,7 @@ module.exports = { }, getpostOfficePayHistory: (post_office_id, callBack) => { pool.query( - "SELECT `payment_id` ,`post_office_id`, `check_no`, `date`, `total_money_amount`, `no_qualified_elders`, `amount_of_money_debited_to_centrel_bank`, `sent_amount_to_post_office` , `year`, `month`, `no_of_elders_got_money`, `elders_dose_not_resive_total_money`, `send_date`,`is_completed`, `completed_date` FROM `payments_devisional_to_post_office` WHERE `post_office_id` =? AND is_deleted='0' ORDER BY `payments_devisional_to_post_office`.`payment_id` DESC", + "SELECT `payment_id`, months.m_name ,`post_office_id`, `check_no`, `date`, `total_money_amount`, `no_qualified_elders`, `amount_of_money_debited_to_centrel_bank`, `sent_amount_to_post_office` , `year`, `month`, `no_of_elders_got_money`, `elders_dose_not_resive_total_money`, `send_date`,`is_completed`, `completed_date` FROM `payments_devisional_to_post_office` ,`months` WHERE month=months.month_id and `post_office_id` =? AND is_deleted='0' ORDER BY `payments_devisional_to_post_office`.`payment_id` DESC", [post_office_id], (error, results, fields) => { if (error) { @@ -49,6 +49,18 @@ module.exports = { } ); }, + getPostOfficeBenifisherphoneList: (post_office_id,message, callBack) => { + pool.query( + "SELECT elder.number , ? as massage FROM `elder` ,`benifesher` WHERE elder.elder_id = benifesher.elder_id AND benifesher.is_deleted =0 and elder.near_post_office_id = ?", + [message,post_office_id], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + }, getPostOffices: (callBack) => { pool.query( "SELECT * FROM `post_office_table` WHERE `is_deleted`=0", diff --git a/api/post_office_Officers/post_officer.controller.js b/api/post_office_Officers/post_officer.controller.js index ee387b7..51acd62 100644 --- a/api/post_office_Officers/post_officer.controller.js +++ b/api/post_office_Officers/post_officer.controller.js @@ -2,14 +2,20 @@ const { create, getOfficerByOfficerID, getOfficers, - updateOfficers, + updatePPPPOfficers, deleteOfficers, + getPostOfficers, + byIdGetPostOfficers, + } = require("./post_officer.service"); +const { createOffUser } = require("../users/user.service"); const { sign } = require("jsonwebtoken"); const { checkPermision } = require("../../auth/roleauth"); -const { createOffOfficer } = require("../officers/officer.service"); +const { createOffOfficer,updateOfficers } = require("../officers/officer.service"); +const { genSaltSync, hashSync, compareSync } = require("bcrypt"); + module.exports = { createOfficer: (req, res) => { const body = req.body; @@ -27,6 +33,37 @@ module.exports = { }); }); }, + getPostOfficers: (req, res) => { + getPostOfficers((err, results) => { + if (err) { + console.log(err); + return; + } + return res.json({ + success: 1, + data: results, + }); + }); + }, + byIdGetPostOfficers: (req, res) => { + const officer_id = req.params.officer_id; + byIdGetPostOfficers(officer_id, (err, results) => { + if (err) { + console.log(err); + return; + } + if (!results) { + return res.json({ + success: 0, + message: "Record not found", + }); + } + return res.json({ + success: 1, + data: results, + }); + }); + }, getOfficers: (req, res) => { const rcid = { role_id: req.auth.result.role_id, @@ -75,9 +112,9 @@ module.exports = { }); }); }, - updateOfficers: (req, res) => { + updatePPPPOfficers: (req, res) => { const body = req.body; - updateOfficers(body, (err, results) => { + updatePPPPOfficers(body, (err, results) => { if (err) { console.log(err); return; @@ -91,6 +128,7 @@ module.exports = { }, deleteOfficers: (req, res) => { const data = req.body; + deleteOfficers(data, (err, results) => { if (err) { console.log(err); @@ -109,8 +147,47 @@ module.exports = { }); }, addPostOfficer: (req, res) => { + const bodyUser = req.body.User; + console.log(bodyUser.uname); + const salt = genSaltSync(10); + bodyUser.pword = hashSync(bodyUser.pword, salt); + createOffUser(bodyUser, (err,resultsUser) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database connection errror", + }); + } + const dataO = req.body.officer; + createOffOfficer(dataO, (errO, resultO) => { + if (errO) { + console.log(errO); + return res.status(500).json({ + success: 0, + message: "Database connection errror", + }); + } + const dataP = req.body.postofficer; + create(dataP, (errP, resultsP) => { + if (errP) { + console.log(errP); + return res.status(500).json({ + success: 0, + message: "Database connection errror", + }); + } + return res.status(200).json({ + success: 1, + data: resultsP, + }); + }); + }); + }); + }, + updatePostOfficer: (req, res) => { const dataO = req.body.officer; - createOffOfficer(dataO, (errO, resultO) => { + updateOfficers(dataO, (errO, resultO) => { if (errO) { console.log(errO); return res.status(500).json({ @@ -119,7 +196,7 @@ module.exports = { }); } const dataP = req.body.postofficer; - create(dataP, (errP, resultsP) => { + updatePPPPOfficers(dataP, (errP, resultsP) => { if (errP) { console.log(errP); return res.status(500).json({ diff --git a/api/post_office_Officers/post_officer.router.js b/api/post_office_Officers/post_officer.router.js index 04b1824..a4dcc2c 100644 --- a/api/post_office_Officers/post_officer.router.js +++ b/api/post_office_Officers/post_officer.router.js @@ -3,9 +3,12 @@ const { createOfficer, getOfficers, getOfficerByOfficerID, - updateOfficers, + updatePPPPOfficers, deleteOfficers, addPostOfficer, + getPostOfficers, + byIdGetPostOfficers, + updatePostOfficer } = require("./post_officer.controller"); const { checkToken } = require("../../auth/token_validation"); @@ -13,9 +16,12 @@ const { checkToken } = require("../../auth/token_validation"); router.post("/", createOfficer); router.post("/addpostofficer", addPostOfficer); +router.get("/officer/byid/:officer_id", byIdGetPostOfficers); +router.get("/getpostofficer", getPostOfficers); router.get("/", checkToken, getOfficers); router.get("/:officer_id", checkToken, getOfficerByOfficerID); -router.patch("/", checkToken, updateOfficers); +router.patch("/updatepostofficer", updatePostOfficer); +router.patch("/", checkToken, updatePPPPOfficers); router.delete("/", checkToken, deleteOfficers); module.exports = router; diff --git a/api/post_office_Officers/post_officer.service.js b/api/post_office_Officers/post_officer.service.js index 74a7dc5..8ffc345 100644 --- a/api/post_office_Officers/post_officer.service.js +++ b/api/post_office_Officers/post_officer.service.js @@ -31,6 +31,30 @@ module.exports = { } ); }, + getPostOfficers: (callBack) => { + pool.query( + "SELECT post_office_officers.officer_id as o_id ,post_office_officers.type as o_type ,officers.name as o_name ,officers.nic_no as o_nic ,officers.phone as o_phone , officers.email as o_email ,post_office_officers.designation as o_designation ,post_office_officers.division as o_division ,post_office_officers.post_office_id as p_post ,post_office_officers.district_id as o_district ,post_office_table.name as p_name ,post_office_table.address as p_address ,post_office_table.email as p_email FROM `post_office_officers` ,`officers` ,`post_office_table` WHERE post_office_officers.officer_id = officers.officer_id and post_office_officers.is_deleted = '0' and post_office_table.post_office_id = post_office_officers.post_office_id and officers.is_deleted='0' ", + [], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + }, + byIdGetPostOfficers: (officer_id, callBack) => { + pool.query( + "SELECT post_office_officers.officer_id as o_id, post_office_officers.type as o_type ,officers.name as o_name ,officers.nic_no as o_nic ,officers.phone as o_phone , officers.email as o_email ,post_office_officers.designation as o_designation ,post_office_officers.division as o_division ,post_office_officers.post_office_id as p_post ,post_office_officers.district_id as o_district ,post_office_table.name as p_name ,post_office_table.address as p_address ,post_office_table.email as p_email FROM `post_office_officers` ,`officers` ,`post_office_table` WHERE post_office_officers.officer_id = officers.officer_id and post_office_officers.is_deleted = '0' and post_office_table.post_office_id = post_office_officers.post_office_id and officers.is_deleted='0' and post_office_officers.`officer_id`= ?", + [officer_id], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results[0]); + } + ); + }, getOfficerByOfficerID: (officer_id, callBack) => { pool.query( `SELECT * FROM post_office_officers WHERE officer_id=?`, @@ -55,7 +79,7 @@ module.exports = { } ); }, - updateOfficers: (data, callBack) => { + updatePPPPOfficers: (data, callBack) => { pool.query( `UPDATE post_office_officers SET post_office_id=?,district_id=?,division=?,type=?,designation=? WHERE officer_id=?`, [ @@ -75,8 +99,9 @@ module.exports = { ); }, deleteOfficers: (data, callBack) => { + console.log(data); pool.query( - `DELETE FROM post_office_officers WHERE officer_id=?`, + `UPDATE post_office_officers SET is_deleted='1' WHERE officer_id=?`, [data.officer_id], (error, results, fields) => { if (error) { diff --git a/api/priority-list/priority-list.services.js b/api/priority-list/priority-list.services.js index 123c97e..a7a08ff 100644 --- a/api/priority-list/priority-list.services.js +++ b/api/priority-list/priority-list.services.js @@ -15,7 +15,7 @@ module.exports = { }, getpriorityListbydiv: (div_id, callBack) => { pool.query( - "SELECT elder.elder_id as id, elder.name ,elder.nic_id,elder.email , elder.address , priority_list.marks ,elder.gramaniladari_division_id , gramaniladari_division.name as divname FROM `gramaniladari_division`,`priority_list` ,`elder` WHERE priority_list.elder_id = elder.elder_id AND gramaniladari_division.gramaniladari_division_id =elder.gramaniladari_division_id AND priority_list.still_dead_or_alive ='1' and priority_list.eligibility ='1' AND elder.divisional_secratory_id=?", + "SELECT elder.elder_id as id, elder.name ,elder.nic_id,elder.email , elder.address,elder.gramaniladari_division_id , gramaniladari_division.name as divname FROM `gramaniladari_division`,`priority_list` ,`elder` WHERE priority_list.elder_id = elder.elder_id AND gramaniladari_division.gramaniladari_division_id =elder.gramaniladari_division_id and priority_list.eligibility ='1' AND elder.divisional_secratory_id=?", [div_id], (error, results, fields) => { if (error) { diff --git a/api/pyment-post-to-benifisher/pyment-post-to-benifisher.controllers.js b/api/pyment-post-to-benifisher/pyment-post-to-benifisher.controllers.js index 3736b0b..fbefa1f 100644 --- a/api/pyment-post-to-benifisher/pyment-post-to-benifisher.controllers.js +++ b/api/pyment-post-to-benifisher/pyment-post-to-benifisher.controllers.js @@ -8,6 +8,7 @@ const { updateElderReason, getAllPayReport, getCountGotMoney, + getBenifisherPayemtListByPayId, } = require("./pyment-post-to-benifisher.services"); const { checkPermision } = require("../../auth/roleauth"); @@ -94,6 +95,38 @@ module.exports = { }); }); }, + + getBenifisherPayemtListByPayId: (req, res) => { + const data = { + pay_id: req.params.pay_id, + }; + getBenifisherPayemtListByPayId(data, (err, result) => { + if (err) { + console.log(err); + return res.status(500).json({ + succcess: 0, + message: "Database Connection error", + }); + } + + return res.status(200).json({ + success: 1, + status: true, + total: 5, + last_page: 1, + per_page: 8, + current_page: 1, + next_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + prev_page_url: + "https://api.coloredstrategies.com/cakes/fordatatable?sort=&page=2&per_page=8", + from: 1, + to: 8, + data: result, + }); + }); + }, + getAllPayReport: (req, res) => { const div_id = req.params.div_id; diff --git a/api/pyment-post-to-benifisher/pyment-post-to-benifisher.routers.js b/api/pyment-post-to-benifisher/pyment-post-to-benifisher.routers.js index 5b75a13..cffb6ae 100644 --- a/api/pyment-post-to-benifisher/pyment-post-to-benifisher.routers.js +++ b/api/pyment-post-to-benifisher/pyment-post-to-benifisher.routers.js @@ -9,6 +9,7 @@ const { updateElderReason, getAllPayReport, getCountGotMoney, + getBenifisherPayemtListByPayId, } = require("./pyment-post-to-benifisher.controllers"); const { checkToken } = require("../../auth/token_validation"); @@ -22,6 +23,7 @@ router.get( checkToken, getBenifisherPayemtListByPostOffice ); +router.get("/payid/:pay_id", checkToken, getBenifisherPayemtListByPayId); router.get("/allpayreport/:div_id", checkToken, getAllPayReport); router.get("/elderhistory", checkToken, getElderHistory); router.get("/count/:id", checkToken, getCountGotMoney); diff --git a/api/pyment-post-to-benifisher/pyment-post-to-benifisher.services.js b/api/pyment-post-to-benifisher/pyment-post-to-benifisher.services.js index 286b676..bb1da60 100644 --- a/api/pyment-post-to-benifisher/pyment-post-to-benifisher.services.js +++ b/api/pyment-post-to-benifisher/pyment-post-to-benifisher.services.js @@ -4,7 +4,7 @@ module.exports = { InsertPaymetPostToBenifisher: (data, callBack) => { console.log(data); pool.query( - "INSERT INTO `payments_post_office_to_benifishers`( `elder_id`,`divisional_payment_id`, `district_id`, `divisional_id`, `post_office_id`, `agent_id`, `year`, `month`,`money_amount`, `ajent_available`)SELECT elder.elder_id, ? , elder.district_id, elder.divisional_secratory_id,elder.near_post_office_id, (SELECT agent.agent_id FROM agent WHERE agent.elder_id = elder.elder_id and agent.is_deleted = '0') as 'agent',? , ?, '1900' , IF((SELECT agent.agent_id FROM agent WHERE agent.elder_id = elder.elder_id and agent.is_deleted = '0') IS Null, '0', '1') as ajent_available FROM`elder`, `benifesher` WHERE elder.elder_id = benifesher.elder_id AND elder.is_deleted = '0' and benifesher.is_deleted = '0' AND elder.near_post_office_id = ? ", + "INSERT INTO `payments_post_office_to_benifishers`( `elder_id`,`divisional_payment_id`, `district_id`, `divisional_id`, `post_office_id`, `agent_id`, `year`, `month`,`money_amount`, `ajent_available`) SELECT elder.elder_id, ? , elder.district_id, elder.divisional_secratory_id,elder.near_post_office_id, (SELECT agent.agent_id FROM agent WHERE agent.elder_id = elder.elder_id and agent.agent_is_avilable='1' and agent.is_deleted = '0' LIMIT 1 ) as 'agent',? , ?, (SELECT constants.value FROM constants WHERE constants.name='amount_to_per_elder_recives' LIMIT 1) as 'pay' , IF((SELECT agent.agent_id FROM agent WHERE agent.elder_id = elder.elder_id and agent.agent_is_avilable='1' and agent.is_deleted = '0' LIMIT 1 ) IS Null, '0', '1') as ajent_available FROM`elder`, `benifesher` WHERE elder.elder_id = benifesher.elder_id AND elder.is_deleted = '0' and benifesher.is_deleted = '0' AND elder.near_post_office_id = ?", [data.divisional_payment_id, data.year, data.month, data.post_office_id], (error, results, fields) => { if (error) { @@ -43,7 +43,7 @@ module.exports = { }, getBenifisherPayemtListByPostOffice: (data, callBack) => { pool.query( - "SELECT payments_post_office_to_benifishers.payment_id as id ,elder.elder_id, elder.name , payments_post_office_to_benifishers.money_amount , IF(ajent_available = 1, 'Available', 'No') AS ajent_available , IF(is_taken_money = 1, 'Yes', 'No') AS is_taken_money ,elder.nic_id ,elder.number FROM `payments_post_office_to_benifishers` ,`elder` WHERE elder.elder_id = payments_post_office_to_benifishers.elder_id and elder.near_post_office_id=? and payments_post_office_to_benifishers.month = ? AND payments_post_office_to_benifishers.year=?", + "SELECT payments_post_office_to_benifishers.payment_id as id ,post_office_table.name as post ,months.m_name , payments_post_office_to_benifishers.divisional_payment_id,payments_devisional_to_post_office.is_completed , elder.elder_id, elder.name , payments_post_office_to_benifishers.money_amount , IF(ajent_available = 1, 'Available', 'No') AS ajent_available , IF(is_taken_money = 1, 'Yes', 'No') AS is_taken_money ,elder.nic_id ,elder.number FROM `payments_post_office_to_benifishers` ,`elder`,`months`,`payments_devisional_to_post_office` ,`post_office_table` WHERE post_office_table.post_office_id = payments_devisional_to_post_office.post_office_id and months.month_id = payments_post_office_to_benifishers.month and payments_post_office_to_benifishers.divisional_payment_id=payments_devisional_to_post_office.payment_id and elder.elder_id = payments_post_office_to_benifishers.elder_id and elder.near_post_office_id=? and payments_post_office_to_benifishers.month =? AND payments_post_office_to_benifishers.year=?", [data.post, data.month, data.year], (error, results, fields) => { if (error) { @@ -54,6 +54,19 @@ module.exports = { } ); }, + getBenifisherPayemtListByPayId: (data, callBack) => { + pool.query( + "SELECT payments_post_office_to_benifishers.payment_id as id ,elder.elder_id, elder.name , payments_post_office_to_benifishers.money_amount , IF(ajent_available = 1, 'Available', 'No') AS ajent_available , IF(is_taken_money = 1, 'Yes', 'No') AS is_taken_money ,elder.nic_id ,elder.number FROM `payments_post_office_to_benifishers` ,`elder` WHERE elder.elder_id = payments_post_office_to_benifishers.elder_id and payments_post_office_to_benifishers.divisional_payment_id=?", + [data.pay_id], + (error, results, fields) => { + if (error) { + console.log(results); + return callBack(error); + } + return callBack(null, results); + } + ); + }, payToElder: (data, callBack) => { pool.query( "UPDATE `payments_post_office_to_benifishers` SET`person_got_money`='elder', `is_taken_money` = '1',`date_and_time_got_money`=CURRENT_TIMESTAMP() WHERE `payments_post_office_to_benifishers`.`payment_id` = ?", @@ -82,7 +95,7 @@ module.exports = { }, getElderHistory: (data, callBack) => { pool.query( - "SELECT payments_devisional_to_post_office.year ,payments_devisional_to_post_office.month ,`reson_for_not_take_money`,(`reson_for_not_take_money` IS NOT NULL) as reason,payments_post_office_to_benifishers.payment_id,payments_post_office_to_benifishers.money_amount,payments_post_office_to_benifishers.person_got_money, payments_post_office_to_benifishers.date_and_time_got_money ,payments_post_office_to_benifishers.is_taken_money,payments_devisional_to_post_office.is_completed FROM `payments_post_office_to_benifishers`,`payments_devisional_to_post_office` WHERE payments_post_office_to_benifishers.divisional_payment_id = payments_devisional_to_post_office.payment_id AND `elder_id` = ? ORDER BY `payments_post_office_to_benifishers`.`payment_id` DESC", + "SELECT payments_devisional_to_post_office.year ,payments_devisional_to_post_office.month , months.m_name ,`reson_for_not_take_money`,(`reson_for_not_take_money` IS NOT NULL) as reason,payments_post_office_to_benifishers.payment_id,payments_post_office_to_benifishers.money_amount,payments_post_office_to_benifishers.person_got_money, payments_post_office_to_benifishers.date_and_time_got_money ,payments_post_office_to_benifishers.is_taken_money,payments_devisional_to_post_office.is_completed FROM `months`, `payments_post_office_to_benifishers`,`payments_devisional_to_post_office` WHERE months.month_id = payments_post_office_to_benifishers.month and payments_post_office_to_benifishers.divisional_payment_id = payments_devisional_to_post_office.payment_id AND `elder_id` = ? ORDER BY `payments_post_office_to_benifishers`.`payment_id` DESC", [data], (error, results, fields) => { if (error) { diff --git a/api/upload/upload.controller.js b/api/upload/upload.controller.js new file mode 100644 index 0000000..8e2f6fc --- /dev/null +++ b/api/upload/upload.controller.js @@ -0,0 +1,67 @@ +const { + getpropicname +} = require('./upload.service'); + +module.exports = { + propic: (req, res) => { + + if (!req.files) { + return res.status(500).send({ msg: "file is not found" }) + } + // accessing the file + const myFile = req.files.file; + + // mv() method places the file inside public directory + const name = req.auth.result.user_name + req.auth.result.user_id + Math.floor(Math.random() * 1000) +myFile.name.substring(myFile.name.length - 4); ; + + myFile.mv(`./public/profile/${name}`, function (err) { + if (err) { + console.log(err) + return res.send({name: name, path: `/uploads/profile/${name}`}); + } + // returing the response with file path and name + return res.send({name: name, path: `/uploads/profile/${name}`}); + }); + }, + + gardianpic: (req, res) => { + + if (!req.files) { + return res.status(500).send({ msg: "file is not found" }) + } + // accessing the file + const myFile = req.files.file; + + // mv() method places the file inside public directory + const name = req.auth.result.user_name + req.auth.result.user_id + Math.floor(Math.random() * 1000) +myFile.name.substring(myFile.name.length - 4); ; + + myFile.mv(`./public/guardian/${name}`, function (err) { + if (err) { + console.log(err) + return res.status(500).send({ msg: "Error occured" }); + } + // returing the response with file path and name + return res.send({name: name, path: `/uploads/guardian/${name}`}); + }); + }, + + getpropicname: (req, res) => { + const body = req.body; + getpropicname(body, (error, results) => { + if (error) { + console.log(error); + return res.status(500).json({ + success: 0, + message: "Database Connection error ", + }); + } + console.log(results) + return res.status(200).json({ + success: 1, + data: results, + }); + }); + + + } +}; diff --git a/api/upload/upload.router.js b/api/upload/upload.router.js new file mode 100644 index 0000000..83c2d42 --- /dev/null +++ b/api/upload/upload.router.js @@ -0,0 +1,24 @@ +const router = require("express").Router(); +const { checkToken} = require("../../auth/token_validation"); +const { + propic, + getpropicname, + gardianpic +} = require("./upload.controller"); + + + + + +router.post("/profile", checkToken, propic); +router.post("/guardianpic",checkToken,gardianpic); + +router.post("/getprofile",checkToken,getpropicname); + + + + + + + +module.exports = router; \ No newline at end of file diff --git a/api/upload/upload.service.js b/api/upload/upload.service.js new file mode 100644 index 0000000..b979764 --- /dev/null +++ b/api/upload/upload.service.js @@ -0,0 +1,16 @@ +const pool = require("../../config/database"); + +module.exports = { + getpropicname: (data, callBack) => { + pool.query( + "SELECT `profile` FROM `user` WHERE `id`=? AND `role_id` =?", + [data.id, data.role_id], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + } +} \ No newline at end of file diff --git a/api/users/user.controller.js b/api/users/user.controller.js index 49b78aa..7abfc2a 100644 --- a/api/users/user.controller.js +++ b/api/users/user.controller.js @@ -5,6 +5,9 @@ const { updateUser, deleteUser, getUserByUserName, + checkUsername, + changePass + } = require("./user.service"); const { tokenLogin } = require("../token/token.controller"); const { genSaltSync, hashSync, compareSync } = require("bcrypt"); @@ -32,6 +35,25 @@ module.exports = { }); }); }, + createElder: (req, res) => { + const body = req.body; + console.log(body.user_name); + const salt = genSaltSync(10); + body.password = hashSync(body.password, salt); + create(body,10,10,(err, results) => { + if (err) { + console.log(err); + return res.status(500).json({ + success: 0, + message: "Database connection errror", + }); + } + return res.status(200).json({ + success: 1, + data: results, + }); + }); + }, getUsers: (req, res) => { const rcid = { role_id: req.auth.result.role_id, @@ -151,11 +173,11 @@ module.exports = { } }); - //console.log(results); + console.log(results); const userData = { id: results.user_id, title: results.user_name, - img: "/assets/img/profiles/l-1.jpg", + img: results.profile, date: "Last seen today 15:24", role: results.role_id, }; @@ -166,11 +188,12 @@ module.exports = { token: jsontoken, refresh: refreshtoken, data: userData, + }); } else { return res.json({ success: 0, - data: "Invalid email or password", + message: "Invalid email or password", }); } }); @@ -215,4 +238,80 @@ module.exports = { }); }); }, + checkUsername: (req, res) => { + const body = req.body; + checkUsername(body.user_name,(err, results) => { + if (err) { + console.log(err); + return; + } + + if(!results.length == 0){ + return res.status(200).json({ + success: 1, + data: false, + }); + } + return res.status(200).json({ + success: 1, + data: true, + }); + + }); + }, + changePass: (req, res) => { + const body = req.body; +; + //body.password = hashSync(body.cpassword, salt); + //const result = compareSync(body.password, results.password); + console.log(req.auth.result.user_name) + getUserByUserName(req.auth.result.user_name, (err, results) => { + if (err) { + console.log(err); + } + if (!results) { + return res.json({ + success: 0, + message: "Error", + }); + } + const result = compareSync(body.password, results.password); + if(result){ + const salt = genSaltSync(10); + pass = hashSync(body.cpassword, salt) + changePass(pass,req.auth.result.user_id, (err, results) => { + if (err) { + console.log(err); + return; + } + + return res.json({ + success: 1, + message: "Password changed successfully", + }); + }); + + } + else{ + return res.json({ + success: 0, + message: "Wrong Current Password", + }); + } + }) + + + + + + + + + + + + + + }, + }; diff --git a/api/users/user.router.js b/api/users/user.router.js index 8e75e73..87bcdae 100644 --- a/api/users/user.router.js +++ b/api/users/user.router.js @@ -6,7 +6,10 @@ const { updateUsers, deleteUser, login, - refresh + refresh, + checkUsername, + createElder, + changePass } = require("./user.controller"); const { checkToken, checkRToken @@ -22,6 +25,9 @@ router.get("/:user_id",checkToken,getUserByUserId); router.patch("/",checkToken,updateUsers); router.delete("/",checkToken,deleteUser); router.post("/login",login); +router.post("/checkusername",checkUsername); +router.post("/elderreg",createElder); +router.post("/changepass",checkToken,changePass); diff --git a/api/users/user.service.js b/api/users/user.service.js index e93c8a3..e9fa2b2 100644 --- a/api/users/user.service.js +++ b/api/users/user.service.js @@ -1,9 +1,28 @@ const pool = require("../../config/database"); module.exports = { - create: (data, callBack) => { + create: (data,role,table, callBack) => { pool.query( - `INSERT INTO user(user_name,password,email,role_id) VALUES (?,?,?,?)`, - [data.user_name, data.password, data.email, data.role_id], + `INSERT INTO user(user_name,password,email,table_id,role_id) VALUES (?,?,?,?,?)`, + [data.userName, data.password, data.email,table,role], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + } + ); + }, + createOffUser: (data, callBack) => { + pool.query( + `INSERT INTO user(id,user_name,password,email,role_id,profile) VALUES (?,?,?,?,?,?)`, + [ + data.officer_id, + data.uname, + data.pword, + data.email, + data.role, + data.profile, + ], (error, results, fields) => { if (error) { return callBack(error); @@ -45,6 +64,18 @@ module.exports = { } ); }, + updateIdByUserId:(data, callBack) => { + pool.query( + `UPDATE user SET id=? , profile=? WHERE user_id=?`, + [data.id, data.profile, data.user_id], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results[0]); + } + ); + }, deleteUser: (data, callBack) => { pool.query( `delete from user WHERE user_id=?`, @@ -69,4 +100,25 @@ module.exports = { } ); }, + + checkUsername: (userName,callBack) => { + pool.query(`SELECT * FROM user WHERE user_name=?`, [userName], (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results); + }); + }, + changePass: (id,pass, callBack) => { + pool.query( + `UPDATE user SET password=? WHERE user_id=?`, + [pass,id], + (error, results, fields) => { + if (error) { + return callBack(error); + } + return callBack(null, results[0]); + } + ); + }, }; diff --git a/api/verify_elder/verify_elder.controller.js b/api/verify_elder/verify_elder.controller.js index 90f7334..e75fd5a 100644 --- a/api/verify_elder/verify_elder.controller.js +++ b/api/verify_elder/verify_elder.controller.js @@ -123,6 +123,7 @@ module.exports = { }, updateVerifyElderAfterGramAccept: (req, res) => { const body = req.body; + body.gramaniladari_id = req.auth.result.id; updateVerifyElderAfterGramAccept(body, (err, results) => { if (err) { console.log(err); @@ -137,6 +138,7 @@ module.exports = { }, updateVerifyElderAfterGramDisQualified: (req, res) => { const body = req.body; + body.gramaniladari_id = req.auth.result.id; updateVerifyElderAfterGramDisQualified(body, (err, results) => { if (err) { console.log(err); diff --git a/app.js b/app.js index 3439cd1..9db34c0 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,8 @@ require("dotenv").config(); +var cors = require('cors') const express = require("express"); const app = express(); +const fileUpload = require('express-fileupload'); const userRouter = require("./api/users/user.router"); const tokenRouter = require("./api/token/token.router"); @@ -22,8 +24,13 @@ const paymentdivtopost = require("./api/payment-div-to-post/payment-div-to-post. const paymentposttoben = require("./api/pyment-post-to-benifisher/pyment-post-to-benifisher.routers"); const deadcomplainRouter = require("./api/deaths_complains/deaths_complains.routers") const marksRouter = require("./api/marks/marks.router"); -app.use(express.json()); +const uploadR =require("./api/upload/upload.router") +const notification = require("./api/notification/notification.router"); + +app.use(fileUpload()); +app.use(express.json()); +app.use(cors()); app.use("/api/users", userRouter); app.use("/api/elders", elderRouter); app.use("/api/token", tokenRouter); @@ -45,6 +52,11 @@ app.use("/api/paymentposttoben", paymentposttoben); app.use("/api/deadcomplain", deadcomplainRouter); app.use("/api/application",application) app.use("/api/marks", marksRouter); +app.use("/api/upload", uploadR) + +app.use("/api/notification", notification); + +app.use('/api/uploads', express.static(__dirname + '/public')); /* diff --git a/auth/notification.js b/auth/notification.js new file mode 100644 index 0000000..68eb199 --- /dev/null +++ b/auth/notification.js @@ -0,0 +1,37 @@ + +require("dotenv").config(); +module.exports = { + sendMesssage : (req, callBack) =>{ + + + const axios = require('axios'); + urlbn=`https://app.newsletters.lk/smsAPI?sendsms&apikey=bEkSzJ4Y0KsmF82cNWhtCyTlQdaWvwKP&apitoken=e9r71595703720&type=sms&from=IPM CEYLON&route=0&to=${req.pnum}&text=${req.text}` + axios.get(urlbn) + .then(response => { + // console.log("sss"); + return callBack(response) + }) + .catch(error => { + + console.log("Error "+error); + }); + + + + + + + + + + + + + + + + + + } + +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4811751..0c985f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,154 +4,6 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "@babel/generator": { - "version": "7.12.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz", - "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==", - "requires": { - "@babel/types": "^7.12.5", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "@babel/helper-function-name": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", - "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", - "requires": { - "@babel/helper-get-function-arity": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", - "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", - "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", - "requires": { - "@babel/types": "^7.11.0" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==" - }, - "@babel/highlight": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - } - } - }, - "@babel/parser": { - "version": "7.12.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz", - "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==" - }, - "@babel/template": { - "version": "7.12.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz", - "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==", - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/parser": "^7.12.7", - "@babel/types": "^7.12.7" - } - }, - "@babel/traverse": { - "version": "7.12.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz", - "integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==", - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.5", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/parser": "^7.12.7", - "@babel/types": "^7.12.7", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.19" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, - "@babel/types": { - "version": "7.12.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz", - "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==", - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -167,11 +19,6 @@ "defer-to-connect": "^1.0.1" } }, - "@types/node": { - "version": "14.14.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.10.tgz", - "integrity": "sha512-J32dgx2hw8vXrSbu4ZlVhn1Nm3GbeCFNw2FWL8S5QKucHGY0cyNwjdQdO+KMBZ4wpmC7KhLCiNsdk1RFRIYUQQ==" - }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -218,15 +65,11 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "requires": { "color-convert": "^2.0.1" } }, - "any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" - }, "anymatch": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", @@ -256,6 +99,14 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "axios": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz", + "integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -281,11 +132,6 @@ "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", "dev": true }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" - }, "body-parser": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", @@ -342,6 +188,14 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, + "busboy": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz", + "integrity": "sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw==", + "requires": { + "dicer": "0.3.0" + } + }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -382,7 +236,8 @@ "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true }, "chalk": { "version": "3.0.0", @@ -444,31 +299,6 @@ "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "dev": true }, - "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, "clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", @@ -478,15 +308,6 @@ "mimic-response": "^1.0.0" } }, - "cls-bluebird": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cls-bluebird/-/cls-bluebird-2.1.0.tgz", - "integrity": "sha1-N+8eCAqP+1XC9BZPU28ZGeeWiu4=", - "requires": { - "is-bluebird": "^1.0.2", - "shimmer": "^1.1.0" - } - }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -496,6 +317,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "requires": { "color-name": "~1.1.4" } @@ -503,7 +325,8 @@ "color-name": { "version": "1.1.4", "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 }, "concat-map": { "version": "0.0.1", @@ -566,6 +389,15 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", @@ -580,11 +412,6 @@ "ms": "2.0.0" } }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" - }, "decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -630,6 +457,14 @@ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, + "dicer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz", + "integrity": "sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA==", + "requires": { + "streamsearch": "0.1.2" + } + }, "dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -644,11 +479,6 @@ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" }, - "dottie": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.2.tgz", - "integrity": "sha512-fmrwR04lsniq/uSr8yikThDTrM7epXHBAAjH9TbeH3rEA8tdCO7mRzB9hdmdGyJCxF8KERo9CITcm3kGuoyMhg==" - }, "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", @@ -699,11 +529,6 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -746,6 +571,14 @@ "vary": "~1.1.2" } }, + "express-fileupload": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/express-fileupload/-/express-fileupload-1.2.0.tgz", + "integrity": "sha512-oe4WpKcSppXnl5peornawWUa6tKmIc1/kJxMNRGJR1A0v4zyLL6VsFR6wZ8P2a4Iq3aGx8xae3Vlr+MOMQhFPw==", + "requires": { + "busboy": "^0.3.1" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -769,14 +602,10 @@ "unpipe": "~1.0.0" } }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } + "follow-redirects": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz", + "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==" }, "forwarded": { "version": "0.1.2", @@ -788,16 +617,6 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, "fs-minipass": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", @@ -874,11 +693,6 @@ "is-property": "^1.0.2" } }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" - }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -919,11 +733,6 @@ "ini": "^1.3.5" } }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" - }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -946,12 +755,14 @@ "graceful-fs": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true }, "has-unicode": { "version": "2.0.1", @@ -1016,11 +827,6 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "inflection": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.12.0.tgz", - "integrity": "sha1-ogCTVlbW9fa8TcdQLhrstwMihBY=" - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1036,9 +842,9 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "ipaddr.js": { "version": "1.9.1", @@ -1059,11 +865,6 @@ "binary-extensions": "^2.0.0" } }, - "is-bluebird": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-bluebird/-/is-bluebird-1.0.2.tgz", - "integrity": "sha1-CWQ5Bg9KpBGr7hkUOoTWpVNG1uI=" - }, "is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", @@ -1149,30 +950,12 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" - }, "json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", "dev": true }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, "jsonwebtoken": { "version": "8.5.1", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", @@ -1234,19 +1017,6 @@ "package-json": "^6.3.0" } }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - }, "lodash.includes": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", @@ -1402,19 +1172,6 @@ "minimist": "^1.2.5" } }, - "moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" - }, - "moment-timezone": { - "version": "0.5.32", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.32.tgz", - "integrity": "sha512-Z8QNyuQHQAmWucp8Knmgei8YNo28aLjJq6Ma+jy1ZSpSk5nyfRT8xgUbSQvD2+2UajISfenndwvFuH3NGS+nvA==", - "requires": { - "moment": ">= 2.9.0" - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -1689,27 +1446,6 @@ "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", "dev": true }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" - }, "package-json": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", @@ -1735,11 +1471,6 @@ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" - }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1879,16 +1610,6 @@ "rc": "^1.2.8" } }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" - }, "responselike": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", @@ -1898,14 +1619,6 @@ "lowercase-keys": "^1.0.0" } }, - "retry-as-promised": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-3.2.0.tgz", - "integrity": "sha512-CybGs60B7oYU/qSQ6kuaFmRd9sTZ6oXSc0toqePvV74Ac6/IFZSI1ReFQmtCN+uvW1Mtqdwpvt/LGOiCBAY2Mg==", - "requires": { - "any-promise": "^1.3.0" - } - }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -1983,127 +1696,6 @@ "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", "integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=" }, - "sequelize": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.3.5.tgz", - "integrity": "sha512-MiwiPkYSA8NWttRKAXdU9h0TxP6HAc1fl7qZmMO/VQqQOND83G4nZLXd0kWILtAoT9cxtZgFqeb/MPYgEeXwsw==", - "requires": { - "debug": "^4.1.1", - "dottie": "^2.0.0", - "inflection": "1.12.0", - "lodash": "^4.17.15", - "moment": "^2.26.0", - "moment-timezone": "^0.5.31", - "retry-as-promised": "^3.2.0", - "semver": "^7.3.2", - "sequelize-pool": "^6.0.0", - "toposort-class": "^1.0.1", - "uuid": "^8.1.0", - "validator": "^10.11.0", - "wkx": "^0.5.0" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" - } - } - }, - "sequelize-automate": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/sequelize-automate/-/sequelize-automate-1.2.2.tgz", - "integrity": "sha512-Go9TQR8wA6fajyq0Vtws32Wq5AmPDfSZ5k9zjtP7rIPiWbaCqXYlxEjRBJXEs9WG/KVpxShK6BqNH9kCvOyw8Q==", - "requires": { - "@babel/generator": "^7.7.4", - "@babel/parser": "^7.7.5", - "@babel/traverse": "^7.7.4", - "@babel/types": "^7.7.4", - "debug": "^4.1.1", - "fs-extra": "^8.1.0", - "lodash": "^4.17.15", - "sequelize": "^5.21.2", - "yargs": "^15.0.2" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - }, - "sequelize": { - "version": "5.22.3", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-5.22.3.tgz", - "integrity": "sha512-+nxf4TzdrB+PRmoWhR05TP9ukLAurK7qtKcIFv5Vhxm5Z9v+d2PcTT6Ea3YAoIQVkZ47QlT9XWAIUevMT/3l8Q==", - "requires": { - "bluebird": "^3.5.0", - "cls-bluebird": "^2.1.0", - "debug": "^4.1.1", - "dottie": "^2.0.0", - "inflection": "1.12.0", - "lodash": "^4.17.15", - "moment": "^2.24.0", - "moment-timezone": "^0.5.21", - "retry-as-promised": "^3.2.0", - "semver": "^6.3.0", - "sequelize-pool": "^2.3.0", - "toposort-class": "^1.0.1", - "uuid": "^3.3.3", - "validator": "^10.11.0", - "wkx": "^0.4.8" - } - }, - "sequelize-pool": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/sequelize-pool/-/sequelize-pool-2.3.0.tgz", - "integrity": "sha512-Ibz08vnXvkZ8LJTiUOxRcj1Ckdn7qafNZ2t59jYHMX1VIebTAOYefWdRYFt6z6+hy52WGthAHAoLc9hvk3onqA==" - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" - }, - "wkx": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.4.8.tgz", - "integrity": "sha512-ikPXMM9IR/gy/LwiOSqWlSL3X/J5uk9EO2hHNRXS41eTLXaUFEVw9fn/593jW/tE5tedNg8YjT5HkCa4FqQZyQ==", - "requires": { - "@types/node": "*" - } - } - } - }, - "sequelize-pool": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/sequelize-pool/-/sequelize-pool-6.1.0.tgz", - "integrity": "sha512-4YwEw3ZgK/tY/so+GfnSgXkdwIJJ1I32uZJztIEgZeAO6HMgj64OzySbWLgxj+tXhZCJnzRfkY9gINw8Ft8ZMg==" - }, "serve-static": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", @@ -2125,21 +1717,11 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" }, - "shimmer": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz", - "integrity": "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==" - }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - }, "sqlstring": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", @@ -2150,10 +1732,16 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, + "streamsearch": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", + "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=" + }, "string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -2163,22 +1751,26 @@ "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, "requires": { "ansi-regex": "^5.0.0" } @@ -2211,6 +1803,7 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, "requires": { "has-flag": "^3.0.0" } @@ -2235,11 +1828,6 @@ "integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==", "dev": true }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" - }, "to-readable-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", @@ -2260,11 +1848,6 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" }, - "toposort-class": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz", - "integrity": "sha1-f/0feMi+KMO6Rc1OGj9e4ZO9mYg=" - }, "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", @@ -2316,11 +1899,6 @@ "crypto-random-string": "^2.0.0" } }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -2366,26 +1944,11 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, - "uuid": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz", - "integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==" - }, - "validator": { - "version": "10.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-10.11.0.tgz", - "integrity": "sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==" - }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" - }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -2427,39 +1990,6 @@ "string-width": "^4.0.0" } }, - "wkx": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.5.0.tgz", - "integrity": "sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg==", - "requires": { - "@types/node": "*" - } - }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -2483,42 +2013,10 @@ "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" - }, "yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - }, - "yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - } - }, - "yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } } } } diff --git a/package.json b/package.json index 4d8c4f3..2cf6013 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,13 @@ }, "homepage": "https://github.com/prshanilka/GroupProject11_backend#readme", "dependencies": { + "axios": "^0.21.0", "bcrypt": "^5.0.0", "cookie-parser": "^1.4.5", + "cors": "^2.8.5", "dotenv": "^8.2.0", "express": "^4.17.1", + "express-fileupload": "^1.2.0", "ipware": "^2.0.0", "jsonwebtoken": "^8.5.1", "mysql": "^2.18.1", diff --git a/sequelize-aucsadasdto b/public/guardian/phot.txt similarity index 100% rename from sequelize-aucsadasdto rename to public/guardian/phot.txt diff --git a/public/profile/divoffoff23263.jpg b/public/profile/divoffoff23263.jpg new file mode 100644 index 0000000..c0e5fad Binary files /dev/null and b/public/profile/divoffoff23263.jpg differ diff --git a/public/profile/divoffoff23555.zip b/public/profile/divoffoff23555.zip new file mode 100644 index 0000000..9e8fc84 Binary files /dev/null and b/public/profile/divoffoff23555.zip differ diff --git a/public/profile/divoffoff23798.PNG b/public/profile/divoffoff23798.PNG new file mode 100644 index 0000000..e7eb0a6 Binary files /dev/null and b/public/profile/divoffoff23798.PNG differ diff --git a/public/profile/index.jpg b/public/profile/index.jpg new file mode 100644 index 0000000..c851b14 Binary files /dev/null and b/public/profile/index.jpg differ diff --git a/public/profile/mohom.jpg b/public/profile/mohom.jpg new file mode 100644 index 0000000..278ac9b Binary files /dev/null and b/public/profile/mohom.jpg differ diff --git a/sequelize-auto b/sequelize-auto deleted file mode 100644 index e69de29..0000000