Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / api / squareProject / squareProject.controller.js
index 5ce8c93..2ba8bc4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0xf485=['includeAll','include','findAll','rows','catch','show','keys','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','params','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','options','SquareProject'];(function(_0x4408f6,_0x597ade){var _0x31f8fd=function(_0x384b2a){while(--_0x384b2a){_0x4408f6['push'](_0x4408f6['shift']());}};_0x31f8fd(++_0x597ade);}(_0xf485,0xe7));var _0x5f48=function(_0x3b8597,_0x57ce17){_0x3b8597=_0x3b8597-0x0;var _0x2089dc=_0xf485[_0x3b8597];return _0x2089dc;};'use strict';var _=require(_0x5f48('0x0'));var Redis=require('ioredis');var qs=require(_0x5f48('0x1'));var logger=require(_0x5f48('0x2'))(_0x5f48('0x3'));var config=require(_0x5f48('0x4'));var db=require('../../mysqldb')['db'];config[_0x5f48('0x5')]=_[_0x5f48('0x6')](config[_0x5f48('0x5')],{'host':_0x5f48('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5f48('0x8'))[_0x5f48('0x9')](socket);function respondWithResult(_0x5ad1f6,_0x3a23ce){_0x3a23ce=_0x3a23ce||0xc8;return function(_0x47e52f){if(_0x47e52f){return _0x5ad1f6[_0x5f48('0xa')](_0x3a23ce)[_0x5f48('0xb')](_0x47e52f);}};}function respondWithFilteredResult(_0x2ae04f,_0x4991e9){return function(_0x20b040){if(_0x20b040){var _0x62d41e=typeof _0x4991e9[_0x5f48('0xc')]==='undefined'&&typeof _0x4991e9[_0x5f48('0xd')]===_0x5f48('0xe');var _0x43cc94=_0x20b040[_0x5f48('0xf')];var _0x586228=_0x62d41e?0x0:_0x4991e9[_0x5f48('0xc')];var _0x149b4c=_0x62d41e?_0x20b040[_0x5f48('0xf')]:_0x4991e9['offset']+_0x4991e9[_0x5f48('0xd')];var _0x1bf082;if(_0x149b4c>=_0x43cc94){_0x149b4c=_0x43cc94;_0x1bf082=0xc8;}else{_0x1bf082=0xce;}_0x2ae04f[_0x5f48('0xa')](_0x1bf082);return _0x2ae04f[_0x5f48('0x10')](_0x5f48('0x11'),_0x586228+'-'+_0x149b4c+'/'+_0x43cc94)[_0x5f48('0xb')](_0x20b040);}return null;};}function saveUpdates(_0x402c29){return function(_0x24fcbc){if(_0x24fcbc){return _0x24fcbc['update'](_0x402c29)[_0x5f48('0x12')](function(_0x545e3c){return _0x545e3c;});}return null;};}function removeEntity(_0x546d78){return function(_0x4d2c10){if(_0x4d2c10){return _0x4d2c10[_0x5f48('0x13')]()['then'](function(){var _0x3a3c54=_0x4d2c10[_0x5f48('0x14')]({'plain':!![]});var _0x3624a4=_0x5f48('0x15');return db[_0x5f48('0x16')][_0x5f48('0x13')]({'where':{'type':_0x3624a4,'resourceId':_0x3a3c54['id']}})[_0x5f48('0x12')](function(){return _0x4d2c10;});})['then'](function(){var _0x58a07f=new Redis(config[_0x5f48('0x5')]);_0x58a07f[_0x5f48('0x17')](_0x5f48('0x18'),JSON[_0x5f48('0x19')]({'id':_0x4d2c10['id'],'deleted':!![]}));})[_0x5f48('0x12')](function(){_0x546d78['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x315393){return function(_0x1c8048){if(!_0x1c8048){_0x315393[_0x5f48('0x1a')](0x194);}return _0x1c8048;};}function handleError(_0x376592,_0x4440e8){_0x4440e8=_0x4440e8||0x1f4;return function(_0x6e307b){logger[_0x5f48('0x1b')](_0x6e307b[_0x5f48('0x1c')]);if(_0x6e307b[_0x5f48('0x1d')]){delete _0x6e307b['name'];}_0x376592[_0x5f48('0xa')](_0x4440e8)[_0x5f48('0x1e')](_0x6e307b);};}exports[_0x5f48('0x1f')]=function(_0x46dd83,_0x192816){var _0x1992a1={},_0x3cb5c7={},_0x1f72d9={'count':0x0,'rows':[]};var _0x45ac33=_[_0x5f48('0x20')](db['SquareProject']['rawAttributes'],function(_0x228f21){return{'name':_0x228f21[_0x5f48('0x21')],'type':_0x228f21['type'][_0x5f48('0x22')]};});_0x3cb5c7[_0x5f48('0x23')]=_[_0x5f48('0x20')](_0x45ac33,_0x5f48('0x1d'));_0x3cb5c7[_0x5f48('0x24')]=_['keys'](_0x46dd83['query']);_0x3cb5c7[_0x5f48('0x25')]=_['intersection'](_0x3cb5c7['model'],_0x3cb5c7[_0x5f48('0x24')]);_0x1992a1['attributes']=_['intersection'](_0x3cb5c7[_0x5f48('0x23')],qs[_0x5f48('0x26')](_0x46dd83[_0x5f48('0x24')][_0x5f48('0x26')]));_0x1992a1[_0x5f48('0x27')]=_0x1992a1['attributes'][_0x5f48('0x28')]?_0x1992a1['attributes']:_0x3cb5c7[_0x5f48('0x23')];if(!_0x46dd83[_0x5f48('0x24')]['hasOwnProperty'](_0x5f48('0x29'))){_0x1992a1[_0x5f48('0xd')]=qs['limit'](_0x46dd83[_0x5f48('0x24')]['limit']);_0x1992a1[_0x5f48('0xc')]=qs[_0x5f48('0xc')](_0x46dd83[_0x5f48('0x24')]['offset']);}_0x1992a1['order']=qs[_0x5f48('0x2a')](_0x46dd83[_0x5f48('0x24')][_0x5f48('0x2a')]);_0x1992a1[_0x5f48('0x2b')]=qs['filters'](_[_0x5f48('0x2c')](_0x46dd83[_0x5f48('0x24')],_0x3cb5c7[_0x5f48('0x25')]),_0x45ac33);if(_0x46dd83[_0x5f48('0x24')]['filter']){_0x1992a1['where']=_[_0x5f48('0x2d')](_0x1992a1['where'],{'$or':_[_0x5f48('0x20')](_0x45ac33,function(_0x3e7345){if(_0x3e7345['type']!==_0x5f48('0x2e')){var _0x5ec385={};_0x5ec385[_0x3e7345[_0x5f48('0x1d')]]={'$like':'%'+_0x46dd83[_0x5f48('0x24')]['filter']+'%'};return _0x5ec385;}})});}_0x1992a1=_[_0x5f48('0x2d')]({},_0x1992a1,_0x46dd83[_0x5f48('0x2f')]);var _0x120084={'where':_0x1992a1[_0x5f48('0x2b')]};return db[_0x5f48('0x30')]['count'](_0x120084)[_0x5f48('0x12')](function(_0x3cfba9){_0x1f72d9['count']=_0x3cfba9;if(_0x46dd83['query'][_0x5f48('0x31')]){_0x1992a1[_0x5f48('0x32')]=[{'all':!![]}];}return db['SquareProject'][_0x5f48('0x33')](_0x1992a1);})[_0x5f48('0x12')](function(_0x3f9ce1){_0x1f72d9[_0x5f48('0x34')]=_0x3f9ce1;return _0x1f72d9;})[_0x5f48('0x12')](respondWithFilteredResult(_0x192816,_0x1992a1))[_0x5f48('0x35')](handleError(_0x192816,null));};exports[_0x5f48('0x36')]=function(_0x444bb8,_0x547a22){var _0xc91b01={'raw':![],'where':{'id':_0x444bb8['params']['id']}},_0x373149={};_0x373149[_0x5f48('0x23')]=_[_0x5f48('0x37')](db[_0x5f48('0x30')][_0x5f48('0x38')]);_0x373149['query']=_[_0x5f48('0x37')](_0x444bb8[_0x5f48('0x24')]);_0x373149[_0x5f48('0x25')]=_[_0x5f48('0x39')](_0x373149[_0x5f48('0x23')],_0x373149[_0x5f48('0x24')]);_0xc91b01[_0x5f48('0x27')]=_[_0x5f48('0x39')](_0x373149[_0x5f48('0x23')],qs['fields'](_0x444bb8[_0x5f48('0x24')][_0x5f48('0x26')]));_0xc91b01[_0x5f48('0x27')]=_0xc91b01[_0x5f48('0x27')][_0x5f48('0x28')]?_0xc91b01[_0x5f48('0x27')]:_0x373149[_0x5f48('0x23')];if(_0x444bb8[_0x5f48('0x24')][_0x5f48('0x31')]){_0xc91b01[_0x5f48('0x32')]=[{'all':!![]}];}_0xc91b01=_[_0x5f48('0x2d')]({},_0xc91b01,_0x444bb8['options']);return db[_0x5f48('0x30')][_0x5f48('0x3a')](_0xc91b01)[_0x5f48('0x12')](handleEntityNotFound(_0x547a22,null))[_0x5f48('0x12')](respondWithResult(_0x547a22,null))[_0x5f48('0x35')](handleError(_0x547a22,null));};exports[_0x5f48('0x3b')]=function(_0x5ae128,_0x338354){return db[_0x5f48('0x30')][_0x5f48('0x3b')](_0x5ae128['body'],{})[_0x5f48('0x12')](function(_0x220e34){var _0x23f6bc=_0x5ae128[_0x5f48('0x3c')]['get']({'plain':!![]});if(!_0x23f6bc)throw new Error(_0x5f48('0x3d'));if(_0x23f6bc[_0x5f48('0x3e')]===_0x5f48('0x3c')){var _0x518efb=_0x220e34[_0x5f48('0x14')]({'plain':!![]});var _0x38c8b4=_0x5f48('0x15');return db[_0x5f48('0x3f')]['find']({'where':{'name':_0x38c8b4,'userProfileId':_0x23f6bc[_0x5f48('0x40')]},'raw':!![]})[_0x5f48('0x12')](function(_0x3ebaf2){if(_0x3ebaf2&&_0x3ebaf2[_0x5f48('0x41')]===0x0){return db[_0x5f48('0x16')]['create']({'name':_0x518efb['name'],'resourceId':_0x518efb['id'],'type':_0x3ebaf2[_0x5f48('0x1d')],'sectionId':_0x3ebaf2['id']},{})[_0x5f48('0x12')](function(){return _0x220e34;});}else{return _0x220e34;}})['catch'](function(_0x19953a){logger[_0x5f48('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19953a);throw _0x19953a;});}return _0x220e34;})[_0x5f48('0x12')](respondWithResult(_0x338354,0xc9))[_0x5f48('0x35')](handleError(_0x338354,null));};exports[_0x5f48('0x42')]=function(_0x13f9fc,_0x5ab9ed){if(_0x13f9fc['body']['id']){delete _0x13f9fc[_0x5f48('0x43')]['id'];}return db[_0x5f48('0x30')][_0x5f48('0x3a')]({'where':{'id':_0x13f9fc[_0x5f48('0x44')]['id']}})[_0x5f48('0x12')](handleEntityNotFound(_0x5ab9ed,null))[_0x5f48('0x12')](saveUpdates(_0x13f9fc[_0x5f48('0x43')],null))[_0x5f48('0x12')](function(_0x416e59){if(!_0x416e59)return;var _0x9e1f82=_0x416e59['get']({'plain':!![]});return _0x9e1f82;})[_0x5f48('0x12')](function(_0x1dc33c){var _0x4a45d2=new Redis(config[_0x5f48('0x5')]);_0x4a45d2[_0x5f48('0x17')](_0x5f48('0x18'),JSON[_0x5f48('0x19')](_[_0x5f48('0x2c')](_0x1dc33c,['id',_0x5f48('0x1d'),_0x5f48('0x45')])));return _0x1dc33c;})[_0x5f48('0x12')](respondWithResult(_0x5ab9ed,null))[_0x5f48('0x35')](handleError(_0x5ab9ed,null));};exports[_0x5f48('0x13')]=function(_0x58af4c,_0x3d9fb0){return db[_0x5f48('0x30')]['find']({'where':{'id':_0x58af4c[_0x5f48('0x44')]['id']}})[_0x5f48('0x12')](handleEntityNotFound(_0x3d9fb0,null))['then'](removeEntity(_0x3d9fb0,null))[_0x5f48('0x35')](handleError(_0x3d9fb0,null));};
\ No newline at end of file