Backend/Microservices/UserService/server/src/Entity/users.js
/**
    * Method to update the user basic details and authentication credentials.
    * @param password: The password of the user.
    * @returns {Promise<Array>};
    */
Method to update the user basic details and authentication credentials.
@param password: The password of the user.
@returns {Promise}.
Method to update the user basic details and authentication credentials . @param password : The password of the user . @returns { Promise } .
updateDetails(password) {
      return new Promise((resolve, reject) => {
         const userData = this._validateUserToken(this._token);
         if (validators.validateUndefined(userData) && userData[constants.ID] === this._userId) {
            database.runSp(constants.SP_UPDATE_USER_DETAILS, [this._userId, this._firstName,
               this._lastName, this._email,
               validators.validateString(password) ? password : false, this._phone]).then(_resultSet => {
               resolve([constants.RESPONSE_SUCESS_LEVEL_1, _resultSet[0][0]]);
            }).catch(err => {
               printer.printError(err);
               reject([constants.ERROR_LEVEL_3, constants.ERROR_MESSAGE]);
            });
         } else {
            reject([constants.ERROR_LEVEL_4, constants.FORBIDDEN_MESSAGE]);
         }
      });
   }
updateDetails ( password ) { return new Promise ( ( resolve , reject ) => { const userData = this . _validateUserToken ( this . _token ) ; if ( validators . validateUndefined ( userData ) && userData [ constants . ID ] === this . _userId ) { database . runSp ( constants . SP_UPDATE_USER_DETAILS , [ this . _userId , this . _firstName , this . _lastName , this . _email , validators . validateString ( password ) ? password : false , this . _phone ] ) . then ( _resultSet => { resolve ( [ constants . RESPONSE_SUCESS_LEVEL_1 , _resultSet [ 0 ] [ 0 ] ] ) ; } ) . catch ( err => { printer . printError ( err ) ; reject ( [ constants . ERROR_LEVEL_3 , constants . ERROR_MESSAGE ] ) ; } ) ; } else { reject ( [ constants . ERROR_LEVEL_4 , constants . FORBIDDEN_MESSAGE ] ) ; } } ) ; }
Method to update the user basic details and authentication credentials.
Method to update the user basic details and authentication credentials .