--- a/controllers/controllerV0.js
+++ b/controllers/controllerV0.js
@@ -55,7 +55,31 @@
if(isOK) {
controllerNotification.notificationsCheck(req.body, function(isOK, reason){
if(isOK) {
- database.insertNotification(req.body, function(isOK, data){
+ sendResponse(200, {success: true, reason:reason},"Notification: Success", res);
+ }else {
+ sendResponse(500, {success: false, reason: reason},"Notification: "+reason, res);
+ }
+ });
+ }else{
+ logger.error(handler);
+ sendResponse(500, {success: false, reason: reason},"Check Token: "+reason, res);
+ res.end();
+ }
+ });
+ }
+}
+
+/*
+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);
+ if(Object.keys(req.body).length != 0){
+ database.checkIfTokenExists(req.body, function(isOK, reason){
+ if(isOK) {
+ controllerNotification.notificationsCheck(req.body, function(isOK, reason){
+ if(isOK) {
+ database.insertNotification(reason, function(isOK, data){
if(!isOK) {
logger.info(handler,data);
sendResponse(500, {success:false, data:data},"Insert Notification: "+data, res);
@@ -78,7 +102,7 @@
res.end();
}
};
-
+*/
module.exports.createNotificationsRules= function (req, res) {
logger.info("Request type: ",req.method, "Request URL: ", req.originalUrl);
var handler = "backend.controllers.createNotificationsRules";
@@ -160,10 +184,10 @@
database.deleteVapp(appid, function(isOK, data){
if(!isOK) {
logger.info(handler,data);
- sendResponse(500, {success:false},"Delete Vapp: "+data,res);
- }else {
- logger.info(handler,data);
- sendResponse(200, {success: true},"Delete Vapp: Success",res);
+ sendResponse(500, {success:false, data:data},"Delete Vapp: "+data,res);
+ }else {
+ logger.info(handler,data);
+ sendResponse(200, {success: true, data:data},"Delete Vapp: Success",res);
}
});
};
@@ -176,10 +200,10 @@
database.deleteRule(rulesid, function(isOK, data){
if(!isOK) {
logger.info(handler,data);
- sendResponse(500, {success:false},"Delete Rule: "+data,res);
- }else {
- logger.info(handler,data);
- sendResponse(200, {success: true},"Delete Rule: Success",res);
+ sendResponse(500, {success:false, data:data},"Delete Rule: "+data,res);
+ }else {
+ logger.info(handler,data);
+ sendResponse(200, {success: true, data:data},"Delete Rule: Success",res);
}
});
};