Built motion from commit e1760111.|2.6.18
[motion2.git] / server / api / squareProject / squareProject.controller.js
index 46327e4..5ce8c93 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ad7=['attributes','intersection','length','nolimit','sort','where','pick','merge','VIRTUAL','options','count','include','findAll','rows','show','params','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','json','offset','undefined','limit','set','Content-Range','update','then','get','SquareProjects','UserProfileResource','destroy','publish','agi','stringify','status','end','error','stack','name','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters'];(function(_0x2c1ce,_0x5728fc){var _0x56f56f=function(_0x5488de){while(--_0x5488de){_0x2c1ce['push'](_0x2c1ce['shift']());}};_0x56f56f(++_0x5728fc);}(_0x8ad7,0xa7));var _0x78ad=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x8ad7[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x78ad('0x0'));var Redis=require(_0x78ad('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x78ad('0x2'))(_0x78ad('0x3'));var config=require(_0x78ad('0x4'));var db=require('../../mysqldb')['db'];config[_0x78ad('0x5')]=_[_0x78ad('0x6')](config[_0x78ad('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x78ad('0x7'))(new Redis(config[_0x78ad('0x5')]));require(_0x78ad('0x8'))[_0x78ad('0x9')](socket);function respondWithResult(_0xc3028,_0x1921bd){_0x1921bd=_0x1921bd||0xc8;return function(_0x2ad9dd){if(_0x2ad9dd){return _0xc3028['status'](_0x1921bd)[_0x78ad('0xa')](_0x2ad9dd);}};}function respondWithFilteredResult(_0x19a2b4,_0x3ee423){return function(_0x31c393){if(_0x31c393){var _0xc94a65=typeof _0x3ee423[_0x78ad('0xb')]===_0x78ad('0xc')&&typeof _0x3ee423[_0x78ad('0xd')]===_0x78ad('0xc');var _0x1817e4=_0x31c393['count'];var _0x3f6c56=_0xc94a65?0x0:_0x3ee423[_0x78ad('0xb')];var _0x2a9e57=_0xc94a65?_0x31c393['count']:_0x3ee423['offset']+_0x3ee423[_0x78ad('0xd')];var _0x1ac892;if(_0x2a9e57>=_0x1817e4){_0x2a9e57=_0x1817e4;_0x1ac892=0xc8;}else{_0x1ac892=0xce;}_0x19a2b4['status'](_0x1ac892);return _0x19a2b4[_0x78ad('0xe')](_0x78ad('0xf'),_0x3f6c56+'-'+_0x2a9e57+'/'+_0x1817e4)[_0x78ad('0xa')](_0x31c393);}return null;};}function saveUpdates(_0x4b8185){return function(_0x363fb7){if(_0x363fb7){return _0x363fb7[_0x78ad('0x10')](_0x4b8185)[_0x78ad('0x11')](function(_0x5bea0a){return _0x5bea0a;});}return null;};}function removeEntity(_0x3b888b){return function(_0x2d6eea){if(_0x2d6eea){return _0x2d6eea['destroy']()[_0x78ad('0x11')](function(){var _0x142cf9=_0x2d6eea[_0x78ad('0x12')]({'plain':!![]});var _0x4be0f7=_0x78ad('0x13');return db[_0x78ad('0x14')][_0x78ad('0x15')]({'where':{'type':_0x4be0f7,'resourceId':_0x142cf9['id']}})[_0x78ad('0x11')](function(){return _0x2d6eea;});})['then'](function(){var _0x11a03f=new Redis(config[_0x78ad('0x5')]);_0x11a03f[_0x78ad('0x16')](_0x78ad('0x17'),JSON[_0x78ad('0x18')]({'id':_0x2d6eea['id'],'deleted':!![]}));})['then'](function(){_0x3b888b[_0x78ad('0x19')](0xcc)[_0x78ad('0x1a')]();});}};}function handleEntityNotFound(_0x4f947e){return function(_0x3e233b){if(!_0x3e233b){_0x4f947e['sendStatus'](0x194);}return _0x3e233b;};}function handleError(_0x26a175,_0x423221){_0x423221=_0x423221||0x1f4;return function(_0xdace9b){logger[_0x78ad('0x1b')](_0xdace9b[_0x78ad('0x1c')]);if(_0xdace9b['name']){delete _0xdace9b[_0x78ad('0x1d')];}_0x26a175['status'](_0x423221)['send'](_0xdace9b);};}exports[_0x78ad('0x1e')]=function(_0x4ea2f1,_0x193906){var _0x5088e5={},_0x5c0217={},_0x58498a={'count':0x0,'rows':[]};var _0x24704b=_[_0x78ad('0x1f')](db[_0x78ad('0x20')][_0x78ad('0x21')],function(_0x19d488){return{'name':_0x19d488['fieldName'],'type':_0x19d488[_0x78ad('0x22')][_0x78ad('0x23')]};});_0x5c0217[_0x78ad('0x24')]=_[_0x78ad('0x1f')](_0x24704b,_0x78ad('0x1d'));_0x5c0217[_0x78ad('0x25')]=_[_0x78ad('0x26')](_0x4ea2f1['query']);_0x5c0217[_0x78ad('0x27')]=_['intersection'](_0x5c0217['model'],_0x5c0217['query']);_0x5088e5[_0x78ad('0x28')]=_[_0x78ad('0x29')](_0x5c0217['model'],qs['fields'](_0x4ea2f1[_0x78ad('0x25')]['fields']));_0x5088e5['attributes']=_0x5088e5[_0x78ad('0x28')][_0x78ad('0x2a')]?_0x5088e5[_0x78ad('0x28')]:_0x5c0217[_0x78ad('0x24')];if(!_0x4ea2f1[_0x78ad('0x25')]['hasOwnProperty'](_0x78ad('0x2b'))){_0x5088e5[_0x78ad('0xd')]=qs[_0x78ad('0xd')](_0x4ea2f1[_0x78ad('0x25')][_0x78ad('0xd')]);_0x5088e5[_0x78ad('0xb')]=qs[_0x78ad('0xb')](_0x4ea2f1[_0x78ad('0x25')][_0x78ad('0xb')]);}_0x5088e5['order']=qs['sort'](_0x4ea2f1['query'][_0x78ad('0x2c')]);_0x5088e5[_0x78ad('0x2d')]=qs['filters'](_[_0x78ad('0x2e')](_0x4ea2f1['query'],_0x5c0217[_0x78ad('0x27')]),_0x24704b);if(_0x4ea2f1['query']['filter']){_0x5088e5[_0x78ad('0x2d')]=_[_0x78ad('0x2f')](_0x5088e5[_0x78ad('0x2d')],{'$or':_['map'](_0x24704b,function(_0x213259){if(_0x213259[_0x78ad('0x22')]!==_0x78ad('0x30')){var _0x54dd77={};_0x54dd77[_0x213259[_0x78ad('0x1d')]]={'$like':'%'+_0x4ea2f1[_0x78ad('0x25')]['filter']+'%'};return _0x54dd77;}})});}_0x5088e5=_[_0x78ad('0x2f')]({},_0x5088e5,_0x4ea2f1[_0x78ad('0x31')]);var _0x4a5d31={'where':_0x5088e5['where']};return db[_0x78ad('0x20')][_0x78ad('0x32')](_0x4a5d31)[_0x78ad('0x11')](function(_0x2cbdf0){_0x58498a[_0x78ad('0x32')]=_0x2cbdf0;if(_0x4ea2f1[_0x78ad('0x25')]['includeAll']){_0x5088e5[_0x78ad('0x33')]=[{'all':!![]}];}return db[_0x78ad('0x20')][_0x78ad('0x34')](_0x5088e5);})[_0x78ad('0x11')](function(_0x818e4d){_0x58498a[_0x78ad('0x35')]=_0x818e4d;return _0x58498a;})['then'](respondWithFilteredResult(_0x193906,_0x5088e5))['catch'](handleError(_0x193906,null));};exports[_0x78ad('0x36')]=function(_0x14ab8d,_0x448821){var _0x5df69f={'raw':![],'where':{'id':_0x14ab8d[_0x78ad('0x37')]['id']}},_0x5e4da2={};_0x5e4da2['model']=_[_0x78ad('0x26')](db[_0x78ad('0x20')]['rawAttributes']);_0x5e4da2[_0x78ad('0x25')]=_[_0x78ad('0x26')](_0x14ab8d[_0x78ad('0x25')]);_0x5e4da2[_0x78ad('0x27')]=_[_0x78ad('0x29')](_0x5e4da2[_0x78ad('0x24')],_0x5e4da2[_0x78ad('0x25')]);_0x5df69f['attributes']=_['intersection'](_0x5e4da2[_0x78ad('0x24')],qs[_0x78ad('0x38')](_0x14ab8d[_0x78ad('0x25')][_0x78ad('0x38')]));_0x5df69f[_0x78ad('0x28')]=_0x5df69f['attributes'][_0x78ad('0x2a')]?_0x5df69f[_0x78ad('0x28')]:_0x5e4da2[_0x78ad('0x24')];if(_0x14ab8d[_0x78ad('0x25')]['includeAll']){_0x5df69f['include']=[{'all':!![]}];}_0x5df69f=_[_0x78ad('0x2f')]({},_0x5df69f,_0x14ab8d['options']);return db[_0x78ad('0x20')][_0x78ad('0x39')](_0x5df69f)[_0x78ad('0x11')](handleEntityNotFound(_0x448821,null))['then'](respondWithResult(_0x448821,null))[_0x78ad('0x3a')](handleError(_0x448821,null));};exports[_0x78ad('0x3b')]=function(_0x2dd373,_0x504730){return db[_0x78ad('0x20')][_0x78ad('0x3b')](_0x2dd373[_0x78ad('0x3c')],{})[_0x78ad('0x11')](function(_0x4e1773){var _0x198fa4=_0x2dd373[_0x78ad('0x3d')][_0x78ad('0x12')]({'plain':!![]});if(!_0x198fa4)throw new Error(_0x78ad('0x3e'));if(_0x198fa4[_0x78ad('0x3f')]===_0x78ad('0x3d')){var _0x51b125=_0x4e1773[_0x78ad('0x12')]({'plain':!![]});var _0x2bff08=_0x78ad('0x13');return db[_0x78ad('0x40')][_0x78ad('0x39')]({'where':{'name':_0x2bff08,'userProfileId':_0x198fa4[_0x78ad('0x41')]},'raw':!![]})[_0x78ad('0x11')](function(_0x134c18){if(_0x134c18&&_0x134c18[_0x78ad('0x42')]===0x0){return db[_0x78ad('0x14')][_0x78ad('0x3b')]({'name':_0x51b125['name'],'resourceId':_0x51b125['id'],'type':_0x134c18[_0x78ad('0x1d')],'sectionId':_0x134c18['id']},{})[_0x78ad('0x11')](function(){return _0x4e1773;});}else{return _0x4e1773;}})[_0x78ad('0x3a')](function(_0x561d3c){logger[_0x78ad('0x1b')](_0x78ad('0x43'),_0x561d3c);throw _0x561d3c;});}return _0x4e1773;})['then'](respondWithResult(_0x504730,0xc9))[_0x78ad('0x3a')](handleError(_0x504730,null));};exports[_0x78ad('0x10')]=function(_0x4e64f7,_0x337256){if(_0x4e64f7['body']['id']){delete _0x4e64f7[_0x78ad('0x3c')]['id'];}return db[_0x78ad('0x20')][_0x78ad('0x39')]({'where':{'id':_0x4e64f7[_0x78ad('0x37')]['id']}})[_0x78ad('0x11')](handleEntityNotFound(_0x337256,null))['then'](saveUpdates(_0x4e64f7[_0x78ad('0x3c')],null))[_0x78ad('0x11')](function(_0x55c8ea){if(!_0x55c8ea)return;var _0x424c3a=_0x55c8ea[_0x78ad('0x12')]({'plain':!![]});return _0x424c3a;})[_0x78ad('0x11')](function(_0x3e587c){var _0x4c2d86=new Redis(config[_0x78ad('0x5')]);_0x4c2d86['publish'](_0x78ad('0x17'),JSON[_0x78ad('0x18')](_[_0x78ad('0x2e')](_0x3e587c,['id',_0x78ad('0x1d'),_0x78ad('0x44')])));return _0x3e587c;})['then'](respondWithResult(_0x337256,null))['catch'](handleError(_0x337256,null));};exports['destroy']=function(_0x4a0638,_0x127ffb){return db[_0x78ad('0x20')][_0x78ad('0x39')]({'where':{'id':_0x4a0638[_0x78ad('0x37')]['id']}})[_0x78ad('0x11')](handleEntityNotFound(_0x127ffb,null))[_0x78ad('0x11')](removeEntity(_0x127ffb,null))[_0x78ad('0x3a')](handleError(_0x127ffb,null));};
\ No newline at end of file
+var _0xffc7=['sort','pick','where','merge','VIRTUAL','filter','options','SquareProject','includeAll','include','findAll','rows','catch','show','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','status','json','undefined','limit','offset','count','set','Content-Range','update','then','destroy','get','SquareProjects','publish','agi','stringify','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x7e4988,_0x186bb6){var _0xd42cc2=function(_0x2da19c){while(--_0x2da19c){_0x7e4988['push'](_0x7e4988['shift']());}};_0xd42cc2(++_0x186bb6);}(_0xffc7,0xa4));var _0x7ffc=function(_0x36a070,_0x503819){_0x36a070=_0x36a070-0x0;var _0xbae1ac=_0xffc7[_0x36a070];return _0xbae1ac;};'use strict';var _=require(_0x7ffc('0x0'));var Redis=require(_0x7ffc('0x1'));var qs=require(_0x7ffc('0x2'));var logger=require(_0x7ffc('0x3'))(_0x7ffc('0x4'));var config=require(_0x7ffc('0x5'));var db=require(_0x7ffc('0x6'))['db'];config[_0x7ffc('0x7')]=_['defaults'](config['redis'],{'host':_0x7ffc('0x8'),'port':0x18eb});var socket=require(_0x7ffc('0x9'))(new Redis(config[_0x7ffc('0x7')]));require(_0x7ffc('0xa'))['register'](socket);function respondWithResult(_0x356d41,_0xfef64){_0xfef64=_0xfef64||0xc8;return function(_0x541ded){if(_0x541ded){return _0x356d41[_0x7ffc('0xb')](_0xfef64)[_0x7ffc('0xc')](_0x541ded);}};}function respondWithFilteredResult(_0x44ddea,_0x3660d0){return function(_0x2a0a46){if(_0x2a0a46){var _0x257cb5=typeof _0x3660d0['offset']===_0x7ffc('0xd')&&typeof _0x3660d0[_0x7ffc('0xe')]===_0x7ffc('0xd');var _0x223073=_0x2a0a46['count'];var _0x21449f=_0x257cb5?0x0:_0x3660d0[_0x7ffc('0xf')];var _0x49ddfc=_0x257cb5?_0x2a0a46[_0x7ffc('0x10')]:_0x3660d0[_0x7ffc('0xf')]+_0x3660d0[_0x7ffc('0xe')];var _0x5078ab;if(_0x49ddfc>=_0x223073){_0x49ddfc=_0x223073;_0x5078ab=0xc8;}else{_0x5078ab=0xce;}_0x44ddea[_0x7ffc('0xb')](_0x5078ab);return _0x44ddea[_0x7ffc('0x11')](_0x7ffc('0x12'),_0x21449f+'-'+_0x49ddfc+'/'+_0x223073)[_0x7ffc('0xc')](_0x2a0a46);}return null;};}function saveUpdates(_0x5c3f1a){return function(_0x1ba46e){if(_0x1ba46e){return _0x1ba46e[_0x7ffc('0x13')](_0x5c3f1a)[_0x7ffc('0x14')](function(_0x1bd5f1){return _0x1bd5f1;});}return null;};}function removeEntity(_0x156ef5){return function(_0xdcdcc5){if(_0xdcdcc5){return _0xdcdcc5[_0x7ffc('0x15')]()[_0x7ffc('0x14')](function(){var _0x2c7b51=_0xdcdcc5[_0x7ffc('0x16')]({'plain':!![]});var _0x3ec201=_0x7ffc('0x17');return db['UserProfileResource'][_0x7ffc('0x15')]({'where':{'type':_0x3ec201,'resourceId':_0x2c7b51['id']}})[_0x7ffc('0x14')](function(){return _0xdcdcc5;});})[_0x7ffc('0x14')](function(){var _0x4925a3=new Redis(config[_0x7ffc('0x7')]);_0x4925a3[_0x7ffc('0x18')](_0x7ffc('0x19'),JSON[_0x7ffc('0x1a')]({'id':_0xdcdcc5['id'],'deleted':!![]}));})[_0x7ffc('0x14')](function(){_0x156ef5[_0x7ffc('0xb')](0xcc)[_0x7ffc('0x1b')]();});}};}function handleEntityNotFound(_0x9b512d){return function(_0xe073f5){if(!_0xe073f5){_0x9b512d[_0x7ffc('0x1c')](0x194);}return _0xe073f5;};}function handleError(_0x17514f,_0x1dd4c5){_0x1dd4c5=_0x1dd4c5||0x1f4;return function(_0x3f065f){logger[_0x7ffc('0x1d')](_0x3f065f['stack']);if(_0x3f065f[_0x7ffc('0x1e')]){delete _0x3f065f[_0x7ffc('0x1e')];}_0x17514f['status'](_0x1dd4c5)[_0x7ffc('0x1f')](_0x3f065f);};}exports[_0x7ffc('0x20')]=function(_0x458fbf,_0x5e34a7){var _0x17d3b0={},_0xf24c47={},_0x4b871b={'count':0x0,'rows':[]};var _0x11292f=_[_0x7ffc('0x21')](db['SquareProject'][_0x7ffc('0x22')],function(_0xba9f2b){return{'name':_0xba9f2b[_0x7ffc('0x23')],'type':_0xba9f2b[_0x7ffc('0x24')][_0x7ffc('0x25')]};});_0xf24c47[_0x7ffc('0x26')]=_[_0x7ffc('0x21')](_0x11292f,_0x7ffc('0x1e'));_0xf24c47['query']=_[_0x7ffc('0x27')](_0x458fbf[_0x7ffc('0x28')]);_0xf24c47[_0x7ffc('0x29')]=_[_0x7ffc('0x2a')](_0xf24c47[_0x7ffc('0x26')],_0xf24c47['query']);_0x17d3b0[_0x7ffc('0x2b')]=_['intersection'](_0xf24c47['model'],qs[_0x7ffc('0x2c')](_0x458fbf[_0x7ffc('0x28')]['fields']));_0x17d3b0['attributes']=_0x17d3b0[_0x7ffc('0x2b')][_0x7ffc('0x2d')]?_0x17d3b0['attributes']:_0xf24c47[_0x7ffc('0x26')];if(!_0x458fbf[_0x7ffc('0x28')][_0x7ffc('0x2e')](_0x7ffc('0x2f'))){_0x17d3b0[_0x7ffc('0xe')]=qs[_0x7ffc('0xe')](_0x458fbf['query'][_0x7ffc('0xe')]);_0x17d3b0[_0x7ffc('0xf')]=qs[_0x7ffc('0xf')](_0x458fbf[_0x7ffc('0x28')][_0x7ffc('0xf')]);}_0x17d3b0[_0x7ffc('0x30')]=qs['sort'](_0x458fbf[_0x7ffc('0x28')][_0x7ffc('0x31')]);_0x17d3b0['where']=qs['filters'](_[_0x7ffc('0x32')](_0x458fbf[_0x7ffc('0x28')],_0xf24c47[_0x7ffc('0x29')]),_0x11292f);if(_0x458fbf[_0x7ffc('0x28')]['filter']){_0x17d3b0[_0x7ffc('0x33')]=_[_0x7ffc('0x34')](_0x17d3b0[_0x7ffc('0x33')],{'$or':_[_0x7ffc('0x21')](_0x11292f,function(_0x34c2da){if(_0x34c2da[_0x7ffc('0x24')]!==_0x7ffc('0x35')){var _0x2b81c3={};_0x2b81c3[_0x34c2da[_0x7ffc('0x1e')]]={'$like':'%'+_0x458fbf[_0x7ffc('0x28')][_0x7ffc('0x36')]+'%'};return _0x2b81c3;}})});}_0x17d3b0=_[_0x7ffc('0x34')]({},_0x17d3b0,_0x458fbf[_0x7ffc('0x37')]);var _0x494311={'where':_0x17d3b0[_0x7ffc('0x33')]};return db[_0x7ffc('0x38')][_0x7ffc('0x10')](_0x494311)[_0x7ffc('0x14')](function(_0x332e33){_0x4b871b['count']=_0x332e33;if(_0x458fbf[_0x7ffc('0x28')][_0x7ffc('0x39')]){_0x17d3b0[_0x7ffc('0x3a')]=[{'all':!![]}];}return db[_0x7ffc('0x38')][_0x7ffc('0x3b')](_0x17d3b0);})[_0x7ffc('0x14')](function(_0x5b5a21){_0x4b871b[_0x7ffc('0x3c')]=_0x5b5a21;return _0x4b871b;})[_0x7ffc('0x14')](respondWithFilteredResult(_0x5e34a7,_0x17d3b0))[_0x7ffc('0x3d')](handleError(_0x5e34a7,null));};exports[_0x7ffc('0x3e')]=function(_0x22efe6,_0x2a8874){var _0x221507={'raw':![],'where':{'id':_0x22efe6['params']['id']}},_0xe374b2={};_0xe374b2[_0x7ffc('0x26')]=_[_0x7ffc('0x27')](db[_0x7ffc('0x38')][_0x7ffc('0x22')]);_0xe374b2[_0x7ffc('0x28')]=_[_0x7ffc('0x27')](_0x22efe6[_0x7ffc('0x28')]);_0xe374b2[_0x7ffc('0x29')]=_[_0x7ffc('0x2a')](_0xe374b2[_0x7ffc('0x26')],_0xe374b2[_0x7ffc('0x28')]);_0x221507[_0x7ffc('0x2b')]=_[_0x7ffc('0x2a')](_0xe374b2[_0x7ffc('0x26')],qs['fields'](_0x22efe6[_0x7ffc('0x28')][_0x7ffc('0x2c')]));_0x221507[_0x7ffc('0x2b')]=_0x221507[_0x7ffc('0x2b')][_0x7ffc('0x2d')]?_0x221507['attributes']:_0xe374b2[_0x7ffc('0x26')];if(_0x22efe6[_0x7ffc('0x28')][_0x7ffc('0x39')]){_0x221507[_0x7ffc('0x3a')]=[{'all':!![]}];}_0x221507=_['merge']({},_0x221507,_0x22efe6[_0x7ffc('0x37')]);return db['SquareProject'][_0x7ffc('0x3f')](_0x221507)[_0x7ffc('0x14')](handleEntityNotFound(_0x2a8874,null))[_0x7ffc('0x14')](respondWithResult(_0x2a8874,null))[_0x7ffc('0x3d')](handleError(_0x2a8874,null));};exports['create']=function(_0x1d135c,_0x5c4a02){return db[_0x7ffc('0x38')]['create'](_0x1d135c['body'],{})[_0x7ffc('0x14')](function(_0x3de29a){var _0x2fa4b7=_0x1d135c[_0x7ffc('0x40')][_0x7ffc('0x16')]({'plain':!![]});if(!_0x2fa4b7)throw new Error(_0x7ffc('0x41'));if(_0x2fa4b7['role']===_0x7ffc('0x40')){var _0x2a0ef2=_0x3de29a[_0x7ffc('0x16')]({'plain':!![]});var _0x5e599f=_0x7ffc('0x17');return db['UserProfileSection'][_0x7ffc('0x3f')]({'where':{'name':_0x5e599f,'userProfileId':_0x2fa4b7['userProfileId']},'raw':!![]})['then'](function(_0x50c469){if(_0x50c469&&_0x50c469[_0x7ffc('0x42')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a0ef2['name'],'resourceId':_0x2a0ef2['id'],'type':_0x50c469[_0x7ffc('0x1e')],'sectionId':_0x50c469['id']},{})[_0x7ffc('0x14')](function(){return _0x3de29a;});}else{return _0x3de29a;}})[_0x7ffc('0x3d')](function(_0x2c8fe3){logger[_0x7ffc('0x1d')](_0x7ffc('0x43'),_0x2c8fe3);throw _0x2c8fe3;});}return _0x3de29a;})[_0x7ffc('0x14')](respondWithResult(_0x5c4a02,0xc9))[_0x7ffc('0x3d')](handleError(_0x5c4a02,null));};exports[_0x7ffc('0x13')]=function(_0x426908,_0x4bf9a2){if(_0x426908[_0x7ffc('0x44')]['id']){delete _0x426908[_0x7ffc('0x44')]['id'];}return db[_0x7ffc('0x38')][_0x7ffc('0x3f')]({'where':{'id':_0x426908[_0x7ffc('0x45')]['id']}})[_0x7ffc('0x14')](handleEntityNotFound(_0x4bf9a2,null))[_0x7ffc('0x14')](saveUpdates(_0x426908['body'],null))['then'](function(_0x565d1e){if(!_0x565d1e)return;var _0x39756c=_0x565d1e[_0x7ffc('0x16')]({'plain':!![]});return _0x39756c;})[_0x7ffc('0x14')](function(_0x30b092){var _0x4e7169=new Redis(config[_0x7ffc('0x7')]);_0x4e7169[_0x7ffc('0x18')]('agi',JSON[_0x7ffc('0x1a')](_[_0x7ffc('0x32')](_0x30b092,['id',_0x7ffc('0x1e'),_0x7ffc('0x46')])));return _0x30b092;})[_0x7ffc('0x14')](respondWithResult(_0x4bf9a2,null))['catch'](handleError(_0x4bf9a2,null));};exports[_0x7ffc('0x15')]=function(_0x1cfe9a,_0x1f810f){return db[_0x7ffc('0x38')][_0x7ffc('0x3f')]({'where':{'id':_0x1cfe9a['params']['id']}})[_0x7ffc('0x14')](handleEntityNotFound(_0x1f810f,null))[_0x7ffc('0x14')](removeEntity(_0x1f810f,null))['catch'](handleError(_0x1f810f,null));};
\ No newline at end of file