Skip to content

Commit

Permalink
Merge pull request #18 from SachinAkash01/main
Browse files Browse the repository at this point in the history
Remove Unused Code
  • Loading branch information
SachinAkash01 authored May 1, 2024
2 parents c7d4a5a + 74f00d7 commit f561ec6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 72 deletions.
36 changes: 0 additions & 36 deletions GramaNiladhariCertificateService/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -156,42 +156,6 @@ service / on new http:Listener(8080) {
return allData;
}

//get details of users (to certificate generation)
resource function get getCompletedReq/[string id]() returns json|error? {
boolean valid = false;
string nic ="";
map<json> queryString = {"id": id, "status": "completed"};
stream<requestCompletedCheck, error?> result = check mongoClient->find(collectionName = "requests", filter = (queryString));
json[] allData = [];

check result.forEach(function(requestCompletedCheck datas) {
valid = true;
nic = datas.NIC;
});

if (valid){
map<json> queryString1 = {"NIC": nic};
stream<requestCompletedData, error?> resultData = check mongoClient->find(collectionName = "citizen", filter = queryString1);

check resultData.forEach(function(requestCompletedData data) {
json dataJson = {
"NIC": data.NIC,
"fullname": data.fullname,
"address": data.address,
"DoB": data.DoB,
"maritalstatus": data.maritalStatus
};
allData.push(dataJson);
});
json responseData = {"id": id, "data": allData[0]};

return responseData;
}
else{
return ();
}
}

//Updating user request status
resource function put updateRequest/[string id]/[string status]() returns int|error {

Expand Down
36 changes: 0 additions & 36 deletions PoliceCertificateService/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -150,42 +150,6 @@ service / on new http:Listener(4040) {
return allData;
}

//get details of users (to certificate generation)
resource function get getCompletedReq/[string id]() returns json|error? {
boolean valid = false;
string nic ="";
map<json> queryString = {"id": id, "status": "completed"};
stream<requestCompletedCheck, error?> result = check mongoClient->find(collectionName = "policeRequests", filter = (queryString));
json[] allData = [];

check result.forEach(function(requestCompletedCheck datas) {
valid = true;
nic = datas.NIC;
});

if (valid){
map<json> queryString1 = {"NIC": nic};
stream<requestCompletedData, error?> resultData = check mongoClient->find(collectionName = "police", filter = queryString1);

check resultData.forEach(function(requestCompletedData data) {
json dataJson = {
"NIC": data.NIC,
"fullname": data.fullname,
"address": data.address,
"DoB": data.DoB,
"criminalstatus": data.criminalStatus
};
allData.push(dataJson);
});
json responseData = {"id": id, "data": allData[0]};

return responseData;
}
else{
return ();
}
}

//Updating user request status
resource function put updateRequest/[string id]/[string status]() returns int|error {

Expand Down

0 comments on commit f561ec6

Please sign in to comment.