Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / api / user-setting / user-setting.controller.js
index 3663cb7..98918a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2dae=['UserSetting','find','params','then','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','update','sendStatus','error','name','send','user','role','Unauthorized'];(function(_0x20c7ff,_0x139c34){var _0x540bce=function(_0x593de7){while(--_0x593de7){_0x20c7ff['push'](_0x20c7ff['shift']());}};_0x540bce(++_0x139c34);}(_0x2dae,0xc3));var _0xe2da=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x2dae[_0x34c553];return _0x1357d2;};'use strict';var _=require(_0xe2da('0x0'));var Redis=require('ioredis');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var config=require(_0xe2da('0x3'));var db=require(_0xe2da('0x4'))['db'];var socket=require(_0xe2da('0x5'))(new Redis(config['redis']));require(_0xe2da('0x6'))[_0xe2da('0x7')](socket);config[_0xe2da('0x8')]=_[_0xe2da('0x9')](config['redis'],{'host':_0xe2da('0xa'),'port':0x18eb});function respondWithResult(_0x89c70b,_0x34cc98){_0x34cc98=_0x34cc98||0xc8;return function(_0x2efbd8){if(_0x2efbd8){return _0x89c70b[_0xe2da('0xb')](_0x34cc98)[_0xe2da('0xc')](_0x2efbd8);}};}function saveUpdates(_0x29960a){return function(_0x14b1f8){if(_0x14b1f8){return _0x14b1f8[_0xe2da('0xd')](_0x29960a)['then'](function(_0x52e650){return _0x52e650;});}return null;};}function handleEntityNotFound(_0x3baaa8){return function(_0x104fb3){if(!_0x104fb3){_0x3baaa8[_0xe2da('0xe')](0x194);}return _0x104fb3;};}function handleError(_0x3c1309,_0x44ec3e){_0x44ec3e=_0x44ec3e||0x1f4;return function(_0x1a29b9){logger[_0xe2da('0xf')](_0x1a29b9['stack']);if(_0x1a29b9[_0xe2da('0x10')]){delete _0x1a29b9['name'];}_0x3c1309[_0xe2da('0xb')](_0x44ec3e)[_0xe2da('0x11')](_0x1a29b9);};}exports[_0xe2da('0xd')]=function(_0x411b9f,_0xfab73e){if(_0x411b9f[_0xe2da('0x12')][_0xe2da('0x13')]!=='admin')throw new Error(_0xe2da('0x14'));if(isNaN(Number(_0x411b9f['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xe2da('0x15')][_0xe2da('0x16')]({'where':{'id':_0x411b9f[_0xe2da('0x17')]['id']}})['then'](handleEntityNotFound(_0xfab73e,null))[_0xe2da('0x18')](saveUpdates(_0x411b9f[_0xe2da('0x19')],null))[_0xe2da('0x18')](respondWithResult(_0xfab73e,null))[_0xe2da('0x1a')](handleError(_0xfab73e,null));};
\ No newline at end of file
+var _0x5ff3=['Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','json','then','name','status','send','user','admin'];(function(_0x147daa,_0x567d78){var _0x5d1832=function(_0x564f30){while(--_0x564f30){_0x147daa['push'](_0x147daa['shift']());}};_0x5d1832(++_0x567d78);}(_0x5ff3,0x17d));var _0x35ff=function(_0x46f176,_0x1feba9){_0x46f176=_0x46f176-0x0;var _0x4bd660=_0x5ff3[_0x46f176];return _0x4bd660;};'use strict';var _=require('lodash');var Redis=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var config=require('../../config/environment');var db=require(_0x35ff('0x2'))['db'];var socket=require(_0x35ff('0x3'))(new Redis(config[_0x35ff('0x4')]));require(_0x35ff('0x5'))['register'](socket);config[_0x35ff('0x4')]=_[_0x35ff('0x6')](config[_0x35ff('0x4')],{'host':_0x35ff('0x7'),'port':0x18eb});function respondWithResult(_0x30c3ff,_0x495c31){_0x495c31=_0x495c31||0xc8;return function(_0x92b403){if(_0x92b403){return _0x30c3ff['status'](_0x495c31)[_0x35ff('0x8')](_0x92b403);}};}function saveUpdates(_0xfcec34){return function(_0x224ce5){if(_0x224ce5){return _0x224ce5['update'](_0xfcec34)[_0x35ff('0x9')](function(_0x59ec4f){return _0x59ec4f;});}return null;};}function handleEntityNotFound(_0x1cd2c6){return function(_0x228fea){if(!_0x228fea){_0x1cd2c6['sendStatus'](0x194);}return _0x228fea;};}function handleError(_0x5c3131,_0x3aba51){_0x3aba51=_0x3aba51||0x1f4;return function(_0x574c81){logger['error'](_0x574c81['stack']);if(_0x574c81[_0x35ff('0xa')]){delete _0x574c81[_0x35ff('0xa')];}_0x5c3131[_0x35ff('0xb')](_0x3aba51)[_0x35ff('0xc')](_0x574c81);};}exports['update']=function(_0x33154f,_0xab42e6){if(_0x33154f[_0x35ff('0xd')]['role']!==_0x35ff('0xe'))throw new Error(_0x35ff('0xf'));if(isNaN(Number(_0x33154f[_0x35ff('0x10')]['id'])))throw new Error(_0x35ff('0x11'));return db[_0x35ff('0x12')][_0x35ff('0x13')]({'where':{'id':_0x33154f[_0x35ff('0x10')]['id']}})[_0x35ff('0x9')](handleEntityNotFound(_0xab42e6,null))[_0x35ff('0x9')](saveUpdates(_0x33154f[_0x35ff('0x14')],null))[_0x35ff('0x9')](respondWithResult(_0xab42e6,null))[_0x35ff('0x15')](handleError(_0xab42e6,null));};
\ No newline at end of file