Advertisement
jaegaern

Untitled

Oct 16th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function modifyUserFieldData (userId, field, optional, data) {
  2.   if (!exists(userId) || !exists(field) || !exists(data)) {
  3.     return promise.reject({code: 404, msg: 'missing'})
  4.     // return callback({code: 404, msg: 'userId, field or data missing', errorCode: errorCodes.expectedContentNotProvided})
  5.   }
  6.   switch (field) {
  7.     case 'skill':
  8.       modifyUserSmallFunc(userId, 'skills', ['id', 'userId', 'skill', 'level', 'visible'], data)
  9.       .then(id => {
  10.         console.log('modifyUserSmallFunc id: ', id)
  11.         return promise.resolve(id)
  12.       })
  13.       .catch(err => {
  14.         console.log('modifyUserSmallFunc err: ', err)
  15.         return promise.reject(err)
  16.       })
  17.  
  18.       break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement