Built motion from commit 351e7f9c.|2.6.31
[motion2.git] / server / api / squareProject / squareProject.controller.js
index 177999b..57af528 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc959=['includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','params','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./squareProject.socket','register','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','get','SquareProjects','UserProfileResource','then','publish','agi','stringify','end','sendStatus','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SquareProject'];(function(_0x3070a1,_0x432ffd){var _0x2ccb05=function(_0x4073f4){while(--_0x4073f4){_0x3070a1['push'](_0x3070a1['shift']());}};_0x2ccb05(++_0x432ffd);}(_0xc959,0xaa));var _0x9c95=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc959[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9c95('0x0'));var Redis=require(_0x9c95('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x9c95('0x2'))(_0x9c95('0x3'));var config=require(_0x9c95('0x4'));var db=require(_0x9c95('0x5'))['db'];config['redis']=_[_0x9c95('0x6')](config[_0x9c95('0x7')],{'host':_0x9c95('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c95('0x7')]));require(_0x9c95('0x9'))[_0x9c95('0xa')](socket);function respondWithResult(_0x4386e5,_0x40e872){_0x40e872=_0x40e872||0xc8;return function(_0x4e2e91){if(_0x4e2e91){return _0x4386e5['status'](_0x40e872)[_0x9c95('0xb')](_0x4e2e91);}};}function respondWithFilteredResult(_0x48bfbe,_0x527c96){return function(_0x4195ec){if(_0x4195ec){var _0x2a0a18=typeof _0x527c96[_0x9c95('0xc')]===_0x9c95('0xd')&&typeof _0x527c96[_0x9c95('0xe')]===_0x9c95('0xd');var _0x435d7f=_0x4195ec[_0x9c95('0xf')];var _0x5b36dc=_0x2a0a18?0x0:_0x527c96['offset'];var _0x554313=_0x2a0a18?_0x4195ec[_0x9c95('0xf')]:_0x527c96[_0x9c95('0xc')]+_0x527c96[_0x9c95('0xe')];var _0x3f0c8b;if(_0x554313>=_0x435d7f){_0x554313=_0x435d7f;_0x3f0c8b=0xc8;}else{_0x3f0c8b=0xce;}_0x48bfbe[_0x9c95('0x10')](_0x3f0c8b);return _0x48bfbe[_0x9c95('0x11')](_0x9c95('0x12'),_0x5b36dc+'-'+_0x554313+'/'+_0x435d7f)[_0x9c95('0xb')](_0x4195ec);}return null;};}function saveUpdates(_0x117297){return function(_0x297d6d){if(_0x297d6d){return _0x297d6d[_0x9c95('0x13')](_0x117297)['then'](function(_0x89a95d){return _0x89a95d;});}return null;};}function removeEntity(_0x545202){return function(_0x58e9ca){if(_0x58e9ca){return _0x58e9ca[_0x9c95('0x14')]()['then'](function(){var _0x4dfe4c=_0x58e9ca[_0x9c95('0x15')]({'plain':!![]});var _0x46e572=_0x9c95('0x16');return db[_0x9c95('0x17')]['destroy']({'where':{'type':_0x46e572,'resourceId':_0x4dfe4c['id']}})['then'](function(){return _0x58e9ca;});})[_0x9c95('0x18')](function(){var _0x4072d7=new Redis(config[_0x9c95('0x7')]);_0x4072d7[_0x9c95('0x19')](_0x9c95('0x1a'),JSON[_0x9c95('0x1b')]({'id':_0x58e9ca['id'],'deleted':!![]}));})[_0x9c95('0x18')](function(){_0x545202[_0x9c95('0x10')](0xcc)[_0x9c95('0x1c')]();});}};}function handleEntityNotFound(_0x53f962){return function(_0x5c4f00){if(!_0x5c4f00){_0x53f962[_0x9c95('0x1d')](0x194);}return _0x5c4f00;};}function handleError(_0xe66bf1,_0x135752){_0x135752=_0x135752||0x1f4;return function(_0xa65e30){logger[_0x9c95('0x1e')](_0xa65e30[_0x9c95('0x1f')]);if(_0xa65e30['name']){delete _0xa65e30[_0x9c95('0x20')];}_0xe66bf1['status'](_0x135752)[_0x9c95('0x21')](_0xa65e30);};}exports[_0x9c95('0x22')]=function(_0x1686e7,_0x22932f){var _0x4236ff={},_0xf5fa37={},_0x1dea75={'count':0x0,'rows':[]};var _0x9aea62=_[_0x9c95('0x23')](db['SquareProject']['rawAttributes'],function(_0x17ac8b){return{'name':_0x17ac8b[_0x9c95('0x24')],'type':_0x17ac8b[_0x9c95('0x25')]['key']};});_0xf5fa37['model']=_[_0x9c95('0x23')](_0x9aea62,_0x9c95('0x20'));_0xf5fa37[_0x9c95('0x26')]=_[_0x9c95('0x27')](_0x1686e7[_0x9c95('0x26')]);_0xf5fa37[_0x9c95('0x28')]=_[_0x9c95('0x29')](_0xf5fa37[_0x9c95('0x2a')],_0xf5fa37[_0x9c95('0x26')]);_0x4236ff[_0x9c95('0x2b')]=_[_0x9c95('0x29')](_0xf5fa37[_0x9c95('0x2a')],qs[_0x9c95('0x2c')](_0x1686e7[_0x9c95('0x26')][_0x9c95('0x2c')]));_0x4236ff[_0x9c95('0x2b')]=_0x4236ff['attributes']['length']?_0x4236ff[_0x9c95('0x2b')]:_0xf5fa37['model'];if(!_0x1686e7[_0x9c95('0x26')][_0x9c95('0x2d')](_0x9c95('0x2e'))){_0x4236ff[_0x9c95('0xe')]=qs[_0x9c95('0xe')](_0x1686e7[_0x9c95('0x26')][_0x9c95('0xe')]);_0x4236ff[_0x9c95('0xc')]=qs[_0x9c95('0xc')](_0x1686e7[_0x9c95('0x26')][_0x9c95('0xc')]);}_0x4236ff[_0x9c95('0x2f')]=qs[_0x9c95('0x30')](_0x1686e7[_0x9c95('0x26')][_0x9c95('0x30')]);_0x4236ff[_0x9c95('0x31')]=qs[_0x9c95('0x28')](_['pick'](_0x1686e7[_0x9c95('0x26')],_0xf5fa37[_0x9c95('0x28')]),_0x9aea62);if(_0x1686e7[_0x9c95('0x26')][_0x9c95('0x32')]){_0x4236ff['where']=_[_0x9c95('0x33')](_0x4236ff[_0x9c95('0x31')],{'$or':_[_0x9c95('0x23')](_0x9aea62,function(_0x3f0efc){if(_0x3f0efc[_0x9c95('0x25')]!==_0x9c95('0x34')){var _0x4f4743={};_0x4f4743[_0x3f0efc['name']]={'$like':'%'+_0x1686e7[_0x9c95('0x26')][_0x9c95('0x32')]+'%'};return _0x4f4743;}})});}_0x4236ff=_[_0x9c95('0x33')]({},_0x4236ff,_0x1686e7[_0x9c95('0x35')]);var _0x59a137={'where':_0x4236ff[_0x9c95('0x31')]};return db[_0x9c95('0x36')]['count'](_0x59a137)[_0x9c95('0x18')](function(_0x12f99a){_0x1dea75[_0x9c95('0xf')]=_0x12f99a;if(_0x1686e7[_0x9c95('0x26')][_0x9c95('0x37')]){_0x4236ff[_0x9c95('0x38')]=[{'all':!![]}];}return db[_0x9c95('0x36')][_0x9c95('0x39')](_0x4236ff);})['then'](function(_0x111372){_0x1dea75[_0x9c95('0x3a')]=_0x111372;return _0x1dea75;})['then'](respondWithFilteredResult(_0x22932f,_0x4236ff))[_0x9c95('0x3b')](handleError(_0x22932f,null));};exports[_0x9c95('0x3c')]=function(_0xf02040,_0x595df5){var _0x8bf7e7={'raw':![],'where':{'id':_0xf02040['params']['id']}},_0x103a0e={};_0x103a0e[_0x9c95('0x2a')]=_[_0x9c95('0x27')](db[_0x9c95('0x36')][_0x9c95('0x3d')]);_0x103a0e[_0x9c95('0x26')]=_[_0x9c95('0x27')](_0xf02040['query']);_0x103a0e[_0x9c95('0x28')]=_['intersection'](_0x103a0e['model'],_0x103a0e[_0x9c95('0x26')]);_0x8bf7e7['attributes']=_[_0x9c95('0x29')](_0x103a0e[_0x9c95('0x2a')],qs[_0x9c95('0x2c')](_0xf02040[_0x9c95('0x26')][_0x9c95('0x2c')]));_0x8bf7e7[_0x9c95('0x2b')]=_0x8bf7e7[_0x9c95('0x2b')][_0x9c95('0x3e')]?_0x8bf7e7[_0x9c95('0x2b')]:_0x103a0e[_0x9c95('0x2a')];if(_0xf02040['query'][_0x9c95('0x37')]){_0x8bf7e7['include']=[{'all':!![]}];}_0x8bf7e7=_[_0x9c95('0x33')]({},_0x8bf7e7,_0xf02040['options']);return db['SquareProject']['find'](_0x8bf7e7)[_0x9c95('0x18')](handleEntityNotFound(_0x595df5,null))[_0x9c95('0x18')](respondWithResult(_0x595df5,null))['catch'](handleError(_0x595df5,null));};exports[_0x9c95('0x3f')]=function(_0x41805d,_0x2bc85e){return db['SquareProject'][_0x9c95('0x3f')](_0x41805d[_0x9c95('0x40')],{})['then'](function(_0x4b12bc){var _0x2ab760=_0x41805d[_0x9c95('0x41')]['get']({'plain':!![]});if(!_0x2ab760)throw new Error(_0x9c95('0x42'));if(_0x2ab760[_0x9c95('0x43')]==='user'){var _0x28f4ae=_0x4b12bc[_0x9c95('0x15')]({'plain':!![]});var _0x3ed515=_0x9c95('0x16');return db[_0x9c95('0x44')][_0x9c95('0x45')]({'where':{'name':_0x3ed515,'userProfileId':_0x2ab760[_0x9c95('0x46')]},'raw':!![]})[_0x9c95('0x18')](function(_0x3d627e){if(_0x3d627e&&_0x3d627e[_0x9c95('0x47')]===0x0){return db[_0x9c95('0x17')][_0x9c95('0x3f')]({'name':_0x28f4ae[_0x9c95('0x20')],'resourceId':_0x28f4ae['id'],'type':_0x3d627e[_0x9c95('0x20')],'sectionId':_0x3d627e['id']},{})[_0x9c95('0x18')](function(){return _0x4b12bc;});}else{return _0x4b12bc;}})[_0x9c95('0x3b')](function(_0x593c1a){logger[_0x9c95('0x1e')](_0x9c95('0x48'),_0x593c1a);throw _0x593c1a;});}return _0x4b12bc;})[_0x9c95('0x18')](respondWithResult(_0x2bc85e,0xc9))[_0x9c95('0x3b')](handleError(_0x2bc85e,null));};exports[_0x9c95('0x13')]=function(_0x10bf57,_0x1247f7){if(_0x10bf57[_0x9c95('0x40')]['id']){delete _0x10bf57['body']['id'];}return db[_0x9c95('0x36')][_0x9c95('0x45')]({'where':{'id':_0x10bf57['params']['id']}})['then'](handleEntityNotFound(_0x1247f7,null))[_0x9c95('0x18')](saveUpdates(_0x10bf57['body'],null))['then'](function(_0x3f83ea){if(!_0x3f83ea)return;var _0x93fcaf=_0x3f83ea[_0x9c95('0x15')]({'plain':!![]});return _0x93fcaf;})['then'](function(_0x209774){var _0x45d97d=new Redis(config[_0x9c95('0x7')]);_0x45d97d[_0x9c95('0x19')](_0x9c95('0x1a'),JSON[_0x9c95('0x1b')](_[_0x9c95('0x49')](_0x209774,['id',_0x9c95('0x20'),'production'])));return _0x209774;})[_0x9c95('0x18')](respondWithResult(_0x1247f7,null))[_0x9c95('0x3b')](handleError(_0x1247f7,null));};exports['destroy']=function(_0x3140c0,_0x13c4af){return db[_0x9c95('0x36')]['find']({'where':{'id':_0x3140c0[_0x9c95('0x4a')]['id']}})[_0x9c95('0x18')](handleEntityNotFound(_0x13c4af,null))[_0x9c95('0x18')](removeEntity(_0x13c4af,null))['catch'](handleError(_0x13c4af,null));};
\ No newline at end of file
+var _0x8f22=['publish','agi','stringify','end','sendStatus','error','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','role','user','find','userProfileId','UserProfileResource','production','destroy','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','update','then','get','SquareProjects'];(function(_0x25612b,_0x5dc946){var _0x433eb3=function(_0x22d7a5){while(--_0x22d7a5){_0x25612b['push'](_0x25612b['shift']());}};_0x433eb3(++_0x5dc946);}(_0x8f22,0x73));var _0x28f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f22[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x28f2('0x0'));var Redis=require(_0x28f2('0x1'));var qs=require(_0x28f2('0x2'));var logger=require(_0x28f2('0x3'))(_0x28f2('0x4'));var config=require('../../config/environment');var db=require(_0x28f2('0x5'))['db'];config[_0x28f2('0x6')]=_[_0x28f2('0x7')](config[_0x28f2('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x28f2('0x8'))(new Redis(config[_0x28f2('0x6')]));require('./squareProject.socket')[_0x28f2('0x9')](socket);function respondWithResult(_0x25063c,_0x33d1a6){_0x33d1a6=_0x33d1a6||0xc8;return function(_0x4fa9f3){if(_0x4fa9f3){return _0x25063c[_0x28f2('0xa')](_0x33d1a6)[_0x28f2('0xb')](_0x4fa9f3);}};}function respondWithFilteredResult(_0x20274e,_0x10d5ec){return function(_0x5f1126){if(_0x5f1126){var _0x4e14c3=typeof _0x10d5ec['offset']===_0x28f2('0xc')&&typeof _0x10d5ec[_0x28f2('0xd')]===_0x28f2('0xc');var _0x3dc78c=_0x5f1126[_0x28f2('0xe')];var _0x311b42=_0x4e14c3?0x0:_0x10d5ec[_0x28f2('0xf')];var _0x1b1918=_0x4e14c3?_0x5f1126['count']:_0x10d5ec[_0x28f2('0xf')]+_0x10d5ec[_0x28f2('0xd')];var _0xa9629e;if(_0x1b1918>=_0x3dc78c){_0x1b1918=_0x3dc78c;_0xa9629e=0xc8;}else{_0xa9629e=0xce;}_0x20274e['status'](_0xa9629e);return _0x20274e[_0x28f2('0x10')]('Content-Range',_0x311b42+'-'+_0x1b1918+'/'+_0x3dc78c)[_0x28f2('0xb')](_0x5f1126);}return null;};}function saveUpdates(_0x51f888){return function(_0x55693a){if(_0x55693a){return _0x55693a[_0x28f2('0x11')](_0x51f888)['then'](function(_0x4616a2){return _0x4616a2;});}return null;};}function removeEntity(_0x575061){return function(_0x42a250){if(_0x42a250){return _0x42a250['destroy']()[_0x28f2('0x12')](function(){var _0x3b90fb=_0x42a250[_0x28f2('0x13')]({'plain':!![]});var _0x2b7b79=_0x28f2('0x14');return db['UserProfileResource']['destroy']({'where':{'type':_0x2b7b79,'resourceId':_0x3b90fb['id']}})[_0x28f2('0x12')](function(){return _0x42a250;});})[_0x28f2('0x12')](function(){var _0x4fb2f7=new Redis(config[_0x28f2('0x6')]);_0x4fb2f7[_0x28f2('0x15')](_0x28f2('0x16'),JSON[_0x28f2('0x17')]({'id':_0x42a250['id'],'deleted':!![]}));})[_0x28f2('0x12')](function(){_0x575061['status'](0xcc)[_0x28f2('0x18')]();});}};}function handleEntityNotFound(_0x537d43){return function(_0x4d64c5){if(!_0x4d64c5){_0x537d43[_0x28f2('0x19')](0x194);}return _0x4d64c5;};}function handleError(_0x37560b,_0x170567){_0x170567=_0x170567||0x1f4;return function(_0x20dc85){logger[_0x28f2('0x1a')](_0x20dc85['stack']);if(_0x20dc85['name']){delete _0x20dc85[_0x28f2('0x1b')];}_0x37560b[_0x28f2('0xa')](_0x170567)[_0x28f2('0x1c')](_0x20dc85);};}exports['index']=function(_0x5a83ac,_0x498577){var _0x1e624f={},_0x5382b4={},_0x1249df={'count':0x0,'rows':[]};var _0x12bd35=_[_0x28f2('0x1d')](db[_0x28f2('0x1e')][_0x28f2('0x1f')],function(_0x14d4d2){return{'name':_0x14d4d2[_0x28f2('0x20')],'type':_0x14d4d2[_0x28f2('0x21')][_0x28f2('0x22')]};});_0x5382b4[_0x28f2('0x23')]=_[_0x28f2('0x1d')](_0x12bd35,'name');_0x5382b4[_0x28f2('0x24')]=_[_0x28f2('0x25')](_0x5a83ac['query']);_0x5382b4[_0x28f2('0x26')]=_[_0x28f2('0x27')](_0x5382b4[_0x28f2('0x23')],_0x5382b4[_0x28f2('0x24')]);_0x1e624f[_0x28f2('0x28')]=_[_0x28f2('0x27')](_0x5382b4[_0x28f2('0x23')],qs[_0x28f2('0x29')](_0x5a83ac[_0x28f2('0x24')][_0x28f2('0x29')]));_0x1e624f['attributes']=_0x1e624f[_0x28f2('0x28')][_0x28f2('0x2a')]?_0x1e624f[_0x28f2('0x28')]:_0x5382b4[_0x28f2('0x23')];if(!_0x5a83ac[_0x28f2('0x24')][_0x28f2('0x2b')](_0x28f2('0x2c'))){_0x1e624f[_0x28f2('0xd')]=qs[_0x28f2('0xd')](_0x5a83ac['query']['limit']);_0x1e624f['offset']=qs[_0x28f2('0xf')](_0x5a83ac[_0x28f2('0x24')]['offset']);}_0x1e624f[_0x28f2('0x2d')]=qs['sort'](_0x5a83ac[_0x28f2('0x24')][_0x28f2('0x2e')]);_0x1e624f[_0x28f2('0x2f')]=qs[_0x28f2('0x26')](_[_0x28f2('0x30')](_0x5a83ac[_0x28f2('0x24')],_0x5382b4[_0x28f2('0x26')]),_0x12bd35);if(_0x5a83ac[_0x28f2('0x24')][_0x28f2('0x31')]){_0x1e624f[_0x28f2('0x2f')]=_[_0x28f2('0x32')](_0x1e624f['where'],{'$or':_[_0x28f2('0x1d')](_0x12bd35,function(_0x54ca99){if(_0x54ca99[_0x28f2('0x21')]!==_0x28f2('0x33')){var _0x143d75={};_0x143d75[_0x54ca99[_0x28f2('0x1b')]]={'$like':'%'+_0x5a83ac[_0x28f2('0x24')][_0x28f2('0x31')]+'%'};return _0x143d75;}})});}_0x1e624f=_[_0x28f2('0x32')]({},_0x1e624f,_0x5a83ac[_0x28f2('0x34')]);var _0x4238a8={'where':_0x1e624f[_0x28f2('0x2f')]};return db['SquareProject'][_0x28f2('0xe')](_0x4238a8)[_0x28f2('0x12')](function(_0x3d3ab8){_0x1249df[_0x28f2('0xe')]=_0x3d3ab8;if(_0x5a83ac[_0x28f2('0x24')][_0x28f2('0x35')]){_0x1e624f[_0x28f2('0x36')]=[{'all':!![]}];}return db[_0x28f2('0x1e')]['findAll'](_0x1e624f);})[_0x28f2('0x12')](function(_0x3a5fd0){_0x1249df[_0x28f2('0x37')]=_0x3a5fd0;return _0x1249df;})[_0x28f2('0x12')](respondWithFilteredResult(_0x498577,_0x1e624f))[_0x28f2('0x38')](handleError(_0x498577,null));};exports[_0x28f2('0x39')]=function(_0x41736a,_0x55287b){var _0x31bd5d={'raw':![],'where':{'id':_0x41736a[_0x28f2('0x3a')]['id']}},_0x24c092={};_0x24c092[_0x28f2('0x23')]=_['keys'](db[_0x28f2('0x1e')][_0x28f2('0x1f')]);_0x24c092[_0x28f2('0x24')]=_[_0x28f2('0x25')](_0x41736a[_0x28f2('0x24')]);_0x24c092[_0x28f2('0x26')]=_[_0x28f2('0x27')](_0x24c092['model'],_0x24c092[_0x28f2('0x24')]);_0x31bd5d[_0x28f2('0x28')]=_[_0x28f2('0x27')](_0x24c092['model'],qs[_0x28f2('0x29')](_0x41736a[_0x28f2('0x24')]['fields']));_0x31bd5d[_0x28f2('0x28')]=_0x31bd5d[_0x28f2('0x28')][_0x28f2('0x2a')]?_0x31bd5d[_0x28f2('0x28')]:_0x24c092[_0x28f2('0x23')];if(_0x41736a[_0x28f2('0x24')][_0x28f2('0x35')]){_0x31bd5d[_0x28f2('0x36')]=[{'all':!![]}];}_0x31bd5d=_[_0x28f2('0x32')]({},_0x31bd5d,_0x41736a[_0x28f2('0x34')]);return db[_0x28f2('0x1e')]['find'](_0x31bd5d)[_0x28f2('0x12')](handleEntityNotFound(_0x55287b,null))[_0x28f2('0x12')](respondWithResult(_0x55287b,null))[_0x28f2('0x38')](handleError(_0x55287b,null));};exports[_0x28f2('0x3b')]=function(_0x1a6dd7,_0x2308f1){return db[_0x28f2('0x1e')][_0x28f2('0x3b')](_0x1a6dd7[_0x28f2('0x3c')],{})[_0x28f2('0x12')](function(_0x1eba53){var _0x2907a7=_0x1a6dd7['user']['get']({'plain':!![]});if(!_0x2907a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2907a7[_0x28f2('0x3d')]===_0x28f2('0x3e')){var _0xf8ad2d=_0x1eba53[_0x28f2('0x13')]({'plain':!![]});var _0x23aa86='SquareProjects';return db['UserProfileSection'][_0x28f2('0x3f')]({'where':{'name':_0x23aa86,'userProfileId':_0x2907a7[_0x28f2('0x40')]},'raw':!![]})[_0x28f2('0x12')](function(_0x547a7c){if(_0x547a7c&&_0x547a7c['autoAssociation']===0x0){return db[_0x28f2('0x41')]['create']({'name':_0xf8ad2d[_0x28f2('0x1b')],'resourceId':_0xf8ad2d['id'],'type':_0x547a7c[_0x28f2('0x1b')],'sectionId':_0x547a7c['id']},{})[_0x28f2('0x12')](function(){return _0x1eba53;});}else{return _0x1eba53;}})[_0x28f2('0x38')](function(_0x52c302){logger[_0x28f2('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52c302);throw _0x52c302;});}return _0x1eba53;})[_0x28f2('0x12')](respondWithResult(_0x2308f1,0xc9))['catch'](handleError(_0x2308f1,null));};exports[_0x28f2('0x11')]=function(_0xc3e78d,_0x666798){if(_0xc3e78d[_0x28f2('0x3c')]['id']){delete _0xc3e78d[_0x28f2('0x3c')]['id'];}return db[_0x28f2('0x1e')]['find']({'where':{'id':_0xc3e78d[_0x28f2('0x3a')]['id']}})[_0x28f2('0x12')](handleEntityNotFound(_0x666798,null))['then'](saveUpdates(_0xc3e78d[_0x28f2('0x3c')],null))[_0x28f2('0x12')](function(_0x49266a){if(!_0x49266a)return;var _0x33bdc8=_0x49266a['get']({'plain':!![]});return _0x33bdc8;})[_0x28f2('0x12')](function(_0x54ac61){var _0x5bdc03=new Redis(config[_0x28f2('0x6')]);_0x5bdc03[_0x28f2('0x15')](_0x28f2('0x16'),JSON['stringify'](_[_0x28f2('0x30')](_0x54ac61,['id',_0x28f2('0x1b'),_0x28f2('0x42')])));return _0x54ac61;})[_0x28f2('0x12')](respondWithResult(_0x666798,null))[_0x28f2('0x38')](handleError(_0x666798,null));};exports[_0x28f2('0x43')]=function(_0x572b89,_0x3ca150){return db[_0x28f2('0x1e')][_0x28f2('0x3f')]({'where':{'id':_0x572b89[_0x28f2('0x3a')]['id']}})[_0x28f2('0x12')](handleEntityNotFound(_0x3ca150,null))[_0x28f2('0x12')](removeEntity(_0x3ca150,null))[_0x28f2('0x38')](handleError(_0x3ca150,null));};
\ No newline at end of file