vicinityManager/server/services/items/update.js
/*
Push or pull OID from service/device owner
Enable/Disable triggers the action
*/
Push or pull OID from service/device owner
Enable/Disable triggers the action
Push or pull OID from service / device owner Enable / Disable triggers the action
function manageUserItems(oid, uid, email, userId, type){
  var item = {'id': uid, 'extid': oid};
  var user = type === 'enabled' ? {'id': userId, 'extid': email} : {};
  var query = type === 'enabled' ? {$push: {hasItems: item}} : {$pull: {hasItems: item}};
  return userOp.update({'email': email}, query)
  .then(function(response){
    return itemOp.update({_id:uid}, {$set: {uid: user }});
  });
}
function manageUserItems ( oid , uid , email , userId , type ) { var item = { 'id' : uid , 'extid' : oid } ; var user = type === 'enabled' ? { 'id' : userId , 'extid' : email } : { } ; var query = type === 'enabled' ? { $push : { hasItems : item } } : { $pull : { hasItems : item } } ; return userOp . update ( { 'email' : email } , query ) . then ( function ( response ) { return itemOp . update ( { _id : uid } , { $set : { uid : user } } ) ; } ) ; }
Push or pull OID from service/device owner
Enable/Disable triggers the action
Push or pull OID from service / device owner Enable / Disable triggers the action