Built motion from commit 42801a18.|2.6.28
[motion2.git] / server / api / squareProject / squareProject.controller.js
index d3e9f5c..f801c2c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd773=['lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','send','SquareProject','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','length','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','find','params','production'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xd773,0x159));var _0x3d77=function(_0x5c87fa,_0x17733f){_0x5c87fa=_0x5c87fa-0x0;var _0x46c0f1=_0xd773[_0x5c87fa];return _0x46c0f1;};'use strict';var _=require(_0x3d77('0x0'));var Redis=require('ioredis');var qs=require(_0x3d77('0x1'));var logger=require(_0x3d77('0x2'))(_0x3d77('0x3'));var config=require(_0x3d77('0x4'));var db=require(_0x3d77('0x5'))['db'];config['redis']=_[_0x3d77('0x6')](config[_0x3d77('0x7')],{'host':_0x3d77('0x8'),'port':0x18eb});var socket=require(_0x3d77('0x9'))(new Redis(config[_0x3d77('0x7')]));require(_0x3d77('0xa'))[_0x3d77('0xb')](socket);function respondWithResult(_0x51d036,_0x25c986){_0x25c986=_0x25c986||0xc8;return function(_0x496877){if(_0x496877){return _0x51d036['status'](_0x25c986)['json'](_0x496877);}};}function respondWithFilteredResult(_0x27ca64,_0xdee489){return function(_0x44eb7d){if(_0x44eb7d){var _0x2cd141=typeof _0xdee489[_0x3d77('0xc')]===_0x3d77('0xd')&&typeof _0xdee489[_0x3d77('0xe')]==='undefined';var _0x5aadc3=_0x44eb7d[_0x3d77('0xf')];var _0x5472e3=_0x2cd141?0x0:_0xdee489[_0x3d77('0xc')];var _0x5b0453=_0x2cd141?_0x44eb7d[_0x3d77('0xf')]:_0xdee489[_0x3d77('0xc')]+_0xdee489[_0x3d77('0xe')];var _0x173a5d;if(_0x5b0453>=_0x5aadc3){_0x5b0453=_0x5aadc3;_0x173a5d=0xc8;}else{_0x173a5d=0xce;}_0x27ca64[_0x3d77('0x10')](_0x173a5d);return _0x27ca64[_0x3d77('0x11')](_0x3d77('0x12'),_0x5472e3+'-'+_0x5b0453+'/'+_0x5aadc3)[_0x3d77('0x13')](_0x44eb7d);}return null;};}function saveUpdates(_0x29aa66){return function(_0x48060b){if(_0x48060b){return _0x48060b[_0x3d77('0x14')](_0x29aa66)[_0x3d77('0x15')](function(_0x1d1e39){return _0x1d1e39;});}return null;};}function removeEntity(_0x374146){return function(_0xc2dd6a){if(_0xc2dd6a){return _0xc2dd6a[_0x3d77('0x16')]()[_0x3d77('0x15')](function(){var _0x2569c5=_0xc2dd6a[_0x3d77('0x17')]({'plain':!![]});var _0x2dced4=_0x3d77('0x18');return db[_0x3d77('0x19')]['destroy']({'where':{'type':_0x2dced4,'resourceId':_0x2569c5['id']}})['then'](function(){return _0xc2dd6a;});})[_0x3d77('0x15')](function(){var _0x34094a=new Redis(config[_0x3d77('0x7')]);_0x34094a[_0x3d77('0x1a')](_0x3d77('0x1b'),JSON[_0x3d77('0x1c')]({'id':_0xc2dd6a['id'],'deleted':!![]}));})[_0x3d77('0x15')](function(){_0x374146[_0x3d77('0x10')](0xcc)[_0x3d77('0x1d')]();});}};}function handleEntityNotFound(_0x4f43e4){return function(_0x1d4c16){if(!_0x1d4c16){_0x4f43e4[_0x3d77('0x1e')](0x194);}return _0x1d4c16;};}function handleError(_0x5cb831,_0xec558){_0xec558=_0xec558||0x1f4;return function(_0x3433e1){logger[_0x3d77('0x1f')](_0x3433e1['stack']);if(_0x3433e1[_0x3d77('0x20')]){delete _0x3433e1['name'];}_0x5cb831[_0x3d77('0x10')](_0xec558)[_0x3d77('0x21')](_0x3433e1);};}exports['index']=function(_0x59b6a5,_0x45f42e){var _0x2650d3={},_0xa9e2bf={},_0x2bbd66={'count':0x0,'rows':[]};var _0x52244d=_['map'](db[_0x3d77('0x22')][_0x3d77('0x23')],function(_0x1f3343){return{'name':_0x1f3343['fieldName'],'type':_0x1f3343[_0x3d77('0x24')]['key']};});_0xa9e2bf[_0x3d77('0x25')]=_[_0x3d77('0x26')](_0x52244d,'name');_0xa9e2bf[_0x3d77('0x27')]=_[_0x3d77('0x28')](_0x59b6a5[_0x3d77('0x27')]);_0xa9e2bf[_0x3d77('0x29')]=_[_0x3d77('0x2a')](_0xa9e2bf['model'],_0xa9e2bf[_0x3d77('0x27')]);_0x2650d3['attributes']=_[_0x3d77('0x2a')](_0xa9e2bf[_0x3d77('0x25')],qs[_0x3d77('0x2b')](_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x2b')]));_0x2650d3['attributes']=_0x2650d3[_0x3d77('0x2c')]['length']?_0x2650d3[_0x3d77('0x2c')]:_0xa9e2bf['model'];if(!_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x2d')]('nolimit')){_0x2650d3[_0x3d77('0xe')]=qs['limit'](_0x59b6a5[_0x3d77('0x27')][_0x3d77('0xe')]);_0x2650d3[_0x3d77('0xc')]=qs[_0x3d77('0xc')](_0x59b6a5[_0x3d77('0x27')][_0x3d77('0xc')]);}_0x2650d3[_0x3d77('0x2e')]=qs[_0x3d77('0x2f')](_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x2f')]);_0x2650d3['where']=qs[_0x3d77('0x29')](_[_0x3d77('0x30')](_0x59b6a5['query'],_0xa9e2bf[_0x3d77('0x29')]),_0x52244d);if(_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x31')]){_0x2650d3[_0x3d77('0x32')]=_[_0x3d77('0x33')](_0x2650d3[_0x3d77('0x32')],{'$or':_['map'](_0x52244d,function(_0x11f6f1){if(_0x11f6f1['type']!=='VIRTUAL'){var _0x19385c={};_0x19385c[_0x11f6f1[_0x3d77('0x20')]]={'$like':'%'+_0x59b6a5['query']['filter']+'%'};return _0x19385c;}})});}_0x2650d3=_['merge']({},_0x2650d3,_0x59b6a5[_0x3d77('0x34')]);var _0x3c4411={'where':_0x2650d3[_0x3d77('0x32')]};return db['SquareProject']['count'](_0x3c4411)['then'](function(_0x22f153){_0x2bbd66[_0x3d77('0xf')]=_0x22f153;if(_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x35')]){_0x2650d3[_0x3d77('0x36')]=[{'all':!![]}];}return db[_0x3d77('0x22')][_0x3d77('0x37')](_0x2650d3);})['then'](function(_0x28e958){_0x2bbd66[_0x3d77('0x38')]=_0x28e958;return _0x2bbd66;})[_0x3d77('0x15')](respondWithFilteredResult(_0x45f42e,_0x2650d3))['catch'](handleError(_0x45f42e,null));};exports['show']=function(_0x5d4a8d,_0x4afb4b){var _0x4f1347={'raw':![],'where':{'id':_0x5d4a8d['params']['id']}},_0x3a4aa4={};_0x3a4aa4[_0x3d77('0x25')]=_[_0x3d77('0x28')](db[_0x3d77('0x22')][_0x3d77('0x23')]);_0x3a4aa4[_0x3d77('0x27')]=_[_0x3d77('0x28')](_0x5d4a8d[_0x3d77('0x27')]);_0x3a4aa4[_0x3d77('0x29')]=_['intersection'](_0x3a4aa4['model'],_0x3a4aa4['query']);_0x4f1347[_0x3d77('0x2c')]=_[_0x3d77('0x2a')](_0x3a4aa4[_0x3d77('0x25')],qs[_0x3d77('0x2b')](_0x5d4a8d[_0x3d77('0x27')][_0x3d77('0x2b')]));_0x4f1347[_0x3d77('0x2c')]=_0x4f1347[_0x3d77('0x2c')][_0x3d77('0x39')]?_0x4f1347[_0x3d77('0x2c')]:_0x3a4aa4[_0x3d77('0x25')];if(_0x5d4a8d['query'][_0x3d77('0x35')]){_0x4f1347[_0x3d77('0x36')]=[{'all':!![]}];}_0x4f1347=_[_0x3d77('0x33')]({},_0x4f1347,_0x5d4a8d[_0x3d77('0x34')]);return db[_0x3d77('0x22')]['find'](_0x4f1347)[_0x3d77('0x15')](handleEntityNotFound(_0x4afb4b,null))[_0x3d77('0x15')](respondWithResult(_0x4afb4b,null))[_0x3d77('0x3a')](handleError(_0x4afb4b,null));};exports['create']=function(_0x4d4f83,_0x3f7a52){return db['SquareProject'][_0x3d77('0x3b')](_0x4d4f83[_0x3d77('0x3c')],{})[_0x3d77('0x15')](function(_0x2190c1){var _0x3af783=_0x4d4f83['user'][_0x3d77('0x17')]({'plain':!![]});if(!_0x3af783)throw new Error(_0x3d77('0x3d'));if(_0x3af783[_0x3d77('0x3e')]===_0x3d77('0x3f')){var _0x475097=_0x2190c1['get']({'plain':!![]});var _0xf3317c='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0xf3317c,'userProfileId':_0x3af783[_0x3d77('0x40')]},'raw':!![]})[_0x3d77('0x15')](function(_0x1b2e61){if(_0x1b2e61&&_0x1b2e61[_0x3d77('0x41')]===0x0){return db[_0x3d77('0x19')][_0x3d77('0x3b')]({'name':_0x475097[_0x3d77('0x20')],'resourceId':_0x475097['id'],'type':_0x1b2e61[_0x3d77('0x20')],'sectionId':_0x1b2e61['id']},{})[_0x3d77('0x15')](function(){return _0x2190c1;});}else{return _0x2190c1;}})[_0x3d77('0x3a')](function(_0x12e56b){logger[_0x3d77('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12e56b);throw _0x12e56b;});}return _0x2190c1;})[_0x3d77('0x15')](respondWithResult(_0x3f7a52,0xc9))[_0x3d77('0x3a')](handleError(_0x3f7a52,null));};exports[_0x3d77('0x14')]=function(_0x50e98c,_0x1b6ef0){if(_0x50e98c[_0x3d77('0x3c')]['id']){delete _0x50e98c[_0x3d77('0x3c')]['id'];}return db[_0x3d77('0x22')][_0x3d77('0x42')]({'where':{'id':_0x50e98c[_0x3d77('0x43')]['id']}})[_0x3d77('0x15')](handleEntityNotFound(_0x1b6ef0,null))[_0x3d77('0x15')](saveUpdates(_0x50e98c[_0x3d77('0x3c')],null))[_0x3d77('0x15')](function(_0xc11a20){if(!_0xc11a20)return;var _0xa74122=_0xc11a20[_0x3d77('0x17')]({'plain':!![]});return _0xa74122;})[_0x3d77('0x15')](function(_0x10e2b0){var _0x201803=new Redis(config[_0x3d77('0x7')]);_0x201803['publish'](_0x3d77('0x1b'),JSON[_0x3d77('0x1c')](_[_0x3d77('0x30')](_0x10e2b0,['id','name',_0x3d77('0x44')])));return _0x10e2b0;})['then'](respondWithResult(_0x1b6ef0,null))[_0x3d77('0x3a')](handleError(_0x1b6ef0,null));};exports[_0x3d77('0x16')]=function(_0x1621df,_0x2396d6){return db['SquareProject']['find']({'where':{'id':_0x1621df[_0x3d77('0x43')]['id']}})[_0x3d77('0x15')](handleEntityNotFound(_0x2396d6,null))[_0x3d77('0x15')](removeEntity(_0x2396d6,null))[_0x3d77('0x3a')](handleError(_0x2396d6,null));};
\ No newline at end of file
+var _0xfafb=['production','params','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','limit','count','status','update','then','get','SquareProjects','destroy','publish','end','sendStatus','stack','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareProject','includeAll','rows','show','find','catch','create','body','user','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify'];(function(_0x5160a6,_0x5e9b19){var _0x5d1b57=function(_0x1b139f){while(--_0x1b139f){_0x5160a6['push'](_0x5160a6['shift']());}};_0x5d1b57(++_0x5e9b19);}(_0xfafb,0x1c2));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbfaf('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbfaf('0x1'))(_0xbfaf('0x2'));var config=require(_0xbfaf('0x3'));var db=require(_0xbfaf('0x4'))['db'];config[_0xbfaf('0x5')]=_[_0xbfaf('0x6')](config[_0xbfaf('0x5')],{'host':_0xbfaf('0x7'),'port':0x18eb});var socket=require(_0xbfaf('0x8'))(new Redis(config[_0xbfaf('0x5')]));require(_0xbfaf('0x9'))[_0xbfaf('0xa')](socket);function respondWithResult(_0x415953,_0x37b612){_0x37b612=_0x37b612||0xc8;return function(_0x1ca0d6){if(_0x1ca0d6){return _0x415953['status'](_0x37b612)[_0xbfaf('0xb')](_0x1ca0d6);}};}function respondWithFilteredResult(_0x4478ea,_0x3fe050){return function(_0x1b6e56){if(_0x1b6e56){var _0x5f31ca=typeof _0x3fe050[_0xbfaf('0xc')]==='undefined'&&typeof _0x3fe050[_0xbfaf('0xd')]==='undefined';var _0x36306=_0x1b6e56[_0xbfaf('0xe')];var _0x385b85=_0x5f31ca?0x0:_0x3fe050[_0xbfaf('0xc')];var _0x50c672=_0x5f31ca?_0x1b6e56[_0xbfaf('0xe')]:_0x3fe050['offset']+_0x3fe050[_0xbfaf('0xd')];var _0x5b34fa;if(_0x50c672>=_0x36306){_0x50c672=_0x36306;_0x5b34fa=0xc8;}else{_0x5b34fa=0xce;}_0x4478ea[_0xbfaf('0xf')](_0x5b34fa);return _0x4478ea['set']('Content-Range',_0x385b85+'-'+_0x50c672+'/'+_0x36306)['json'](_0x1b6e56);}return null;};}function saveUpdates(_0x1976d6){return function(_0x20c9f1){if(_0x20c9f1){return _0x20c9f1[_0xbfaf('0x10')](_0x1976d6)[_0xbfaf('0x11')](function(_0x2c44c8){return _0x2c44c8;});}return null;};}function removeEntity(_0x51efe9){return function(_0x5027d1){if(_0x5027d1){return _0x5027d1['destroy']()[_0xbfaf('0x11')](function(){var _0x1186d4=_0x5027d1[_0xbfaf('0x12')]({'plain':!![]});var _0x261c88=_0xbfaf('0x13');return db['UserProfileResource'][_0xbfaf('0x14')]({'where':{'type':_0x261c88,'resourceId':_0x1186d4['id']}})[_0xbfaf('0x11')](function(){return _0x5027d1;});})[_0xbfaf('0x11')](function(){var _0xf26518=new Redis(config['redis']);_0xf26518[_0xbfaf('0x15')]('agi',JSON['stringify']({'id':_0x5027d1['id'],'deleted':!![]}));})[_0xbfaf('0x11')](function(){_0x51efe9[_0xbfaf('0xf')](0xcc)[_0xbfaf('0x16')]();});}};}function handleEntityNotFound(_0x5dbf12){return function(_0x241315){if(!_0x241315){_0x5dbf12[_0xbfaf('0x17')](0x194);}return _0x241315;};}function handleError(_0xbcd8c3,_0x1165c4){_0x1165c4=_0x1165c4||0x1f4;return function(_0x3962ce){logger['error'](_0x3962ce[_0xbfaf('0x18')]);if(_0x3962ce['name']){delete _0x3962ce['name'];}_0xbcd8c3[_0xbfaf('0xf')](_0x1165c4)['send'](_0x3962ce);};}exports['index']=function(_0x169956,_0x2913d5){var _0x1f77af={},_0x90cd70={},_0x5b5645={'count':0x0,'rows':[]};var _0x2dde35=_[_0xbfaf('0x19')](db['SquareProject'][_0xbfaf('0x1a')],function(_0x59e3ee){return{'name':_0x59e3ee[_0xbfaf('0x1b')],'type':_0x59e3ee[_0xbfaf('0x1c')][_0xbfaf('0x1d')]};});_0x90cd70[_0xbfaf('0x1e')]=_['map'](_0x2dde35,_0xbfaf('0x1f'));_0x90cd70[_0xbfaf('0x20')]=_[_0xbfaf('0x21')](_0x169956[_0xbfaf('0x20')]);_0x90cd70[_0xbfaf('0x22')]=_[_0xbfaf('0x23')](_0x90cd70[_0xbfaf('0x1e')],_0x90cd70['query']);_0x1f77af[_0xbfaf('0x24')]=_['intersection'](_0x90cd70[_0xbfaf('0x1e')],qs[_0xbfaf('0x25')](_0x169956[_0xbfaf('0x20')]['fields']));_0x1f77af[_0xbfaf('0x24')]=_0x1f77af['attributes'][_0xbfaf('0x26')]?_0x1f77af['attributes']:_0x90cd70[_0xbfaf('0x1e')];if(!_0x169956[_0xbfaf('0x20')]['hasOwnProperty']('nolimit')){_0x1f77af[_0xbfaf('0xd')]=qs[_0xbfaf('0xd')](_0x169956[_0xbfaf('0x20')][_0xbfaf('0xd')]);_0x1f77af['offset']=qs[_0xbfaf('0xc')](_0x169956[_0xbfaf('0x20')][_0xbfaf('0xc')]);}_0x1f77af[_0xbfaf('0x27')]=qs[_0xbfaf('0x28')](_0x169956[_0xbfaf('0x20')][_0xbfaf('0x28')]);_0x1f77af[_0xbfaf('0x29')]=qs[_0xbfaf('0x22')](_[_0xbfaf('0x2a')](_0x169956[_0xbfaf('0x20')],_0x90cd70[_0xbfaf('0x22')]),_0x2dde35);if(_0x169956[_0xbfaf('0x20')][_0xbfaf('0x2b')]){_0x1f77af[_0xbfaf('0x29')]=_[_0xbfaf('0x2c')](_0x1f77af[_0xbfaf('0x29')],{'$or':_[_0xbfaf('0x19')](_0x2dde35,function(_0x5ccfb1){if(_0x5ccfb1[_0xbfaf('0x1c')]!==_0xbfaf('0x2d')){var _0x19d84f={};_0x19d84f[_0x5ccfb1[_0xbfaf('0x1f')]]={'$like':'%'+_0x169956[_0xbfaf('0x20')][_0xbfaf('0x2b')]+'%'};return _0x19d84f;}})});}_0x1f77af=_[_0xbfaf('0x2c')]({},_0x1f77af,_0x169956[_0xbfaf('0x2e')]);var _0x1b0952={'where':_0x1f77af['where']};return db[_0xbfaf('0x2f')][_0xbfaf('0xe')](_0x1b0952)['then'](function(_0x150c54){_0x5b5645['count']=_0x150c54;if(_0x169956['query'][_0xbfaf('0x30')]){_0x1f77af['include']=[{'all':!![]}];}return db[_0xbfaf('0x2f')]['findAll'](_0x1f77af);})[_0xbfaf('0x11')](function(_0x1adeb7){_0x5b5645[_0xbfaf('0x31')]=_0x1adeb7;return _0x5b5645;})[_0xbfaf('0x11')](respondWithFilteredResult(_0x2913d5,_0x1f77af))['catch'](handleError(_0x2913d5,null));};exports[_0xbfaf('0x32')]=function(_0x5e0f60,_0x56b34f){var _0x1b98f2={'raw':![],'where':{'id':_0x5e0f60['params']['id']}},_0x5b7630={};_0x5b7630[_0xbfaf('0x1e')]=_[_0xbfaf('0x21')](db[_0xbfaf('0x2f')][_0xbfaf('0x1a')]);_0x5b7630[_0xbfaf('0x20')]=_['keys'](_0x5e0f60[_0xbfaf('0x20')]);_0x5b7630[_0xbfaf('0x22')]=_[_0xbfaf('0x23')](_0x5b7630[_0xbfaf('0x1e')],_0x5b7630['query']);_0x1b98f2[_0xbfaf('0x24')]=_[_0xbfaf('0x23')](_0x5b7630[_0xbfaf('0x1e')],qs[_0xbfaf('0x25')](_0x5e0f60[_0xbfaf('0x20')][_0xbfaf('0x25')]));_0x1b98f2['attributes']=_0x1b98f2[_0xbfaf('0x24')]['length']?_0x1b98f2[_0xbfaf('0x24')]:_0x5b7630[_0xbfaf('0x1e')];if(_0x5e0f60[_0xbfaf('0x20')]['includeAll']){_0x1b98f2['include']=[{'all':!![]}];}_0x1b98f2=_['merge']({},_0x1b98f2,_0x5e0f60['options']);return db[_0xbfaf('0x2f')][_0xbfaf('0x33')](_0x1b98f2)[_0xbfaf('0x11')](handleEntityNotFound(_0x56b34f,null))[_0xbfaf('0x11')](respondWithResult(_0x56b34f,null))[_0xbfaf('0x34')](handleError(_0x56b34f,null));};exports[_0xbfaf('0x35')]=function(_0x4212bf,_0x35f984){return db[_0xbfaf('0x2f')]['create'](_0x4212bf[_0xbfaf('0x36')],{})['then'](function(_0x4c7fa0){var _0x1d7871=_0x4212bf[_0xbfaf('0x37')][_0xbfaf('0x12')]({'plain':!![]});if(!_0x1d7871)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d7871['role']===_0xbfaf('0x37')){var _0x5a8414=_0x4c7fa0[_0xbfaf('0x12')]({'plain':!![]});var _0x4abdb1=_0xbfaf('0x13');return db[_0xbfaf('0x38')][_0xbfaf('0x33')]({'where':{'name':_0x4abdb1,'userProfileId':_0x1d7871[_0xbfaf('0x39')]},'raw':!![]})[_0xbfaf('0x11')](function(_0x48557c){if(_0x48557c&&_0x48557c['autoAssociation']===0x0){return db[_0xbfaf('0x3a')]['create']({'name':_0x5a8414[_0xbfaf('0x1f')],'resourceId':_0x5a8414['id'],'type':_0x48557c['name'],'sectionId':_0x48557c['id']},{})['then'](function(){return _0x4c7fa0;});}else{return _0x4c7fa0;}})[_0xbfaf('0x34')](function(_0x490629){logger[_0xbfaf('0x3b')](_0xbfaf('0x3c'),_0x490629);throw _0x490629;});}return _0x4c7fa0;})['then'](respondWithResult(_0x35f984,0xc9))[_0xbfaf('0x34')](handleError(_0x35f984,null));};exports['update']=function(_0x4f4b0a,_0x366213){if(_0x4f4b0a[_0xbfaf('0x36')]['id']){delete _0x4f4b0a[_0xbfaf('0x36')]['id'];}return db[_0xbfaf('0x2f')][_0xbfaf('0x33')]({'where':{'id':_0x4f4b0a['params']['id']}})[_0xbfaf('0x11')](handleEntityNotFound(_0x366213,null))[_0xbfaf('0x11')](saveUpdates(_0x4f4b0a['body'],null))[_0xbfaf('0x11')](function(_0x53d6cd){if(!_0x53d6cd)return;var _0x17693b=_0x53d6cd[_0xbfaf('0x12')]({'plain':!![]});return _0x17693b;})['then'](function(_0x168009){var _0x2dcdd3=new Redis(config['redis']);_0x2dcdd3[_0xbfaf('0x15')]('agi',JSON[_0xbfaf('0x3d')](_[_0xbfaf('0x2a')](_0x168009,['id',_0xbfaf('0x1f'),_0xbfaf('0x3e')])));return _0x168009;})[_0xbfaf('0x11')](respondWithResult(_0x366213,null))[_0xbfaf('0x34')](handleError(_0x366213,null));};exports[_0xbfaf('0x14')]=function(_0xc83910,_0x53db7a){return db['SquareProject'][_0xbfaf('0x33')]({'where':{'id':_0xc83910[_0xbfaf('0x3f')]['id']}})[_0xbfaf('0x11')](handleEntityNotFound(_0x53db7a,null))[_0xbfaf('0x11')](removeEntity(_0x53db7a,null))['catch'](handleError(_0x53db7a,null));};
\ No newline at end of file