vicinityManager/server/services/contracts/contracts.js
/*
If contract does not have items, delete it
*/
If contract does not have items, delete it
If contract does not have items delete it
function contractValidity(ctids){
  contractOp.find({_id: {$in: ctids}}, {'serviceProvider.items':1, 'iotOwner.items':1})
  .then(function(response){
    for(var i = 0; i < ctids.length; i++){
      if(response[i].serviceProvider.items.length * response[i].iotOwner.items.length === 0){
        removing(ctids[i], function(resp,err){});
      }
    }
  })
  .catch(function(err){
    logger.debug('Error checking contract validity: ' + err);
  });
}
function contractValidity ( ctids ) { contractOp . find ( { _id : { $in : ctids } } , { 'serviceProvider.items' : 1 , 'iotOwner.items' : 1 } ) . then ( function ( response ) { for ( var i = 0 ; i < ctids . length ; i ++ ) { if ( response [ i ] . serviceProvider . items . length * response [ i ] . iotOwner . items . length === 0 ) { removing ( ctids [ i ] , function ( resp , err ) { } ) ; } } } ) . catch ( function ( err ) { logger . debug ( 'Error checking contract validity: ' + err ) ; } ) ; }
If contract does not have items, delete it
If contract does not have items delete it