Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / variable / variable.controller.js
index 664d5d0..4c551db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x661f=['status','end','json','count','offset','limit','set','Content-Range','reject','save','then','Variables','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','Variable','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xb1b166,_0x27a312){var _0x5ee259=function(_0x1117ac){while(--_0x1117ac){_0xb1b166['push'](_0xb1b166['shift']());}};_0x5ee259(++_0x27a312);}(_0x661f,0x8c));var _0xf661=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x661f[_0x2261ce];return _0x524640;};'use strict';var pdf=require(_0xf661('0x0'));var emlformat=require(_0xf661('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf661('0x2'));var moment=require(_0xf661('0x3'));var BPromise=require(_0xf661('0x4'));var Mustache=require(_0xf661('0x5'));var util=require(_0xf661('0x6'));var path=require(_0xf661('0x7'));var sox=require(_0xf661('0x8'));var csv=require(_0xf661('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf661('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf661('0xb'));var toCsv=require(_0xf661('0x9'));var querystring=require(_0xf661('0xc'));var Papa=require(_0xf661('0xd'));var Redis=require(_0xf661('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf661('0xf'));var as=require(_0xf661('0x10'));var hardwareService=require(_0xf661('0x11'));var logger=require('../../config/logger')(_0xf661('0x12'));var utils=require(_0xf661('0x13'));var config=require(_0xf661('0x14'));var db=require(_0xf661('0x15'))['db'];function respondWithStatusCode(_0x3af476,_0x2a1e13){_0x2a1e13=_0x2a1e13||0xcc;return function(_0x5d2f30){if(_0x5d2f30){return _0x3af476['sendStatus'](_0x2a1e13);}return _0x3af476[_0xf661('0x16')](_0x2a1e13)[_0xf661('0x17')]();};}function respondWithResult(_0x13c937,_0x4b03ef){_0x4b03ef=_0x4b03ef||0xc8;return function(_0x5e2a4c){if(_0x5e2a4c){return _0x13c937[_0xf661('0x16')](_0x4b03ef)[_0xf661('0x18')](_0x5e2a4c);}};}function respondWithFilteredResult(_0x157e82,_0x44d64b){return function(_0x4a4610){if(_0x4a4610){var _0x530ae3=_0x4a4610[_0xf661('0x19')],_0x34f699=_0x44d64b[_0xf661('0x1a')],_0x51e5b4=_0x44d64b[_0xf661('0x1a')]+_0x44d64b[_0xf661('0x1b')],_0x43a92a;if(_0x51e5b4>=_0x530ae3){_0x51e5b4=_0x530ae3;_0x43a92a=0xc8;}else{_0x43a92a=0xce;}_0x157e82[_0xf661('0x16')](_0x43a92a);return _0x157e82[_0xf661('0x1c')](_0xf661('0x1d'),_0x34f699+'-'+_0x51e5b4+'/'+_0x530ae3)['json'](_0x4a4610);}return null;};}function patchUpdates(_0x4a7cdb){return function(_0x4194a7){try{jsonpatch['apply'](_0x4194a7,_0x4a7cdb,!![]);}catch(_0x11c5ef){return BPromise[_0xf661('0x1e')](_0x11c5ef);}return _0x4194a7[_0xf661('0x1f')]();};}function saveUpdates(_0x1d40db,_0x23528a){return function(_0x5ab193){if(_0x5ab193){return _0x5ab193['update'](_0x1d40db)[_0xf661('0x20')](function(_0x979729){return _0x979729;});}return null;};}function removeEntity(_0x17948,_0xf142ba){return function(_0x1d4193){if(_0x1d4193){return _0x1d4193['destroy']()[_0xf661('0x20')](function(){var _0x51319a=_0x1d4193['get']({'plain':!![]});var _0x49e0b0=_0xf661('0x21');return db[_0xf661('0x22')][_0xf661('0x23')]({'where':{'type':_0x49e0b0,'resourceId':_0x51319a['id']}})['then'](function(){return _0x1d4193;});})['then'](function(){_0x17948['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa78c54,_0x2aefda){return function(_0x47d32a){if(!_0x47d32a){_0xa78c54[_0xf661('0x24')](0x194);}return _0x47d32a;};}function handleError(_0x269290,_0x880d51){_0x880d51=_0x880d51||0x1f4;return function(_0x2e9cc5){logger[_0xf661('0x25')](_0x2e9cc5[_0xf661('0x26')]);if(_0x2e9cc5['name']){delete _0x2e9cc5['name'];}_0x269290['status'](_0x880d51)[_0xf661('0x27')](_0x2e9cc5);};}exports[_0xf661('0x28')]=function(_0x59f68f,_0x243c3c){var _0x125c9c={},_0x52e868={},_0x146bb8={'count':0x0,'rows':[]};var _0x1bc1b4=_[_0xf661('0x29')](db['Variable'][_0xf661('0x2a')],function(_0x5a07d2){return{'name':_0x5a07d2[_0xf661('0x2b')],'type':_0x5a07d2[_0xf661('0x2c')][_0xf661('0x2d')]};});_0x52e868[_0xf661('0x2e')]=_[_0xf661('0x29')](_0x1bc1b4,'name');_0x52e868[_0xf661('0x2f')]=_[_0xf661('0x30')](_0x59f68f[_0xf661('0x2f')]);_0x52e868[_0xf661('0x31')]=_[_0xf661('0x32')](_0x52e868['model'],_0x52e868['query']);_0x125c9c['attributes']=_[_0xf661('0x32')](_0x52e868[_0xf661('0x2e')],qs[_0xf661('0x33')](_0x59f68f['query']['fields']));_0x125c9c[_0xf661('0x34')]=_0x125c9c[_0xf661('0x34')][_0xf661('0x35')]?_0x125c9c[_0xf661('0x34')]:_0x52e868['model'];if(!_0x59f68f[_0xf661('0x2f')][_0xf661('0x36')](_0xf661('0x37'))){_0x125c9c[_0xf661('0x1b')]=qs[_0xf661('0x1b')](_0x59f68f[_0xf661('0x2f')]['limit']);_0x125c9c['offset']=qs[_0xf661('0x1a')](_0x59f68f[_0xf661('0x2f')][_0xf661('0x1a')]);}_0x125c9c['order']=qs['sort'](_0x59f68f[_0xf661('0x2f')][_0xf661('0x38')]);_0x125c9c[_0xf661('0x39')]=qs[_0xf661('0x31')](_[_0xf661('0x3a')](_0x59f68f[_0xf661('0x2f')],_0x52e868[_0xf661('0x31')]),_0x1bc1b4);if(_0x59f68f[_0xf661('0x2f')][_0xf661('0x3b')]){_0x125c9c[_0xf661('0x39')]=_[_0xf661('0x3c')](_0x125c9c[_0xf661('0x39')],{'$or':_['map'](_0x1bc1b4,function(_0x409723){if(_0x409723['type']!==_0xf661('0x3d')){var _0x50d8d8={};_0x50d8d8[_0x409723[_0xf661('0x3e')]]={'$like':'%'+_0x59f68f[_0xf661('0x2f')]['filter']+'%'};return _0x50d8d8;}})});}_0x125c9c=_[_0xf661('0x3c')]({},_0x125c9c,_0x59f68f[_0xf661('0x3f')]);var _0x33c2d4={'where':_0x125c9c[_0xf661('0x39')]};return db[_0xf661('0x40')][_0xf661('0x19')](_0x33c2d4)[_0xf661('0x20')](function(_0x176171){_0x146bb8[_0xf661('0x19')]=_0x176171;if(_0x59f68f[_0xf661('0x2f')][_0xf661('0x41')]){_0x125c9c[_0xf661('0x42')]=[{'all':!![]}];}return db[_0xf661('0x40')]['findAll'](_0x125c9c);})[_0xf661('0x20')](function(_0x1a17ae){_0x146bb8[_0xf661('0x43')]=_0x1a17ae;return _0x146bb8;})[_0xf661('0x20')](respondWithFilteredResult(_0x243c3c,_0x125c9c))[_0xf661('0x44')](handleError(_0x243c3c,null));};exports[_0xf661('0x45')]=function(_0x1013be,_0xba9d90){var _0x40f8b8={'raw':!![],'where':{'id':_0x1013be[_0xf661('0x46')]['id']}},_0xfdbcdc={};_0xfdbcdc[_0xf661('0x2e')]=_[_0xf661('0x30')](db[_0xf661('0x40')][_0xf661('0x2a')]);_0xfdbcdc['query']=_[_0xf661('0x30')](_0x1013be[_0xf661('0x2f')]);_0xfdbcdc['filters']=_[_0xf661('0x32')](_0xfdbcdc[_0xf661('0x2e')],_0xfdbcdc[_0xf661('0x2f')]);_0x40f8b8[_0xf661('0x34')]=_[_0xf661('0x32')](_0xfdbcdc['model'],qs['fields'](_0x1013be[_0xf661('0x2f')][_0xf661('0x33')]));_0x40f8b8[_0xf661('0x34')]=_0x40f8b8[_0xf661('0x34')][_0xf661('0x35')]?_0x40f8b8[_0xf661('0x34')]:_0xfdbcdc[_0xf661('0x2e')];if(_0x1013be['query'][_0xf661('0x41')]){_0x40f8b8[_0xf661('0x42')]=[{'all':!![]}];}_0x40f8b8=_[_0xf661('0x3c')]({},_0x40f8b8,_0x1013be['options']);return db['Variable'][_0xf661('0x47')](_0x40f8b8)['then'](handleEntityNotFound(_0xba9d90,null))[_0xf661('0x20')](respondWithResult(_0xba9d90,null))[_0xf661('0x44')](handleError(_0xba9d90,null));};exports[_0xf661('0x48')]=function(_0x503aa2,_0xae571b){return db[_0xf661('0x40')][_0xf661('0x48')](_0x503aa2[_0xf661('0x49')],{})[_0xf661('0x20')](function(_0x427a09){var _0x48e90f=_0x503aa2[_0xf661('0x4a')][_0xf661('0x4b')]({'plain':!![]});if(!_0x48e90f)throw new Error(_0xf661('0x4c'));if(_0x48e90f['role']==='user'){var _0x596489=_0x427a09[_0xf661('0x4b')]({'plain':!![]});var _0x3b3a6a=_0xf661('0x21');return db[_0xf661('0x4d')][_0xf661('0x47')]({'where':{'name':_0x3b3a6a,'userProfileId':_0x48e90f[_0xf661('0x4e')]},'raw':!![]})[_0xf661('0x20')](function(_0x52b8c5){if(_0x52b8c5&&_0x52b8c5[_0xf661('0x4f')]===0x0){return db[_0xf661('0x22')][_0xf661('0x48')]({'name':_0x596489['name'],'resourceId':_0x596489['id'],'type':_0x52b8c5[_0xf661('0x3e')],'sectionId':_0x52b8c5['id']},{})[_0xf661('0x20')](function(){return _0x427a09;});}else{return _0x427a09;}})[_0xf661('0x44')](function(_0x597dd4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x597dd4);throw _0x597dd4;});}return _0x427a09;})[_0xf661('0x20')](respondWithResult(_0xae571b,0xc9))[_0xf661('0x44')](handleError(_0xae571b,null));};exports[_0xf661('0x50')]=function(_0x344fb8,_0xcabdb0){if(_0x344fb8['body']['id']){delete _0x344fb8[_0xf661('0x49')]['id'];}return db['Variable'][_0xf661('0x47')]({'where':{'id':_0x344fb8[_0xf661('0x46')]['id']}})[_0xf661('0x20')](handleEntityNotFound(_0xcabdb0,null))['then'](saveUpdates(_0x344fb8[_0xf661('0x49')],null))[_0xf661('0x20')](respondWithResult(_0xcabdb0,null))[_0xf661('0x44')](handleError(_0xcabdb0,null));};exports['destroy']=function(_0x1e8d6e,_0x225356){return db[_0xf661('0x40')][_0xf661('0x47')]({'where':{'id':_0x1e8d6e['params']['id']}})[_0xf661('0x20')](handleEntityNotFound(_0x225356,null))[_0xf661('0x20')](removeEntity(_0x225356,null))[_0xf661('0x44')](handleError(_0x225356,null));};
\ No newline at end of file
+var _0x1acf=['model','name','query','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','params','keys','rawAttributes','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','html-pdf','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','count','offset','status','set','Content-Range','apply','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','error','stack','map','Variable','fieldName','type'];(function(_0x4ad072,_0x2582f1){var _0x4f7ae5=function(_0x5abb9e){while(--_0x5abb9e){_0x4ad072['push'](_0x4ad072['shift']());}};_0x4f7ae5(++_0x2582f1);}(_0x1acf,0xac));var _0xf1ac=function(_0x45aa6c,_0x4d3225){_0x45aa6c=_0x45aa6c-0x0;var _0x2326ef=_0x1acf[_0x45aa6c];return _0x2326ef;};'use strict';var pdf=require(_0xf1ac('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf1ac('0x1'));var moment=require(_0xf1ac('0x2'));var BPromise=require(_0xf1ac('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf1ac('0x4'));var csv=require(_0xf1ac('0x5'));var ejs=require(_0xf1ac('0x6'));var fs=require('fs');var _=require(_0xf1ac('0x7'));var squel=require(_0xf1ac('0x8'));var crypto=require(_0xf1ac('0x9'));var jsforce=require(_0xf1ac('0xa'));var deskjs=require(_0xf1ac('0xb'));var toCsv=require(_0xf1ac('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf1ac('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1ac('0xd'));var logger=require(_0xf1ac('0xe'))(_0xf1ac('0xf'));var utils=require(_0xf1ac('0x10'));var config=require(_0xf1ac('0x11'));var licenseUtil=require(_0xf1ac('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b6fca,_0x6e8fa){_0x6e8fa=_0x6e8fa||0xcc;return function(_0x18d067){if(_0x18d067){return _0x2b6fca['sendStatus'](_0x6e8fa);}return _0x2b6fca['status'](_0x6e8fa)[_0xf1ac('0x13')]();};}function respondWithResult(_0x7df73,_0xb27671){_0xb27671=_0xb27671||0xc8;return function(_0x53edac){if(_0x53edac){return _0x7df73['status'](_0xb27671)[_0xf1ac('0x14')](_0x53edac);}};}function respondWithFilteredResult(_0x22da3d,_0x3df244){return function(_0x5e4541){if(_0x5e4541){var _0x163731=_0x5e4541[_0xf1ac('0x15')],_0x5a0085=_0x3df244[_0xf1ac('0x16')],_0x45ff05=_0x3df244[_0xf1ac('0x16')]+_0x3df244['limit'],_0x369506;if(_0x45ff05>=_0x163731){_0x45ff05=_0x163731;_0x369506=0xc8;}else{_0x369506=0xce;}_0x22da3d[_0xf1ac('0x17')](_0x369506);return _0x22da3d[_0xf1ac('0x18')](_0xf1ac('0x19'),_0x5a0085+'-'+_0x45ff05+'/'+_0x163731)[_0xf1ac('0x14')](_0x5e4541);}return null;};}function patchUpdates(_0x174c0b){return function(_0x4b7801){try{jsonpatch[_0xf1ac('0x1a')](_0x4b7801,_0x174c0b,!![]);}catch(_0x4058ca){return BPromise['reject'](_0x4058ca);}return _0x4b7801[_0xf1ac('0x1b')]();};}function saveUpdates(_0x1d622d,_0x239277){return function(_0x2d2bb2){if(_0x2d2bb2){return _0x2d2bb2[_0xf1ac('0x1c')](_0x1d622d)[_0xf1ac('0x1d')](function(_0x436ff9){return _0x436ff9;});}return null;};}function removeEntity(_0x44b6af,_0x1bb528){return function(_0x32d6e5){if(_0x32d6e5){return _0x32d6e5['destroy']()[_0xf1ac('0x1d')](function(){var _0x5cd4ea=_0x32d6e5[_0xf1ac('0x1e')]({'plain':!![]});var _0x39d4db=_0xf1ac('0x1f');return db[_0xf1ac('0x20')][_0xf1ac('0x21')]({'where':{'type':_0x39d4db,'resourceId':_0x5cd4ea['id']}})[_0xf1ac('0x1d')](function(){return _0x32d6e5;});})[_0xf1ac('0x1d')](function(){_0x44b6af[_0xf1ac('0x17')](0xcc)[_0xf1ac('0x13')]();});}};}function handleEntityNotFound(_0x5ce578,_0x1f15f1){return function(_0x46fbd3){if(!_0x46fbd3){_0x5ce578[_0xf1ac('0x22')](0x194);}return _0x46fbd3;};}function handleError(_0x260138,_0x724e6){_0x724e6=_0x724e6||0x1f4;return function(_0xa7eddf){logger[_0xf1ac('0x23')](_0xa7eddf[_0xf1ac('0x24')]);if(_0xa7eddf['name']){delete _0xa7eddf['name'];}_0x260138[_0xf1ac('0x17')](_0x724e6)['send'](_0xa7eddf);};}exports['index']=function(_0x36516c,_0x3c6a52){var _0x41dec8={},_0x2ce255={},_0x455e11={'count':0x0,'rows':[]};var _0xde0b5d=_[_0xf1ac('0x25')](db[_0xf1ac('0x26')]['rawAttributes'],function(_0x3d586a){return{'name':_0x3d586a[_0xf1ac('0x27')],'type':_0x3d586a[_0xf1ac('0x28')]['key']};});_0x2ce255[_0xf1ac('0x29')]=_[_0xf1ac('0x25')](_0xde0b5d,_0xf1ac('0x2a'));_0x2ce255[_0xf1ac('0x2b')]=_['keys'](_0x36516c['query']);_0x2ce255['filters']=_['intersection'](_0x2ce255['model'],_0x2ce255[_0xf1ac('0x2b')]);_0x41dec8['attributes']=_[_0xf1ac('0x2c')](_0x2ce255[_0xf1ac('0x29')],qs[_0xf1ac('0x2d')](_0x36516c[_0xf1ac('0x2b')][_0xf1ac('0x2d')]));_0x41dec8[_0xf1ac('0x2e')]=_0x41dec8[_0xf1ac('0x2e')]['length']?_0x41dec8[_0xf1ac('0x2e')]:_0x2ce255[_0xf1ac('0x29')];if(!_0x36516c[_0xf1ac('0x2b')][_0xf1ac('0x2f')]('nolimit')){_0x41dec8[_0xf1ac('0x30')]=qs[_0xf1ac('0x30')](_0x36516c[_0xf1ac('0x2b')]['limit']);_0x41dec8[_0xf1ac('0x16')]=qs[_0xf1ac('0x16')](_0x36516c[_0xf1ac('0x2b')][_0xf1ac('0x16')]);}_0x41dec8[_0xf1ac('0x31')]=qs[_0xf1ac('0x32')](_0x36516c[_0xf1ac('0x2b')][_0xf1ac('0x32')]);_0x41dec8[_0xf1ac('0x33')]=qs[_0xf1ac('0x34')](_[_0xf1ac('0x35')](_0x36516c[_0xf1ac('0x2b')],_0x2ce255[_0xf1ac('0x34')]),_0xde0b5d);if(_0x36516c[_0xf1ac('0x2b')][_0xf1ac('0x36')]){_0x41dec8['where']=_[_0xf1ac('0x37')](_0x41dec8[_0xf1ac('0x33')],{'$or':_[_0xf1ac('0x25')](_0xde0b5d,function(_0x586283){if(_0x586283[_0xf1ac('0x28')]!=='VIRTUAL'){var _0x3e2688={};_0x3e2688[_0x586283[_0xf1ac('0x2a')]]={'$like':'%'+_0x36516c['query'][_0xf1ac('0x36')]+'%'};return _0x3e2688;}})});}_0x41dec8=_[_0xf1ac('0x37')]({},_0x41dec8,_0x36516c['options']);var _0x5483f3={'where':_0x41dec8['where']};return db[_0xf1ac('0x26')]['count'](_0x5483f3)[_0xf1ac('0x1d')](function(_0x62c2a0){_0x455e11[_0xf1ac('0x15')]=_0x62c2a0;if(_0x36516c[_0xf1ac('0x2b')][_0xf1ac('0x38')]){_0x41dec8[_0xf1ac('0x39')]=[{'all':!![]}];}return db[_0xf1ac('0x26')][_0xf1ac('0x3a')](_0x41dec8);})[_0xf1ac('0x1d')](function(_0x53800a){_0x455e11['rows']=_0x53800a;return _0x455e11;})[_0xf1ac('0x1d')](respondWithFilteredResult(_0x3c6a52,_0x41dec8))['catch'](handleError(_0x3c6a52,null));};exports['show']=function(_0xfcf2cc,_0x160792){var _0x3945f0={'raw':!![],'where':{'id':_0xfcf2cc[_0xf1ac('0x3b')]['id']}},_0x2ea416={};_0x2ea416[_0xf1ac('0x29')]=_[_0xf1ac('0x3c')](db[_0xf1ac('0x26')][_0xf1ac('0x3d')]);_0x2ea416[_0xf1ac('0x2b')]=_[_0xf1ac('0x3c')](_0xfcf2cc['query']);_0x2ea416['filters']=_[_0xf1ac('0x2c')](_0x2ea416[_0xf1ac('0x29')],_0x2ea416['query']);_0x3945f0[_0xf1ac('0x2e')]=_[_0xf1ac('0x2c')](_0x2ea416['model'],qs[_0xf1ac('0x2d')](_0xfcf2cc[_0xf1ac('0x2b')][_0xf1ac('0x2d')]));_0x3945f0[_0xf1ac('0x2e')]=_0x3945f0[_0xf1ac('0x2e')][_0xf1ac('0x3e')]?_0x3945f0[_0xf1ac('0x2e')]:_0x2ea416[_0xf1ac('0x29')];if(_0xfcf2cc[_0xf1ac('0x2b')]['includeAll']){_0x3945f0[_0xf1ac('0x39')]=[{'all':!![]}];}_0x3945f0=_[_0xf1ac('0x37')]({},_0x3945f0,_0xfcf2cc['options']);return db[_0xf1ac('0x26')]['find'](_0x3945f0)[_0xf1ac('0x1d')](handleEntityNotFound(_0x160792,null))[_0xf1ac('0x1d')](respondWithResult(_0x160792,null))[_0xf1ac('0x3f')](handleError(_0x160792,null));};exports[_0xf1ac('0x40')]=function(_0x4844e0,_0x5b1c4c){return db['Variable'][_0xf1ac('0x40')](_0x4844e0[_0xf1ac('0x41')],{})[_0xf1ac('0x1d')](function(_0x5f1c18){var _0x281aa0=_0x4844e0[_0xf1ac('0x42')][_0xf1ac('0x1e')]({'plain':!![]});if(!_0x281aa0)throw new Error(_0xf1ac('0x43'));if(_0x281aa0[_0xf1ac('0x44')]===_0xf1ac('0x42')){var _0x1ce240=_0x5f1c18[_0xf1ac('0x1e')]({'plain':!![]});var _0x177297=_0xf1ac('0x1f');return db[_0xf1ac('0x45')][_0xf1ac('0x46')]({'where':{'name':_0x177297,'userProfileId':_0x281aa0['userProfileId']},'raw':!![]})[_0xf1ac('0x1d')](function(_0x4716bd){if(_0x4716bd&&_0x4716bd['autoAssociation']===0x0){return db[_0xf1ac('0x20')][_0xf1ac('0x40')]({'name':_0x1ce240[_0xf1ac('0x2a')],'resourceId':_0x1ce240['id'],'type':_0x4716bd[_0xf1ac('0x2a')],'sectionId':_0x4716bd['id']},{})['then'](function(){return _0x5f1c18;});}else{return _0x5f1c18;}})[_0xf1ac('0x3f')](function(_0x4834a1){logger[_0xf1ac('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4834a1);throw _0x4834a1;});}return _0x5f1c18;})['then'](respondWithResult(_0x5b1c4c,0xc9))[_0xf1ac('0x3f')](handleError(_0x5b1c4c,null));};exports[_0xf1ac('0x1c')]=function(_0x4a50e8,_0x1d4da8){if(_0x4a50e8[_0xf1ac('0x41')]['id']){delete _0x4a50e8['body']['id'];}return db[_0xf1ac('0x26')][_0xf1ac('0x46')]({'where':{'id':_0x4a50e8['params']['id']}})[_0xf1ac('0x1d')](handleEntityNotFound(_0x1d4da8,null))['then'](saveUpdates(_0x4a50e8[_0xf1ac('0x41')],null))[_0xf1ac('0x1d')](respondWithResult(_0x1d4da8,null))[_0xf1ac('0x3f')](handleError(_0x1d4da8,null));};exports[_0xf1ac('0x21')]=function(_0x58c1ee,_0x292ac3){return db[_0xf1ac('0x26')]['find']({'where':{'id':_0x58c1ee[_0xf1ac('0x3b')]['id']}})[_0xf1ac('0x1d')](handleEntityNotFound(_0x292ac3,null))['then'](removeEntity(_0x292ac3,null))['catch'](handleError(_0x292ac3,null));};
\ No newline at end of file