vicinityManager/server/services/nodes/processNode.js
/*
On node saved successfully in MONGO,
the update process continues in the commServer
*/
On node saved successfully in MONGO,
the update process continues in the commServer
On node saved successfully in MONGO the update process continues in the commServer
function updateNode(data, email, userId){
    return new Promise(function(resolve, reject) {
      var payload = {
        name: data.name,
        password: data.pass,
      };
      commServer.callCommServer(payload, 'users/' + data.adid, 'PUT') 
      .then(
        function(response){
          var payload2 = {
            name: data.adid,
            description: data.name
          };
          return commServer.callCommServer(payload2, 'groups/' + data.adid, 'PUT');
        })
        .then(function(response){ return nodeOp.findOne({adid: data.adid}); })
        .then(
          function(response){
            return audits.create(
              { kind: 'user', item: userId, extid: email },
              { kind: 'userAccount', item: response.cid.id, extid: response.cid.extid },
              { kind: 'node', item: response._id, extid: response.adid },
              23, null);
          })
        .then(function(response){
          logger.audit({user: email, action: 'updateNode', item: response._id });
          resolve('Success');
        })
        .catch(function(err){
          logger.error({user: email, action: 'updateNode', item: response._id, message: err});
          reject(err);
        });
      });
  }
function updateNode ( data , email , userId ) { return new Promise ( function ( resolve , reject ) { var payload = { name : data . name , password : data . pass , } ; commServer . callCommServer ( payload , 'users/' + data . adid , 'PUT' ) . then ( function ( response ) { var payload2 = { name : data . adid , description : data . name } ; return commServer . callCommServer ( payload2 , 'groups/' + data . adid , 'PUT' ) ; } ) . then ( function ( response ) { return nodeOp . findOne ( { adid : data . adid } ) ; } ) . then ( function ( response ) { return audits . create ( { kind : 'user' , item : userId , extid : email } , { kind : 'userAccount' , item : response . cid . id , extid : response . cid . extid } , { kind : 'node' , item : response . _id , extid : response . adid } , 23 , null ) ; } ) . then ( function ( response ) { logger . audit ( { user : email , action : 'updateNode' , item : response . _id } ) ; resolve ( 'Success' ) ; } ) . catch ( function ( err ) { logger . error ( { user : email , action : 'updateNode' , item : response . _id , message : err } ) ; reject ( err ) ; } ) ; } ) ; }
On node saved successfully in MONGO,
the update process continues in the commServer
On node saved successfully in MONGO the update process continues in the commServer
// Update node in commServer