Built motion from commit 4c281f94.|2.6.31
[motion2.git] / server / api / user-setting / user-setting.controller.js
index 984d3b8..ff12732 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e31=['lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','./user-setting.socket','register','redis','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','body','catch'];(function(_0x114587,_0x4a45ef){var _0xe32b8d=function(_0x3ca1a1){while(--_0x3ca1a1){_0x114587['push'](_0x114587['shift']());}};_0xe32b8d(++_0x4a45ef);}(_0x2e31,0x145));var _0x12e3=function(_0x2abf7f,_0xd44770){_0x2abf7f=_0x2abf7f-0x0;var _0x5f39c0=_0x2e31[_0x2abf7f];return _0x5f39c0;};'use strict';var _=require(_0x12e3('0x0'));var Redis=require(_0x12e3('0x1'));var logger=require(_0x12e3('0x2'))('api');var config=require(_0x12e3('0x3'));var db=require(_0x12e3('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x12e3('0x5'))[_0x12e3('0x6')](socket);config[_0x12e3('0x7')]=_['defaults'](config[_0x12e3('0x7')],{'host':_0x12e3('0x8'),'port':0x18eb});function respondWithResult(_0x5aefcf,_0x5f056f){_0x5f056f=_0x5f056f||0xc8;return function(_0x37f287){if(_0x37f287){return _0x5aefcf[_0x12e3('0x9')](_0x5f056f)[_0x12e3('0xa')](_0x37f287);}};}function saveUpdates(_0x33f3a2){return function(_0x493e52){if(_0x493e52){return _0x493e52[_0x12e3('0xb')](_0x33f3a2)[_0x12e3('0xc')](function(_0x40bf58){return _0x40bf58;});}return null;};}function handleEntityNotFound(_0x5208d6){return function(_0x5901b3){if(!_0x5901b3){_0x5208d6[_0x12e3('0xd')](0x194);}return _0x5901b3;};}function handleError(_0x55bb88,_0x12acc8){_0x12acc8=_0x12acc8||0x1f4;return function(_0x3d6c3c){logger[_0x12e3('0xe')](_0x3d6c3c[_0x12e3('0xf')]);if(_0x3d6c3c[_0x12e3('0x10')]){delete _0x3d6c3c[_0x12e3('0x10')];}_0x55bb88[_0x12e3('0x9')](_0x12acc8)[_0x12e3('0x11')](_0x3d6c3c);};}exports[_0x12e3('0xb')]=function(_0x4320d3,_0x5a18bb){if(_0x4320d3[_0x12e3('0x12')][_0x12e3('0x13')]!==_0x12e3('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x4320d3[_0x12e3('0x15')]['id'])))throw new Error(_0x12e3('0x16'));return db['UserSetting']['find']({'where':{'id':_0x4320d3['params']['id']}})[_0x12e3('0xc')](handleEntityNotFound(_0x5a18bb,null))['then'](saveUpdates(_0x4320d3[_0x12e3('0x17')],null))[_0x12e3('0xc')](respondWithResult(_0x5a18bb,null))[_0x12e3('0x18')](handleError(_0x5a18bb,null));};
\ No newline at end of file
+var _0x502a=['lodash','ioredis','api','../../config/environment','redis','register','defaults','localhost','then','sendStatus','error','stack','name','status','update','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params','body','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x502a,0xd8));var _0xa502=function(_0x4a0fee,_0x4db798){_0x4a0fee=_0x4a0fee-0x0;var _0x1f5248=_0x502a[_0x4a0fee];return _0x1f5248;};'use strict';var _=require(_0xa502('0x0'));var Redis=require(_0xa502('0x1'));var logger=require('../../config/logger')(_0xa502('0x2'));var config=require(_0xa502('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xa502('0x4')]));require('./user-setting.socket')[_0xa502('0x5')](socket);config[_0xa502('0x4')]=_[_0xa502('0x6')](config[_0xa502('0x4')],{'host':_0xa502('0x7'),'port':0x18eb});function respondWithResult(_0x489407,_0x329022){_0x329022=_0x329022||0xc8;return function(_0x29fb03){if(_0x29fb03){return _0x489407['status'](_0x329022)['json'](_0x29fb03);}};}function saveUpdates(_0x13e991){return function(_0x25c147){if(_0x25c147){return _0x25c147['update'](_0x13e991)[_0xa502('0x8')](function(_0x12fb93){return _0x12fb93;});}return null;};}function handleEntityNotFound(_0x385980){return function(_0x50a924){if(!_0x50a924){_0x385980[_0xa502('0x9')](0x194);}return _0x50a924;};}function handleError(_0x9f2ebd,_0x1c2688){_0x1c2688=_0x1c2688||0x1f4;return function(_0x4e37b7){logger[_0xa502('0xa')](_0x4e37b7[_0xa502('0xb')]);if(_0x4e37b7['name']){delete _0x4e37b7[_0xa502('0xc')];}_0x9f2ebd[_0xa502('0xd')](_0x1c2688)['send'](_0x4e37b7);};}exports[_0xa502('0xe')]=function(_0x91d9e2,_0x25ed69){if(_0x91d9e2['user'][_0xa502('0xf')]!==_0xa502('0x10'))throw new Error(_0xa502('0x11'));if(isNaN(Number(_0x91d9e2['params']['id'])))throw new Error(_0xa502('0x12'));return db[_0xa502('0x13')][_0xa502('0x14')]({'where':{'id':_0x91d9e2[_0xa502('0x15')]['id']}})[_0xa502('0x8')](handleEntityNotFound(_0x25ed69,null))[_0xa502('0x8')](saveUpdates(_0x91d9e2[_0xa502('0x16')],null))[_0xa502('0x8')](respondWithResult(_0x25ed69,null))[_0xa502('0x17')](handleError(_0x25ed69,null));};
\ No newline at end of file