Built motion from commit 0c5f406c.|2.6.29
[motion2.git] / server / api / user-setting / user-setting.controller.js
index a271c98..3b3e858 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ff4=['../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','json','then','sendStatus','name','status','update','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','api','../../config/environment'];(function(_0x30f6db,_0x12f42f){var _0x46ba2b=function(_0x3b9d67){while(--_0x3b9d67){_0x30f6db['push'](_0x30f6db['shift']());}};_0x46ba2b(++_0x12f42f);}(_0x9ff4,0x196));var _0x49ff=function(_0x687c0,_0x54db10){_0x687c0=_0x687c0-0x0;var _0x55e984=_0x9ff4[_0x687c0];return _0x55e984;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require('../../config/logger')(_0x49ff('0x0'));var config=require(_0x49ff('0x1'));var db=require(_0x49ff('0x2'))['db'];var socket=require(_0x49ff('0x3'))(new Redis(config['redis']));require(_0x49ff('0x4'))[_0x49ff('0x5')](socket);config[_0x49ff('0x6')]=_[_0x49ff('0x7')](config[_0x49ff('0x6')],{'host':_0x49ff('0x8'),'port':0x18eb});function respondWithResult(_0xe967d3,_0xd87903){_0xd87903=_0xd87903||0xc8;return function(_0x50f784){if(_0x50f784){return _0xe967d3['status'](_0xd87903)[_0x49ff('0x9')](_0x50f784);}};}function saveUpdates(_0x3a9da1){return function(_0x562cd1){if(_0x562cd1){return _0x562cd1['update'](_0x3a9da1)[_0x49ff('0xa')](function(_0xad4257){return _0xad4257;});}return null;};}function handleEntityNotFound(_0x471b2c){return function(_0x178f62){if(!_0x178f62){_0x471b2c[_0x49ff('0xb')](0x194);}return _0x178f62;};}function handleError(_0x419982,_0xedd4ed){_0xedd4ed=_0xedd4ed||0x1f4;return function(_0x32c80d){logger['error'](_0x32c80d['stack']);if(_0x32c80d['name']){delete _0x32c80d[_0x49ff('0xc')];}_0x419982[_0x49ff('0xd')](_0xedd4ed)['send'](_0x32c80d);};}exports[_0x49ff('0xe')]=function(_0x5714c7,_0x5055fe){if(_0x5714c7[_0x49ff('0xf')]['role']!==_0x49ff('0x10'))throw new Error(_0x49ff('0x11'));if(isNaN(Number(_0x5714c7[_0x49ff('0x12')]['id'])))throw new Error(_0x49ff('0x13'));return db[_0x49ff('0x14')][_0x49ff('0x15')]({'where':{'id':_0x5714c7[_0x49ff('0x12')]['id']}})[_0x49ff('0xa')](handleEntityNotFound(_0x5055fe,null))['then'](saveUpdates(_0x5714c7[_0x49ff('0x16')],null))['then'](respondWithResult(_0x5055fe,null))[_0x49ff('0x17')](handleError(_0x5055fe,null));};
\ No newline at end of file
+var _0x83f1=['defaults','localhost','status','update','then','error','stack','name','send','user','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','find','params','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','redis','./user-setting.socket','register'];(function(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0x83f1,0x1cc));var _0x183f=function(_0x1ffddc,_0x5cbe4a){_0x1ffddc=_0x1ffddc-0x0;var _0x42bbb1=_0x83f1[_0x1ffddc];return _0x42bbb1;};'use strict';var _=require(_0x183f('0x0'));var Redis=require(_0x183f('0x1'));var logger=require(_0x183f('0x2'))(_0x183f('0x3'));var config=require(_0x183f('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x183f('0x5')]));require(_0x183f('0x6'))[_0x183f('0x7')](socket);config[_0x183f('0x5')]=_[_0x183f('0x8')](config['redis'],{'host':_0x183f('0x9'),'port':0x18eb});function respondWithResult(_0xf702f5,_0x364cc4){_0x364cc4=_0x364cc4||0xc8;return function(_0x5c75c3){if(_0x5c75c3){return _0xf702f5[_0x183f('0xa')](_0x364cc4)['json'](_0x5c75c3);}};}function saveUpdates(_0xf1140d){return function(_0x828173){if(_0x828173){return _0x828173[_0x183f('0xb')](_0xf1140d)[_0x183f('0xc')](function(_0x22bcd6){return _0x22bcd6;});}return null;};}function handleEntityNotFound(_0x1848a6){return function(_0x333813){if(!_0x333813){_0x1848a6['sendStatus'](0x194);}return _0x333813;};}function handleError(_0x1a1031,_0xa7889b){_0xa7889b=_0xa7889b||0x1f4;return function(_0x3a99ee){logger[_0x183f('0xd')](_0x3a99ee[_0x183f('0xe')]);if(_0x3a99ee[_0x183f('0xf')]){delete _0x3a99ee[_0x183f('0xf')];}_0x1a1031['status'](_0xa7889b)[_0x183f('0x10')](_0x3a99ee);};}exports['update']=function(_0x5619e8,_0xa71c57){if(_0x5619e8[_0x183f('0x11')][_0x183f('0x12')]!==_0x183f('0x13'))throw new Error(_0x183f('0x14'));if(isNaN(Number(_0x5619e8['params']['id'])))throw new Error(_0x183f('0x15'));return db['UserSetting'][_0x183f('0x16')]({'where':{'id':_0x5619e8[_0x183f('0x17')]['id']}})[_0x183f('0xc')](handleEntityNotFound(_0xa71c57,null))['then'](saveUpdates(_0x5619e8[_0x183f('0x18')],null))[_0x183f('0xc')](respondWithResult(_0xa71c57,null))[_0x183f('0x19')](handleError(_0xa71c57,null));};
\ No newline at end of file