vicinityManager/server/services/nodes/processNode.js
/*
Change node status to deleted in MONGO
Remove node from commServer
Remove all oids under node from commServer AND MONGO
*/
Change node status to deleted in MONGO
Remove node from commServer
Remove all oids under node from commServer AND MONGO
Change node status to deleted in MONGO Remove node from commServer Remove all oids under node from commServer AND MONGO
function deleteNode(adids, email, userId){
  return new Promise(function(resolve, reject) {
    if(adids.length > 0){ 
      logger.debug('Start async handler...' + adids);
      sync.forEachAll(adids,
        function(value, allresult, next, otherParams) {
          deletingNodes(value, otherParams, function(value, result) {
              allresult.push({value: value, result: result});
              next();
          });
        },
        function(allresult) {
          if(allresult.length === adids.length){
            resolve({"error": false, "message": allresult });
          }
        },
        false,
        {userMail:email, userId: userId}
      );
    } else {
      logger.warn({user: email, action: 'deleteNodes', message: "No nodes found to be removed"});
      resolve({"error": false, "message": "Nothing to be removed..."});
    }
  });
}
function deleteNode ( adids , email , userId ) { return new Promise ( function ( resolve , reject ) { if ( adids . length > 0 ) { logger . debug ( 'Start async handler...' + adids ) ; sync . forEachAll ( adids , function ( value , allresult , next , otherParams ) { deletingNodes ( value , otherParams , function ( value , result ) { allresult . push ( { value : value , result : result } ) ; next ( ) ; } ) ; } , function ( allresult ) { if ( allresult . length === adids . length ) { resolve ( { "error" : false , "message" : allresult } ) ; } } , false , { userMail : email , userId : userId } ) ; } else { logger . warn ( { user : email , action : 'deleteNodes' , message : "No nodes found to be removed" } ) ; resolve ( { "error" : false , "message" : "Nothing to be removed..." } ) ; } } ) ; }
Change node status to deleted in MONGO
Remove node from commServer
Remove all oids under node from commServer AND MONGO
Change node status to deleted in MONGO Remove node from commServer Remove all oids under node from commServer AND MONGO
// Check if there is any item to delete // logger.debug('END execution with value =', value, 'and result =', result); // logger.debug('Completed async handler: ' + JSON.stringify(allresult));