Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sahan #84

Open
wants to merge 106 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
1642a00
post complain
pathum96 Dec 3, 2020
2d5adf4
Merge branch 'pathum' of https://github.com/prshanilka/GroupProject11…
pathum96 Dec 3, 2020
a421e4a
postComplain
pathum96 Dec 3, 2020
833a398
Merge branch 'pathum' of https://github.com/prshanilka/GroupProject11…
pathum96 Dec 3, 2020
aa35f8f
cross
prshanilka Dec 4, 2020
da0f940
Merge pull request #64 from prshanilka/ramesh
khslsahan Dec 4, 2020
6c5e174
the pay structure
khslsahan Dec 4, 2020
5f8c4de
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 4, 2020
cc5e305
pay pay
khslsahan Dec 4, 2020
48c92af
complain handle
pathum96 Dec 4, 2020
f753c5b
Merge pull request #65 from prshanilka/sahan
khslsahan Dec 4, 2020
d13e186
Merge pull request #66 from prshanilka/pathum
khslsahan Dec 4, 2020
5c926e9
Merge pull request #67 from prshanilka/sahan
pathum96 Dec 4, 2020
91ff8f3
the print
khslsahan Dec 5, 2020
2c7aea8
change agent
pathum96 Dec 5, 2020
e286ef9
Merge pull request #68 from prshanilka/pathum
khslsahan Dec 5, 2020
70a66ee
print reports
khslsahan Dec 5, 2020
a520d95
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 5, 2020
a745676
Merge pull request #69 from prshanilka/sahan
prshanilka Dec 6, 2020
daeb045
update
khslsahan Dec 6, 2020
24b3737
Criteria
pathum96 Dec 6, 2020
38bac36
elder reg
khslsahan Dec 6, 2020
93e4df0
Constant
pathum96 Dec 6, 2020
11cf37d
Merge branch 'sahan' into pathum
khslsahan Dec 6, 2020
960eb65
Merge pull request #70 from prshanilka/pathum
khslsahan Dec 6, 2020
2d3f9c4
post
khslsahan Dec 6, 2020
5377648
Merge pull request #71 from prshanilka/sahan
pathum96 Dec 6, 2020
12dce70
Grama Dashboard
pathum96 Dec 6, 2020
074965b
pull end
khslsahan Dec 7, 2020
b6097e9
Merge pull request #72 from prshanilka/pathum
khslsahan Dec 7, 2020
60edf49
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 7, 2020
0cda01e
grama report
pathum96 Dec 7, 2020
acbc74f
Register
prshanilka Dec 7, 2020
e8ef838
Merge branch 'ramesh' into sahan
prshanilka Dec 9, 2020
23d5b86
Merge pull request #73 from prshanilka/sahan
prshanilka Dec 9, 2020
5186589
Merge pull request #74 from prshanilka/ramesh
khslsahan Dec 9, 2020
03717c5
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 9, 2020
3299382
The update
khslsahan Dec 10, 2020
54453d6
red
prshanilka Dec 13, 2020
8e4a622
screan shoot
khslsahan Dec 13, 2020
e4cddda
Merge pull request #75 from prshanilka/sahan
pathum96 Dec 14, 2020
542f285
Merge pull request #76 from prshanilka/sahan
prshanilka Dec 20, 2020
14094e9
dofficer dashboard
pathum96 Dec 20, 2020
468588e
sms
prshanilka Dec 20, 2020
7461344
Merge pull request #77 from prshanilka/ramesh
khslsahan Dec 20, 2020
3012621
smsSahan
khslsahan Dec 20, 2020
733dc2a
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 20, 2020
22bd21e
Merge pull request #78 from prshanilka/pathum
khslsahan Dec 20, 2020
b8f80e7
the notify
khslsahan Dec 20, 2020
35b7a05
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 20, 2020
6d6401e
Merge pull request #79 from prshanilka/sahan
pathum96 Dec 20, 2020
87f2a2d
notification
khslsahan Dec 21, 2020
813490c
Merge pull request #80 from prshanilka/sahan
pathum96 Dec 21, 2020
aabe2ed
Merge https://github.com/prshanilka/GroupProject11_backend into pathum
pathum96 Dec 21, 2020
41eac79
Merge branch 'pathum' of https://github.com/prshanilka/GroupProject11…
pathum96 Dec 21, 2020
44d7cc3
Merge pull request #82 from prshanilka/pathum
khslsahan Dec 22, 2020
20c8b36
password change /user/changepass
prshanilka Dec 22, 2020
f2a0c6f
the elder
khslsahan Dec 23, 2020
7fd27d3
Merge pull request #85 from prshanilka/sahan
khslsahan Dec 23, 2020
605b328
Merge pull request #83 from prshanilka/ramesh
khslsahan Dec 23, 2020
2b7b720
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 23, 2020
ede8792
upload
prshanilka Dec 24, 2020
07df043
Merge branch 'ramesh' of https://github.com/prshanilka/GroupProject11…
prshanilka Dec 24, 2020
c81fc0b
Merge pull request #86 from prshanilka/ramesh
khslsahan Dec 24, 2020
51a430e
userAccount
pathum96 Dec 24, 2020
9134d8f
Merge pull request #87 from prshanilka/pathum
khslsahan Dec 24, 2020
83caf3d
user image
khslsahan Dec 24, 2020
dee2d4e
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 24, 2020
9499c9c
Merge pull request #88 from prshanilka/sahan
prshanilka Dec 25, 2020
47c96a5
g
prshanilka Dec 25, 2020
f7af757
Merge branch 'ramesh' of https://github.com/prshanilka/GroupProject11…
prshanilka Dec 25, 2020
cce618e
Merge pull request #89 from prshanilka/ramesh
khslsahan Dec 25, 2020
cf2830f
image
prshanilka Dec 25, 2020
d4e527e
image
prshanilka Dec 25, 2020
6c3125b
Merge pull request #90 from prshanilka/ramesh
khslsahan Dec 25, 2020
b605bec
bena
prshanilka Dec 25, 2020
6f7740b
Merge pull request #91 from prshanilka/ramesh
khslsahan Dec 25, 2020
2b28234
profile
khslsahan Dec 25, 2020
31405dd
Merge pull request #92 from prshanilka/sahan
pathum96 Dec 25, 2020
4faa410
photos
khslsahan Dec 25, 2020
d5ccba1
advance search
khslsahan Dec 26, 2020
5cd368d
Merge pull request #93 from prshanilka/sahan
pathum96 Dec 26, 2020
1a0bc96
Merge pull request #94 from prshanilka/sahan
prshanilka Dec 26, 2020
5324f2d
pay
khslsahan Dec 26, 2020
7a64b95
Merge pull request #95 from prshanilka/sahan
pathum96 Dec 27, 2020
ee6451c
Merge pull request #96 from prshanilka/pathum
khslsahan Dec 27, 2020
5048eb4
test elder
khslsahan Dec 27, 2020
d40e699
Merge pull request #97 from prshanilka/sahan
pathum96 Dec 28, 2020
8c5df2c
test 4
khslsahan Dec 28, 2020
980126f
Merge pull request #98 from prshanilka/ramesh
khslsahan Dec 28, 2020
0373a7e
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 28, 2020
8a1ae8a
Merge pull request #99 from prshanilka/pathum
khslsahan Dec 28, 2020
0cdeef3
Merge branch 'sahan' of https://github.com/prshanilka/GroupProject11_…
khslsahan Dec 28, 2020
2ce377a
dwd
prshanilka Dec 28, 2020
efc3f2f
Merge pull request #100 from prshanilka/sahan
prshanilka Dec 28, 2020
75d1111
Merge pull request #101 from prshanilka/ramesh
khslsahan Dec 28, 2020
9181f59
test 5
khslsahan Dec 28, 2020
6db26c1
test 5
khslsahan Dec 28, 2020
e57f555
phots
khslsahan Dec 28, 2020
679c83f
Merge pull request #103 from prshanilka/sahan
prshanilka Dec 28, 2020
6fbb917
dsf
prshanilka Dec 28, 2020
58e82e9
fg
prshanilka Dec 28, 2020
b068d49
Merge branch 'ramesh' of https://github.com/prshanilka/GroupProject11…
prshanilka Dec 28, 2020
56e6daa
new phots
khslsahan Dec 28, 2020
ec8936b
Merge pull request #105 from prshanilka/sahan
prshanilka Dec 28, 2020
37f3820
Merge pull request #107 from prshanilka/ramesh
khslsahan Jan 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file added GroupProject11_backend.zip
Binary file not shown.
136 changes: 134 additions & 2 deletions api/agent/agent.conrollers.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const {
getAgentByAgentID,
getAgentByElderID,
getQulifyAgentByElderID,
getAgent,
createAgent,
updateAgent,
deleteAgent,
updateDisqulifyAgent,
} = require("./agent.services");

const { sign } = require("jsonwebtoken");
Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand All @@ -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({
Expand All @@ -102,6 +233,7 @@ module.exports = {
});
});
},

deleteAgent: (req, res) => {
const body = req.body;
deleteAgent(body, (error, results) => {
Expand Down
13 changes: 10 additions & 3 deletions api/agent/agent.routers.js
Original file line number Diff line number Diff line change
@@ -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;
55 changes: 45 additions & 10 deletions api/agent/agent.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -26,14 +50,15 @@ 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,
data.nic,
data.address,
data.phone,
data.email,
data.pic,
data.relation_with_elder,
],
(error, results, fields) => {
Expand All @@ -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) => {
Expand All @@ -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`=?",
Expand Down
Binary file removed api/application.rar
Binary file not shown.
Loading