vicinityManager/server/services/items/deleteItems.js
/*
Deletes either a selection of oids or all oids under a node
*/
Deletes either a selection of oids or all oids under a node
Deletes either a selection of oids or all oids under a node
function deleteItems(oids, email){
  return new Promise(function(resolve, reject) {
    if(oids.length > 0){ 
      logger.debug('Start async handler...');
      sync.forEachAll(oids,
        function(value, allresult, next, otherParams) {
          deleting(value, otherParams, function(value, result) {
              logger.debug('END execution with value =', value, 'and result =', result);
              allresult.push({value: value, result: result});
              next();
          });
        },
        function(allresult) {
          if(allresult.length === oids.length){
            logger.debug('Completed async handler: ' + JSON.stringify(allresult));
            resolve({"error": false, "message": allresult });
          }
        },
        false,
        {userMail:email}
      );
    } else {
      logger.warn({user:email, action: 'deleteItem', message: "No items to be removed"});
      resolve({"error": false, "message": "Nothing to be removed..."});
    }
  });
}
function deleteItems ( oids , email ) { return new Promise ( function ( resolve , reject ) { if ( oids . length > 0 ) { logger . debug ( 'Start async handler...' ) ; sync . forEachAll ( oids , function ( value , allresult , next , otherParams ) { deleting ( value , otherParams , function ( value , result ) { logger . debug ( 'END execution with value =' , value , 'and result =' , result ) ; allresult . push ( { value : value , result : result } ) ; next ( ) ; } ) ; } , function ( allresult ) { if ( allresult . length === oids . length ) { logger . debug ( 'Completed async handler: ' + JSON . stringify ( allresult ) ) ; resolve ( { "error" : false , "message" : allresult } ) ; } } , false , { userMail : email } ) ; } else { logger . warn ( { user : email , action : 'deleteItem' , message : "No items to be removed" } ) ; resolve ( { "error" : false , "message" : "Nothing to be removed..." } ) ; } } ) ; }
Deletes either a selection of oids or all oids under a node
Deletes either a selection of oids or all oids under a node
// Check if there is any item to delete