Built motion from commit (unavailable).|2.5.25
[motion2.git] / server / api / variable / variable.controller.js
index 070e721..5161d86 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x659d=['type','VIRTUAL','filter','options','findAll','rows','catch','params','includeAll','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Variables','UserProfileResource','end','error','stack','name','send','map','Variable','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge'];(function(_0x1eb1f7,_0x1e5538){var _0x404144=function(_0x5422a6){while(--_0x5422a6){_0x1eb1f7['push'](_0x1eb1f7['shift']());}};_0x404144(++_0x1e5538);}(_0x659d,0x64));var _0xd659=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x659d[_0x4c440b];return _0x2d48cf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd659('0x0'));var rimraf=require(_0xd659('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd659('0x2'));var rp=require('request-promise');var moment=require(_0xd659('0x3'));var BPromise=require(_0xd659('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd659('0x5'));var sox=require(_0xd659('0x6'));var csv=require(_0xd659('0x7'));var ejs=require(_0xd659('0x8'));var fs=require('fs');var _=require(_0xd659('0x9'));var squel=require(_0xd659('0xa'));var crypto=require(_0xd659('0xb'));var jsforce=require(_0xd659('0xc'));var deskjs=require(_0xd659('0xd'));var toCsv=require(_0xd659('0x7'));var querystring=require(_0xd659('0xe'));var Papa=require('papaparse');var Redis=require(_0xd659('0xf'));var authService=require(_0xd659('0x10'));var qs=require(_0xd659('0x11'));var as=require(_0xd659('0x12'));var hardwareService=require(_0xd659('0x13'));var logger=require('../../config/logger')(_0xd659('0x14'));var utils=require(_0xd659('0x15'));var config=require(_0xd659('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c8746,_0x5c9f63){_0x5c9f63=_0x5c9f63||0xcc;return function(_0xa0f29c){if(_0xa0f29c){return _0x3c8746[_0xd659('0x17')](_0x5c9f63);}return _0x3c8746[_0xd659('0x18')](_0x5c9f63)['end']();};}function respondWithResult(_0x14e1b9,_0x3b572d){_0x3b572d=_0x3b572d||0xc8;return function(_0x1a82e6){if(_0x1a82e6){return _0x14e1b9[_0xd659('0x18')](_0x3b572d)[_0xd659('0x19')](_0x1a82e6);}};}function respondWithFilteredResult(_0x395ea9,_0x3dc67b){return function(_0x21950b){if(_0x21950b){var _0x42ba51=_0x21950b[_0xd659('0x1a')],_0x563e90=_0x3dc67b['offset'],_0x54dfc6=_0x3dc67b[_0xd659('0x1b')]+_0x3dc67b[_0xd659('0x1c')],_0x1a7fd4;if(_0x54dfc6>=_0x42ba51){_0x54dfc6=_0x42ba51;_0x1a7fd4=0xc8;}else{_0x1a7fd4=0xce;}_0x395ea9[_0xd659('0x18')](_0x1a7fd4);return _0x395ea9[_0xd659('0x1d')](_0xd659('0x1e'),_0x563e90+'-'+_0x54dfc6+'/'+_0x42ba51)['json'](_0x21950b);}return null;};}function patchUpdates(_0x26a691){return function(_0x6f21c1){try{jsonpatch[_0xd659('0x1f')](_0x6f21c1,_0x26a691,!![]);}catch(_0x13f4db){return BPromise[_0xd659('0x20')](_0x13f4db);}return _0x6f21c1[_0xd659('0x21')]();};}function saveUpdates(_0x39c8d1,_0x236a9c){return function(_0x58d3c4){if(_0x58d3c4){return _0x58d3c4[_0xd659('0x22')](_0x39c8d1)[_0xd659('0x23')](function(_0x2baa56){return _0x2baa56;});}return null;};}function removeEntity(_0x3f03ff,_0x293d2c){return function(_0x424bab){if(_0x424bab){return _0x424bab[_0xd659('0x24')]()[_0xd659('0x23')](function(){var _0xe67931=_0x424bab['get']({'plain':!![]});var _0x326796=_0xd659('0x25');return db[_0xd659('0x26')][_0xd659('0x24')]({'where':{'type':_0x326796,'resourceId':_0xe67931['id']}})['then'](function(){return _0x424bab;});})['then'](function(){_0x3f03ff['status'](0xcc)[_0xd659('0x27')]();});}};}function handleEntityNotFound(_0x5f4c0d,_0x3e6c4b){return function(_0x1d09e5){if(!_0x1d09e5){_0x5f4c0d[_0xd659('0x17')](0x194);}return _0x1d09e5;};}function handleError(_0x275b78,_0x87f9c0){_0x87f9c0=_0x87f9c0||0x1f4;return function(_0x289c20){logger[_0xd659('0x28')](_0x289c20[_0xd659('0x29')]);if(_0x289c20[_0xd659('0x2a')]){delete _0x289c20[_0xd659('0x2a')];}_0x275b78[_0xd659('0x18')](_0x87f9c0)[_0xd659('0x2b')](_0x289c20);};}exports['index']=function(_0x3891d0,_0x54e27c){var _0x18fa25={},_0x3d1534={},_0x38eaab={'count':0x0,'rows':[]};var _0x466dd4=_[_0xd659('0x2c')](db[_0xd659('0x2d')][_0xd659('0x2e')],function(_0x16eaf2){return{'name':_0x16eaf2['fieldName'],'type':_0x16eaf2['type']['key']};});_0x3d1534['model']=_[_0xd659('0x2c')](_0x466dd4,_0xd659('0x2a'));_0x3d1534['query']=_[_0xd659('0x2f')](_0x3891d0[_0xd659('0x30')]);_0x3d1534[_0xd659('0x31')]=_[_0xd659('0x32')](_0x3d1534[_0xd659('0x33')],_0x3d1534[_0xd659('0x30')]);_0x18fa25[_0xd659('0x34')]=_[_0xd659('0x32')](_0x3d1534[_0xd659('0x33')],qs[_0xd659('0x35')](_0x3891d0[_0xd659('0x30')][_0xd659('0x35')]));_0x18fa25['attributes']=_0x18fa25[_0xd659('0x34')][_0xd659('0x36')]?_0x18fa25[_0xd659('0x34')]:_0x3d1534[_0xd659('0x33')];if(!_0x3891d0[_0xd659('0x30')][_0xd659('0x37')]('nolimit')){_0x18fa25[_0xd659('0x1c')]=qs[_0xd659('0x1c')](_0x3891d0[_0xd659('0x30')][_0xd659('0x1c')]);_0x18fa25['offset']=qs[_0xd659('0x1b')](_0x3891d0[_0xd659('0x30')][_0xd659('0x1b')]);}_0x18fa25['order']=qs['sort'](_0x3891d0[_0xd659('0x30')][_0xd659('0x38')]);_0x18fa25[_0xd659('0x39')]=qs[_0xd659('0x31')](_[_0xd659('0x3a')](_0x3891d0['query'],_0x3d1534[_0xd659('0x31')]));if(_0x3891d0[_0xd659('0x30')]['filter']){_0x18fa25['where']=_[_0xd659('0x3b')](_0x18fa25[_0xd659('0x39')],{'$or':_[_0xd659('0x2c')](_0x466dd4,function(_0x1c42b7){if(_0x1c42b7[_0xd659('0x3c')]!==_0xd659('0x3d')){var _0x3cdd0e={};_0x3cdd0e[_0x1c42b7[_0xd659('0x2a')]]={'$like':'%'+_0x3891d0[_0xd659('0x30')][_0xd659('0x3e')]+'%'};return _0x3cdd0e;}})});}_0x18fa25=_[_0xd659('0x3b')]({},_0x18fa25,_0x3891d0[_0xd659('0x3f')]);var _0x34933f={'where':_0x18fa25[_0xd659('0x39')]};return db[_0xd659('0x2d')][_0xd659('0x1a')](_0x34933f)[_0xd659('0x23')](function(_0x51b7b5){_0x38eaab[_0xd659('0x1a')]=_0x51b7b5;if(_0x3891d0[_0xd659('0x30')]['includeAll']){_0x18fa25['include']=[{'all':!![]}];}return db[_0xd659('0x2d')][_0xd659('0x40')](_0x18fa25);})['then'](function(_0x38c590){_0x38eaab[_0xd659('0x41')]=_0x38c590;return _0x38eaab;})[_0xd659('0x23')](respondWithFilteredResult(_0x54e27c,_0x18fa25))[_0xd659('0x42')](handleError(_0x54e27c,null));};exports['show']=function(_0x59422f,_0x56844a){var _0x23b7d2={'raw':!![],'where':{'id':_0x59422f[_0xd659('0x43')]['id']}},_0x110701={};_0x110701[_0xd659('0x33')]=_[_0xd659('0x2f')](db['Variable'][_0xd659('0x2e')]);_0x110701[_0xd659('0x30')]=_[_0xd659('0x2f')](_0x59422f[_0xd659('0x30')]);_0x110701[_0xd659('0x31')]=_[_0xd659('0x32')](_0x110701['model'],_0x110701[_0xd659('0x30')]);_0x23b7d2[_0xd659('0x34')]=_[_0xd659('0x32')](_0x110701[_0xd659('0x33')],qs[_0xd659('0x35')](_0x59422f[_0xd659('0x30')][_0xd659('0x35')]));_0x23b7d2[_0xd659('0x34')]=_0x23b7d2[_0xd659('0x34')][_0xd659('0x36')]?_0x23b7d2[_0xd659('0x34')]:_0x110701['model'];if(_0x59422f[_0xd659('0x30')][_0xd659('0x44')]){_0x23b7d2[_0xd659('0x45')]=[{'all':!![]}];}_0x23b7d2=_[_0xd659('0x3b')]({},_0x23b7d2,_0x59422f[_0xd659('0x3f')]);return db['Variable'][_0xd659('0x46')](_0x23b7d2)[_0xd659('0x23')](handleEntityNotFound(_0x56844a,null))[_0xd659('0x23')](respondWithResult(_0x56844a,null))[_0xd659('0x42')](handleError(_0x56844a,null));};exports[_0xd659('0x47')]=function(_0x59ac03,_0x5566b8){return db[_0xd659('0x2d')]['create'](_0x59ac03['body'],{})[_0xd659('0x23')](function(_0x117cc1){var _0x411084=_0x59ac03[_0xd659('0x48')][_0xd659('0x49')]({'plain':!![]});if(!_0x411084)throw new Error(_0xd659('0x4a'));if(_0x411084['role']===_0xd659('0x48')){var _0x43c1dd=_0x117cc1[_0xd659('0x49')]({'plain':!![]});var _0x23b4db='Variables';return db[_0xd659('0x4b')]['find']({'where':{'name':_0x23b4db,'userProfileId':_0x411084[_0xd659('0x4c')]},'raw':!![]})['then'](function(_0x5f0db5){if(_0x5f0db5&&_0x5f0db5[_0xd659('0x4d')]===0x0){return db[_0xd659('0x26')]['create']({'name':_0x43c1dd[_0xd659('0x2a')],'resourceId':_0x43c1dd['id'],'type':_0x5f0db5[_0xd659('0x2a')],'sectionId':_0x5f0db5['id']},{})[_0xd659('0x23')](function(){return _0x117cc1;});}else{return _0x117cc1;}})[_0xd659('0x42')](function(_0x22b6f3){logger[_0xd659('0x28')](_0xd659('0x4e'),_0x22b6f3);throw _0x22b6f3;});}return _0x117cc1;})['then'](respondWithResult(_0x5566b8,0xc9))[_0xd659('0x42')](handleError(_0x5566b8,null));};exports[_0xd659('0x22')]=function(_0xe00eba,_0xb3c996){if(_0xe00eba[_0xd659('0x4f')]['id']){delete _0xe00eba[_0xd659('0x4f')]['id'];}return db[_0xd659('0x2d')][_0xd659('0x46')]({'where':{'id':_0xe00eba[_0xd659('0x43')]['id']}})[_0xd659('0x23')](handleEntityNotFound(_0xb3c996,null))[_0xd659('0x23')](saveUpdates(_0xe00eba[_0xd659('0x4f')],null))[_0xd659('0x23')](respondWithResult(_0xb3c996,null))['catch'](handleError(_0xb3c996,null));};exports['destroy']=function(_0x222a87,_0xa7df7e){return db[_0xd659('0x2d')][_0xd659('0x46')]({'where':{'id':_0x222a87[_0xd659('0x43')]['id']}})[_0xd659('0x23')](handleEntityNotFound(_0xa7df7e,null))[_0xd659('0x23')](removeEntity(_0xa7df7e,null))[_0xd659('0x42')](handleError(_0xa7df7e,null));};
\ No newline at end of file
+var _0x1e91=['request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','stack','name','map','Variable','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','params','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x36deac,_0x16b2ae){var _0xb35ed3=function(_0x48e76b){while(--_0x48e76b){_0x36deac['push'](_0x36deac['shift']());}};_0xb35ed3(++_0x16b2ae);}(_0x1e91,0x1a0));var _0x11e9=function(_0x2b7810,_0xb69116){_0x2b7810=_0x2b7810-0x0;var _0x86d8ee=_0x1e91[_0x2b7810];return _0x86d8ee;};'use strict';var pdf=require(_0x11e9('0x0'));var emlformat=require(_0x11e9('0x1'));var rimraf=require(_0x11e9('0x2'));var zipdir=require(_0x11e9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11e9('0x4'));var moment=require(_0x11e9('0x5'));var BPromise=require(_0x11e9('0x6'));var Mustache=require(_0x11e9('0x7'));var util=require(_0x11e9('0x8'));var path=require(_0x11e9('0x9'));var sox=require(_0x11e9('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x11e9('0xb'));var squel=require(_0x11e9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11e9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x11e9('0xe'));var Papa=require('papaparse');var Redis=require(_0x11e9('0xf'));var authService=require(_0x11e9('0x10'));var qs=require(_0x11e9('0x11'));var as=require(_0x11e9('0x12'));var hardwareService=require(_0x11e9('0x13'));var logger=require(_0x11e9('0x14'))(_0x11e9('0x15'));var utils=require(_0x11e9('0x16'));var config=require(_0x11e9('0x17'));var licenseUtil=require(_0x11e9('0x18'));var db=require(_0x11e9('0x19'))['db'];function respondWithStatusCode(_0x2e719f,_0x787678){_0x787678=_0x787678||0xcc;return function(_0x3843c3){if(_0x3843c3){return _0x2e719f[_0x11e9('0x1a')](_0x787678);}return _0x2e719f[_0x11e9('0x1b')](_0x787678)[_0x11e9('0x1c')]();};}function respondWithResult(_0x30eff2,_0x429187){_0x429187=_0x429187||0xc8;return function(_0x149b63){if(_0x149b63){return _0x30eff2[_0x11e9('0x1b')](_0x429187)[_0x11e9('0x1d')](_0x149b63);}};}function respondWithFilteredResult(_0x5488f4,_0xd403b9){return function(_0x1b9440){if(_0x1b9440){var _0x547d65=_0x1b9440[_0x11e9('0x1e')],_0x43cd8e=_0xd403b9[_0x11e9('0x1f')],_0x526653=_0xd403b9['offset']+_0xd403b9[_0x11e9('0x20')],_0x564d42;if(_0x526653>=_0x547d65){_0x526653=_0x547d65;_0x564d42=0xc8;}else{_0x564d42=0xce;}_0x5488f4['status'](_0x564d42);return _0x5488f4[_0x11e9('0x21')](_0x11e9('0x22'),_0x43cd8e+'-'+_0x526653+'/'+_0x547d65)['json'](_0x1b9440);}return null;};}function patchUpdates(_0x327562){return function(_0x23e14a){try{jsonpatch[_0x11e9('0x23')](_0x23e14a,_0x327562,!![]);}catch(_0x33cbe4){return BPromise[_0x11e9('0x24')](_0x33cbe4);}return _0x23e14a[_0x11e9('0x25')]();};}function saveUpdates(_0x508570,_0x23d665){return function(_0xaf72c6){if(_0xaf72c6){return _0xaf72c6[_0x11e9('0x26')](_0x508570)[_0x11e9('0x27')](function(_0x2f2b76){return _0x2f2b76;});}return null;};}function removeEntity(_0x23d98b,_0x316831){return function(_0x4e1c89){if(_0x4e1c89){return _0x4e1c89[_0x11e9('0x28')]()[_0x11e9('0x27')](function(){var _0x2a22c3=_0x4e1c89[_0x11e9('0x29')]({'plain':!![]});var _0xea526f=_0x11e9('0x2a');return db[_0x11e9('0x2b')][_0x11e9('0x28')]({'where':{'type':_0xea526f,'resourceId':_0x2a22c3['id']}})[_0x11e9('0x27')](function(){return _0x4e1c89;});})[_0x11e9('0x27')](function(){_0x23d98b['status'](0xcc)[_0x11e9('0x1c')]();});}};}function handleEntityNotFound(_0x3939ce,_0x29c750){return function(_0x51590d){if(!_0x51590d){_0x3939ce['sendStatus'](0x194);}return _0x51590d;};}function handleError(_0x1d3835,_0x2cbd7f){_0x2cbd7f=_0x2cbd7f||0x1f4;return function(_0x4e4dc7){logger['error'](_0x4e4dc7[_0x11e9('0x2c')]);if(_0x4e4dc7[_0x11e9('0x2d')]){delete _0x4e4dc7[_0x11e9('0x2d')];}_0x1d3835[_0x11e9('0x1b')](_0x2cbd7f)['send'](_0x4e4dc7);};}exports['index']=function(_0x2d95e7,_0xf77336){var _0x4378c0={},_0x1bf924={},_0x4c9cd0={'count':0x0,'rows':[]};var _0x1f3620=_[_0x11e9('0x2e')](db[_0x11e9('0x2f')][_0x11e9('0x30')],function(_0x25a89c){return{'name':_0x25a89c[_0x11e9('0x31')],'type':_0x25a89c[_0x11e9('0x32')][_0x11e9('0x33')]};});_0x1bf924['model']=_[_0x11e9('0x2e')](_0x1f3620,'name');_0x1bf924[_0x11e9('0x34')]=_[_0x11e9('0x35')](_0x2d95e7[_0x11e9('0x34')]);_0x1bf924[_0x11e9('0x36')]=_[_0x11e9('0x37')](_0x1bf924[_0x11e9('0x38')],_0x1bf924['query']);_0x4378c0['attributes']=_['intersection'](_0x1bf924[_0x11e9('0x38')],qs[_0x11e9('0x39')](_0x2d95e7['query'][_0x11e9('0x39')]));_0x4378c0[_0x11e9('0x3a')]=_0x4378c0['attributes'][_0x11e9('0x3b')]?_0x4378c0['attributes']:_0x1bf924['model'];if(!_0x2d95e7[_0x11e9('0x34')]['hasOwnProperty'](_0x11e9('0x3c'))){_0x4378c0[_0x11e9('0x20')]=qs['limit'](_0x2d95e7['query']['limit']);_0x4378c0[_0x11e9('0x1f')]=qs[_0x11e9('0x1f')](_0x2d95e7[_0x11e9('0x34')][_0x11e9('0x1f')]);}_0x4378c0[_0x11e9('0x3d')]=qs[_0x11e9('0x3e')](_0x2d95e7[_0x11e9('0x34')][_0x11e9('0x3e')]);_0x4378c0[_0x11e9('0x3f')]=qs[_0x11e9('0x36')](_[_0x11e9('0x40')](_0x2d95e7[_0x11e9('0x34')],_0x1bf924['filters']),_0x1f3620);if(_0x2d95e7[_0x11e9('0x34')][_0x11e9('0x41')]){_0x4378c0[_0x11e9('0x3f')]=_[_0x11e9('0x42')](_0x4378c0['where'],{'$or':_[_0x11e9('0x2e')](_0x1f3620,function(_0xbfbd44){if(_0xbfbd44[_0x11e9('0x32')]!==_0x11e9('0x43')){var _0xf06512={};_0xf06512[_0xbfbd44['name']]={'$like':'%'+_0x2d95e7['query'][_0x11e9('0x41')]+'%'};return _0xf06512;}})});}_0x4378c0=_['merge']({},_0x4378c0,_0x2d95e7['options']);var _0x3299e0={'where':_0x4378c0[_0x11e9('0x3f')]};return db[_0x11e9('0x2f')]['count'](_0x3299e0)[_0x11e9('0x27')](function(_0x2c0da6){_0x4c9cd0[_0x11e9('0x1e')]=_0x2c0da6;if(_0x2d95e7[_0x11e9('0x34')][_0x11e9('0x44')]){_0x4378c0[_0x11e9('0x45')]=[{'all':!![]}];}return db[_0x11e9('0x2f')][_0x11e9('0x46')](_0x4378c0);})[_0x11e9('0x27')](function(_0x141fd9){_0x4c9cd0['rows']=_0x141fd9;return _0x4c9cd0;})['then'](respondWithFilteredResult(_0xf77336,_0x4378c0))[_0x11e9('0x47')](handleError(_0xf77336,null));};exports[_0x11e9('0x48')]=function(_0x4d81a2,_0x4defec){var _0xbe55e={'raw':!![],'where':{'id':_0x4d81a2['params']['id']}},_0x2c8849={};_0x2c8849['model']=_['keys'](db[_0x11e9('0x2f')][_0x11e9('0x30')]);_0x2c8849[_0x11e9('0x34')]=_[_0x11e9('0x35')](_0x4d81a2[_0x11e9('0x34')]);_0x2c8849[_0x11e9('0x36')]=_['intersection'](_0x2c8849[_0x11e9('0x38')],_0x2c8849['query']);_0xbe55e[_0x11e9('0x3a')]=_['intersection'](_0x2c8849[_0x11e9('0x38')],qs[_0x11e9('0x39')](_0x4d81a2[_0x11e9('0x34')][_0x11e9('0x39')]));_0xbe55e[_0x11e9('0x3a')]=_0xbe55e['attributes'][_0x11e9('0x3b')]?_0xbe55e['attributes']:_0x2c8849[_0x11e9('0x38')];if(_0x4d81a2['query'][_0x11e9('0x44')]){_0xbe55e[_0x11e9('0x45')]=[{'all':!![]}];}_0xbe55e=_['merge']({},_0xbe55e,_0x4d81a2[_0x11e9('0x49')]);return db[_0x11e9('0x2f')][_0x11e9('0x4a')](_0xbe55e)['then'](handleEntityNotFound(_0x4defec,null))['then'](respondWithResult(_0x4defec,null))[_0x11e9('0x47')](handleError(_0x4defec,null));};exports[_0x11e9('0x4b')]=function(_0x408e5d,_0x547c39){return db[_0x11e9('0x2f')][_0x11e9('0x4b')](_0x408e5d[_0x11e9('0x4c')],{})[_0x11e9('0x27')](function(_0x587923){var _0x2b31a6=_0x408e5d['user']['get']({'plain':!![]});if(!_0x2b31a6)throw new Error(_0x11e9('0x4d'));if(_0x2b31a6[_0x11e9('0x4e')]===_0x11e9('0x4f')){var _0x3899bf=_0x587923[_0x11e9('0x29')]({'plain':!![]});var _0x28831d='Variables';return db[_0x11e9('0x50')][_0x11e9('0x4a')]({'where':{'name':_0x28831d,'userProfileId':_0x2b31a6['userProfileId']},'raw':!![]})['then'](function(_0x2a5fa4){if(_0x2a5fa4&&_0x2a5fa4[_0x11e9('0x51')]===0x0){return db[_0x11e9('0x2b')]['create']({'name':_0x3899bf[_0x11e9('0x2d')],'resourceId':_0x3899bf['id'],'type':_0x2a5fa4[_0x11e9('0x2d')],'sectionId':_0x2a5fa4['id']},{})[_0x11e9('0x27')](function(){return _0x587923;});}else{return _0x587923;}})['catch'](function(_0x485393){logger[_0x11e9('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x485393);throw _0x485393;});}return _0x587923;})[_0x11e9('0x27')](respondWithResult(_0x547c39,0xc9))[_0x11e9('0x47')](handleError(_0x547c39,null));};exports[_0x11e9('0x26')]=function(_0x1f1474,_0x3f1f29){if(_0x1f1474['body']['id']){delete _0x1f1474[_0x11e9('0x4c')]['id'];}return db[_0x11e9('0x2f')][_0x11e9('0x4a')]({'where':{'id':_0x1f1474['params']['id']}})['then'](handleEntityNotFound(_0x3f1f29,null))[_0x11e9('0x27')](saveUpdates(_0x1f1474[_0x11e9('0x4c')],null))['then'](respondWithResult(_0x3f1f29,null))['catch'](handleError(_0x3f1f29,null));};exports[_0x11e9('0x28')]=function(_0x37d520,_0x596ba8){return db[_0x11e9('0x2f')][_0x11e9('0x4a')]({'where':{'id':_0x37d520[_0x11e9('0x53')]['id']}})['then'](handleEntityNotFound(_0x596ba8,null))[_0x11e9('0x27')](removeEntity(_0x596ba8,null))['catch'](handleError(_0x596ba8,null));};
\ No newline at end of file