--- a/controllers/controllerV0.js
+++ b/controllers/controllerV0.js
@@ -50,11 +50,11 @@
]
}
-*/
-module.exports.createNotifications= function (req, res) {
- logger.info("Request type: ",req.method, "Request URL: ", req.originalUrl);
- var handler = "backend.controllers.createNotifications";
- logger.info("Starting: ",handler);
+ */
+ module.exports.createNotifications= function (req, res) {
+ logger.info("Request type: ",req.method, "Request URL: ", req.originalUrl);
+ var handler = "backend.controllers.createNotifications";
+ logger.info("Starting: ",handler);
//Check if request body is not empty
if(Object.keys(req.body).length != 0){
//Check if Token Exists
@@ -162,8 +162,8 @@
logger.info("Request type:",req.method, "Request URL:", req.originalUrl);
var handler = "backend.controllers.getStatistics";
logger.info("Starting: ",handler);
- ruleid = req.params.ruleid;
- database.retrieveStatisticsList(ruleid, function(isOK, rows, total){
+ rulesid = req.params.rulesid;
+ database.retrieveStatisticsList(rulesid, function(isOK, rows, total){
if(!isOK) {
logger.info(handler,rows);
sendResponse(500, {success:false, data:rows,total},"Get Statistics: "+rows,res);
@@ -202,6 +202,37 @@
}else {
logger.info(handler,data);
sendResponse(200, {success: true, data:data},"Delete Rule: Success",res);
+ }
+ });
+};
+
+module.exports.editRule= function (req, res) {
+ logger.info("Request type: ",req.method, "Request URL: ", req.originalUrl);
+ var handler = "backend.controllers.editRule";
+ logger.info("Starting: ",handler);
+ database.updateRule(req.body, function(isOK, data){
+ if(!isOK) {
+ logger.info(handler,data);
+ sendResponse(500, {success:false, data:rows},"Update Rule: "+data, res);
+ }else {
+ logger.info(handler,data);
+ sendResponse(200, {success: true, data:data},"Update Rule: Success",res);
+ }
+ });
+};
+
+module.exports.getAllRule= function (req, res) {
+ logger.info("Request type: ",req.method, "Request URL: ", req.originalUrl);
+ var handler = "backend.controllers.getNotifications";
+ logger.info("Starting: ",handler);
+ rulesid = req.params.rulesid;
+ database.retrieveAllRule(rulesid, function(isOK, rows){
+ if(!isOK) {
+ logger.info(handler,rows);
+ sendResponse(500, {success:false, data:rows},"Get All Specific Rule: "+rows, res);
+ }else {
+ logger.info(handler,rows);
+ sendResponse(200, {success: true, data:rows},"Get All Specific Rule: Success",res);
}
});
};