Built motion from commit f67b3b02.|2.6.31
[motion2.git] / server / api / user-setting / user-setting.controller.js
index acb0c6a..b919ce0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe06f=['stack','name','send','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','ioredis','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','status','json','update','then','sendStatus','error'];(function(_0x2d8487,_0x243a98){var _0x38d691=function(_0x1ab9bb){while(--_0x1ab9bb){_0x2d8487['push'](_0x2d8487['shift']());}};_0x38d691(++_0x243a98);}(_0xe06f,0x65));var _0xfe06=function(_0x4f14a6,_0x51ab80){_0x4f14a6=_0x4f14a6-0x0;var _0x597cd3=_0xe06f[_0x4f14a6];return _0x597cd3;};'use strict';var _=require(_0xfe06('0x0'));var Redis=require(_0xfe06('0x1'));var logger=require('../../config/logger')(_0xfe06('0x2'));var config=require('../../config/environment');var db=require(_0xfe06('0x3'))['db'];var socket=require(_0xfe06('0x4'))(new Redis(config[_0xfe06('0x5')]));require(_0xfe06('0x6'))[_0xfe06('0x7')](socket);config[_0xfe06('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x4446e9,_0x429909){_0x429909=_0x429909||0xc8;return function(_0x408027){if(_0x408027){return _0x4446e9[_0xfe06('0x8')](_0x429909)[_0xfe06('0x9')](_0x408027);}};}function saveUpdates(_0x3cc91b){return function(_0x501b22){if(_0x501b22){return _0x501b22[_0xfe06('0xa')](_0x3cc91b)[_0xfe06('0xb')](function(_0x34eaba){return _0x34eaba;});}return null;};}function handleEntityNotFound(_0x3ec380){return function(_0x4efaa2){if(!_0x4efaa2){_0x3ec380[_0xfe06('0xc')](0x194);}return _0x4efaa2;};}function handleError(_0x141a8b,_0x22ea8e){_0x22ea8e=_0x22ea8e||0x1f4;return function(_0x121df5){logger[_0xfe06('0xd')](_0x121df5[_0xfe06('0xe')]);if(_0x121df5[_0xfe06('0xf')]){delete _0x121df5[_0xfe06('0xf')];}_0x141a8b['status'](_0x22ea8e)[_0xfe06('0x10')](_0x121df5);};}exports[_0xfe06('0xa')]=function(_0x3ffe50,_0x2ff7d8){if(_0x3ffe50['user']['role']!==_0xfe06('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0x3ffe50[_0xfe06('0x12')]['id'])))throw new Error(_0xfe06('0x13'));return db[_0xfe06('0x14')]['find']({'where':{'id':_0x3ffe50[_0xfe06('0x12')]['id']}})[_0xfe06('0xb')](handleEntityNotFound(_0x2ff7d8,null))[_0xfe06('0xb')](saveUpdates(_0x3ffe50[_0xfe06('0x15')],null))[_0xfe06('0xb')](respondWithResult(_0x2ff7d8,null))[_0xfe06('0x16')](handleError(_0x2ff7d8,null));};
\ No newline at end of file
+var _0x6d4a=['../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6d4a,0x117));var _0xa6d4=function(_0x167082,_0x5e07b4){_0x167082=_0x167082-0x0;var _0x19a4ea=_0x6d4a[_0x167082];return _0x19a4ea;};'use strict';var _=require(_0xa6d4('0x0'));var Redis=require('ioredis');var logger=require(_0xa6d4('0x1'))(_0xa6d4('0x2'));var config=require(_0xa6d4('0x3'));var db=require(_0xa6d4('0x4'))['db'];var socket=require(_0xa6d4('0x5'))(new Redis(config[_0xa6d4('0x6')]));require(_0xa6d4('0x7'))[_0xa6d4('0x8')](socket);config[_0xa6d4('0x6')]=_[_0xa6d4('0x9')](config[_0xa6d4('0x6')],{'host':_0xa6d4('0xa'),'port':0x18eb});function respondWithResult(_0x354148,_0x444bf9){_0x444bf9=_0x444bf9||0xc8;return function(_0x49a9e8){if(_0x49a9e8){return _0x354148[_0xa6d4('0xb')](_0x444bf9)[_0xa6d4('0xc')](_0x49a9e8);}};}function saveUpdates(_0x52739a){return function(_0x197e6e){if(_0x197e6e){return _0x197e6e[_0xa6d4('0xd')](_0x52739a)[_0xa6d4('0xe')](function(_0xb76050){return _0xb76050;});}return null;};}function handleEntityNotFound(_0x2320cc){return function(_0x54edec){if(!_0x54edec){_0x2320cc[_0xa6d4('0xf')](0x194);}return _0x54edec;};}function handleError(_0x150483,_0x58d06f){_0x58d06f=_0x58d06f||0x1f4;return function(_0x2c7f14){logger[_0xa6d4('0x10')](_0x2c7f14[_0xa6d4('0x11')]);if(_0x2c7f14['name']){delete _0x2c7f14[_0xa6d4('0x12')];}_0x150483['status'](_0x58d06f)[_0xa6d4('0x13')](_0x2c7f14);};}exports[_0xa6d4('0xd')]=function(_0x5c8e37,_0x1cae87){if(_0x5c8e37[_0xa6d4('0x14')][_0xa6d4('0x15')]!==_0xa6d4('0x16'))throw new Error(_0xa6d4('0x17'));if(isNaN(Number(_0x5c8e37[_0xa6d4('0x18')]['id'])))throw new Error(_0xa6d4('0x19'));return db[_0xa6d4('0x1a')][_0xa6d4('0x1b')]({'where':{'id':_0x5c8e37[_0xa6d4('0x18')]['id']}})[_0xa6d4('0xe')](handleEntityNotFound(_0x1cae87,null))[_0xa6d4('0xe')](saveUpdates(_0x5c8e37['body'],null))[_0xa6d4('0xe')](respondWithResult(_0x1cae87,null))['catch'](handleError(_0x1cae87,null));};
\ No newline at end of file