Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / variable / variable.controller.js
index c7fbebc..2049b7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x72f9=['../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','name','index','map','Variable','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x72f9,0x1c3));var _0x972f=function(_0x3a6194,_0x4574e2){_0x3a6194=_0x3a6194-0x0;var _0x298116=_0x72f9[_0x3a6194];return _0x298116;};'use strict';var emlformat=require(_0x972f('0x0'));var rimraf=require(_0x972f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x972f('0x2'));var rp=require('request-promise');var moment=require(_0x972f('0x3'));var BPromise=require(_0x972f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x972f('0x5'));var sox=require('sox');var csv=require(_0x972f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x972f('0x7'));var jsforce=require(_0x972f('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x972f('0x6'));var querystring=require(_0x972f('0x9'));var Papa=require(_0x972f('0xa'));var Redis=require(_0x972f('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x972f('0xc'));var as=require(_0x972f('0xd'));var hardwareService=require(_0x972f('0xe'));var logger=require(_0x972f('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x972f('0x10'));var licenseUtil=require(_0x972f('0x11'));var db=require(_0x972f('0x12'))['db'];function respondWithStatusCode(_0x2a335e,_0x112bbb){_0x112bbb=_0x112bbb||0xcc;return function(_0xe3d29d){if(_0xe3d29d){return _0x2a335e[_0x972f('0x13')](_0x112bbb);}return _0x2a335e['status'](_0x112bbb)[_0x972f('0x14')]();};}function respondWithResult(_0x1b5384,_0x34ac4e){_0x34ac4e=_0x34ac4e||0xc8;return function(_0x26bcd1){if(_0x26bcd1){return _0x1b5384['status'](_0x34ac4e)[_0x972f('0x15')](_0x26bcd1);}};}function respondWithFilteredResult(_0x37a120,_0x561175){return function(_0x298f37){if(_0x298f37){var _0x2b52cf=typeof _0x561175['offset']===_0x972f('0x16')&&typeof _0x561175[_0x972f('0x17')]===_0x972f('0x16');var _0x41281c=_0x298f37[_0x972f('0x18')];var _0x5f79e1=_0x2b52cf?0x0:_0x561175[_0x972f('0x19')];var _0x36764b=_0x2b52cf?_0x298f37[_0x972f('0x18')]:_0x561175[_0x972f('0x19')]+_0x561175[_0x972f('0x17')];var _0x5a29d9;if(_0x36764b>=_0x41281c){_0x36764b=_0x41281c;_0x5a29d9=0xc8;}else{_0x5a29d9=0xce;}_0x37a120[_0x972f('0x1a')](_0x5a29d9);return _0x37a120[_0x972f('0x1b')](_0x972f('0x1c'),_0x5f79e1+'-'+_0x36764b+'/'+_0x41281c)[_0x972f('0x15')](_0x298f37);}return null;};}function patchUpdates(_0x49ad8f){return function(_0xfdb87a){try{jsonpatch[_0x972f('0x1d')](_0xfdb87a,_0x49ad8f,!![]);}catch(_0x51d7fd){return BPromise['reject'](_0x51d7fd);}return _0xfdb87a[_0x972f('0x1e')]();};}function saveUpdates(_0x42b0f8,_0x24cd5f){return function(_0x4c0556){if(_0x4c0556){return _0x4c0556[_0x972f('0x1f')](_0x42b0f8)[_0x972f('0x20')](function(_0x255996){return _0x255996;});}return null;};}function removeEntity(_0x138fba,_0x5d1b34){return function(_0x2fa0ad){if(_0x2fa0ad){return _0x2fa0ad[_0x972f('0x21')]()[_0x972f('0x20')](function(){var _0x170d0e=_0x2fa0ad[_0x972f('0x22')]({'plain':!![]});var _0x34a957=_0x972f('0x23');return db[_0x972f('0x24')][_0x972f('0x21')]({'where':{'type':_0x34a957,'resourceId':_0x170d0e['id']}})[_0x972f('0x20')](function(){return _0x2fa0ad;});})[_0x972f('0x20')](function(){_0x138fba[_0x972f('0x1a')](0xcc)[_0x972f('0x14')]();});}};}function handleEntityNotFound(_0x16f97e,_0x333463){return function(_0x6d2dd1){if(!_0x6d2dd1){_0x16f97e['sendStatus'](0x194);}return _0x6d2dd1;};}function handleError(_0x466852,_0x490fee){_0x490fee=_0x490fee||0x1f4;return function(_0x3368d9){logger[_0x972f('0x25')](_0x3368d9['stack']);if(_0x3368d9[_0x972f('0x26')]){delete _0x3368d9[_0x972f('0x26')];}_0x466852['status'](_0x490fee)['send'](_0x3368d9);};}exports[_0x972f('0x27')]=function(_0x399c09,_0xad1ce8){var _0x5f5beb={},_0x4fa279={},_0x1f2675={'count':0x0,'rows':[]};var _0x3a3b7a=_[_0x972f('0x28')](db[_0x972f('0x29')][_0x972f('0x2a')],function(_0x2d0019){return{'name':_0x2d0019[_0x972f('0x2b')],'type':_0x2d0019[_0x972f('0x2c')][_0x972f('0x2d')]};});_0x4fa279[_0x972f('0x2e')]=_[_0x972f('0x28')](_0x3a3b7a,_0x972f('0x26'));_0x4fa279['query']=_['keys'](_0x399c09['query']);_0x4fa279[_0x972f('0x2f')]=_[_0x972f('0x30')](_0x4fa279[_0x972f('0x2e')],_0x4fa279[_0x972f('0x31')]);_0x5f5beb[_0x972f('0x32')]=_[_0x972f('0x30')](_0x4fa279['model'],qs['fields'](_0x399c09[_0x972f('0x31')]['fields']));_0x5f5beb[_0x972f('0x32')]=_0x5f5beb['attributes'][_0x972f('0x33')]?_0x5f5beb['attributes']:_0x4fa279[_0x972f('0x2e')];if(!_0x399c09[_0x972f('0x31')][_0x972f('0x34')](_0x972f('0x35'))){_0x5f5beb[_0x972f('0x17')]=qs['limit'](_0x399c09[_0x972f('0x31')][_0x972f('0x17')]);_0x5f5beb[_0x972f('0x19')]=qs[_0x972f('0x19')](_0x399c09['query'][_0x972f('0x19')]);}_0x5f5beb[_0x972f('0x36')]=qs[_0x972f('0x37')](_0x399c09[_0x972f('0x31')][_0x972f('0x37')]);_0x5f5beb[_0x972f('0x38')]=qs['filters'](_['pick'](_0x399c09[_0x972f('0x31')],_0x4fa279[_0x972f('0x2f')]),_0x3a3b7a);if(_0x399c09[_0x972f('0x31')][_0x972f('0x39')]){_0x5f5beb[_0x972f('0x38')]=_[_0x972f('0x3a')](_0x5f5beb['where'],{'$or':_[_0x972f('0x28')](_0x3a3b7a,function(_0x29ac97){if(_0x29ac97['type']!==_0x972f('0x3b')){var _0x185b9b={};_0x185b9b[_0x29ac97[_0x972f('0x26')]]={'$like':'%'+_0x399c09['query'][_0x972f('0x39')]+'%'};return _0x185b9b;}})});}_0x5f5beb=_[_0x972f('0x3a')]({},_0x5f5beb,_0x399c09[_0x972f('0x3c')]);var _0x28f6ef={'where':_0x5f5beb[_0x972f('0x38')]};return db[_0x972f('0x29')][_0x972f('0x18')](_0x28f6ef)['then'](function(_0x320d1b){_0x1f2675['count']=_0x320d1b;if(_0x399c09[_0x972f('0x31')][_0x972f('0x3d')]){_0x5f5beb[_0x972f('0x3e')]=[{'all':!![]}];}return db[_0x972f('0x29')][_0x972f('0x3f')](_0x5f5beb);})[_0x972f('0x20')](function(_0xea9d3e){_0x1f2675[_0x972f('0x40')]=_0xea9d3e;return _0x1f2675;})[_0x972f('0x20')](respondWithFilteredResult(_0xad1ce8,_0x5f5beb))[_0x972f('0x41')](handleError(_0xad1ce8,null));};exports['show']=function(_0x2b9b1e,_0x43bcc3){var _0x44f75c={'raw':!![],'where':{'id':_0x2b9b1e[_0x972f('0x42')]['id']}},_0x175446={};_0x175446[_0x972f('0x2e')]=_['keys'](db[_0x972f('0x29')][_0x972f('0x2a')]);_0x175446[_0x972f('0x31')]=_[_0x972f('0x43')](_0x2b9b1e[_0x972f('0x31')]);_0x175446[_0x972f('0x2f')]=_[_0x972f('0x30')](_0x175446[_0x972f('0x2e')],_0x175446[_0x972f('0x31')]);_0x44f75c[_0x972f('0x32')]=_[_0x972f('0x30')](_0x175446['model'],qs[_0x972f('0x44')](_0x2b9b1e['query'][_0x972f('0x44')]));_0x44f75c[_0x972f('0x32')]=_0x44f75c[_0x972f('0x32')][_0x972f('0x33')]?_0x44f75c['attributes']:_0x175446['model'];if(_0x2b9b1e[_0x972f('0x31')][_0x972f('0x3d')]){_0x44f75c['include']=[{'all':!![]}];}_0x44f75c=_[_0x972f('0x3a')]({},_0x44f75c,_0x2b9b1e[_0x972f('0x3c')]);return db[_0x972f('0x29')][_0x972f('0x45')](_0x44f75c)['then'](handleEntityNotFound(_0x43bcc3,null))[_0x972f('0x20')](respondWithResult(_0x43bcc3,null))[_0x972f('0x41')](handleError(_0x43bcc3,null));};exports[_0x972f('0x46')]=function(_0x423c06,_0xd84bc7){return db[_0x972f('0x29')][_0x972f('0x46')](_0x423c06[_0x972f('0x47')],{})[_0x972f('0x20')](function(_0x507f4b){var _0x29c76c=_0x423c06[_0x972f('0x48')][_0x972f('0x22')]({'plain':!![]});if(!_0x29c76c)throw new Error(_0x972f('0x49'));if(_0x29c76c[_0x972f('0x4a')]===_0x972f('0x48')){var _0x23b801=_0x507f4b[_0x972f('0x22')]({'plain':!![]});var _0xfcfbfa=_0x972f('0x23');return db[_0x972f('0x4b')]['find']({'where':{'name':_0xfcfbfa,'userProfileId':_0x29c76c[_0x972f('0x4c')]},'raw':!![]})[_0x972f('0x20')](function(_0x817a63){if(_0x817a63&&_0x817a63['autoAssociation']===0x0){return db[_0x972f('0x24')]['create']({'name':_0x23b801[_0x972f('0x26')],'resourceId':_0x23b801['id'],'type':_0x817a63['name'],'sectionId':_0x817a63['id']},{})['then'](function(){return _0x507f4b;});}else{return _0x507f4b;}})[_0x972f('0x41')](function(_0x496752){logger[_0x972f('0x25')](_0x972f('0x4d'),_0x496752);throw _0x496752;});}return _0x507f4b;})[_0x972f('0x20')](respondWithResult(_0xd84bc7,0xc9))[_0x972f('0x41')](handleError(_0xd84bc7,null));};exports['update']=function(_0x2618e9,_0x1441e3){if(_0x2618e9[_0x972f('0x47')]['id']){delete _0x2618e9[_0x972f('0x47')]['id'];}return db['Variable'][_0x972f('0x45')]({'where':{'id':_0x2618e9[_0x972f('0x42')]['id']}})[_0x972f('0x20')](handleEntityNotFound(_0x1441e3,null))[_0x972f('0x20')](saveUpdates(_0x2618e9[_0x972f('0x47')],null))[_0x972f('0x20')](respondWithResult(_0x1441e3,null))[_0x972f('0x41')](handleError(_0x1441e3,null));};exports[_0x972f('0x21')]=function(_0x2b6d10,_0x5d200b){return db[_0x972f('0x29')][_0x972f('0x45')]({'where':{'id':_0x2b6d10['params']['id']}})[_0x972f('0x20')](handleEntityNotFound(_0x5d200b,null))['then'](removeEntity(_0x5d200b,null))[_0x972f('0x41')](handleError(_0x5d200b,null));};
\ No newline at end of file
+var _0x272e=['then','get','UserProfileResource','destroy','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update'];(function(_0x3f7094,_0x4297eb){var _0x4bbedc=function(_0x422c01){while(--_0x422c01){_0x3f7094['push'](_0x3f7094['shift']());}};_0x4bbedc(++_0x4297eb);}(_0x272e,0x181));var _0xe272=function(_0x649717,_0x5183d4){_0x649717=_0x649717-0x0;var _0x36e211=_0x272e[_0x649717];return _0x36e211;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe272('0x0'));var zipdir=require(_0xe272('0x1'));var jsonpatch=require(_0xe272('0x2'));var rp=require(_0xe272('0x3'));var moment=require('moment');var BPromise=require(_0xe272('0x4'));var Mustache=require(_0xe272('0x5'));var util=require(_0xe272('0x6'));var path=require(_0xe272('0x7'));var sox=require(_0xe272('0x8'));var csv=require(_0xe272('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe272('0xa'));var _=require(_0xe272('0xb'));var squel=require(_0xe272('0xc'));var crypto=require(_0xe272('0xd'));var jsforce=require(_0xe272('0xe'));var deskjs=require(_0xe272('0xf'));var toCsv=require(_0xe272('0x9'));var querystring=require(_0xe272('0x10'));var Papa=require(_0xe272('0x11'));var Redis=require(_0xe272('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe272('0x13'));var as=require(_0xe272('0x14'));var hardwareService=require(_0xe272('0x15'));var logger=require(_0xe272('0x16'))(_0xe272('0x17'));var utils=require(_0xe272('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe272('0x19'));var db=require(_0xe272('0x1a'))['db'];function respondWithStatusCode(_0x479b3d,_0x3fb850){_0x3fb850=_0x3fb850||0xcc;return function(_0xec426c){if(_0xec426c){return _0x479b3d[_0xe272('0x1b')](_0x3fb850);}return _0x479b3d[_0xe272('0x1c')](_0x3fb850)[_0xe272('0x1d')]();};}function respondWithResult(_0xbf1776,_0x2276d6){_0x2276d6=_0x2276d6||0xc8;return function(_0x36b63c){if(_0x36b63c){return _0xbf1776['status'](_0x2276d6)['json'](_0x36b63c);}};}function respondWithFilteredResult(_0xc57be9,_0x274d8f){return function(_0x1847d2){if(_0x1847d2){var _0x321192=typeof _0x274d8f[_0xe272('0x1e')]===_0xe272('0x1f')&&typeof _0x274d8f[_0xe272('0x20')]===_0xe272('0x1f');var _0x5974ae=_0x1847d2[_0xe272('0x21')];var _0x4a3b57=_0x321192?0x0:_0x274d8f['offset'];var _0x1e8c11=_0x321192?_0x1847d2[_0xe272('0x21')]:_0x274d8f[_0xe272('0x1e')]+_0x274d8f[_0xe272('0x20')];var _0x38779f;if(_0x1e8c11>=_0x5974ae){_0x1e8c11=_0x5974ae;_0x38779f=0xc8;}else{_0x38779f=0xce;}_0xc57be9['status'](_0x38779f);return _0xc57be9[_0xe272('0x22')](_0xe272('0x23'),_0x4a3b57+'-'+_0x1e8c11+'/'+_0x5974ae)[_0xe272('0x24')](_0x1847d2);}return null;};}function patchUpdates(_0x121705){return function(_0x533105){try{jsonpatch[_0xe272('0x25')](_0x533105,_0x121705,!![]);}catch(_0x59b24a){return BPromise['reject'](_0x59b24a);}return _0x533105[_0xe272('0x26')]();};}function saveUpdates(_0x23f3fb,_0x3311f7){return function(_0x3a84b4){if(_0x3a84b4){return _0x3a84b4[_0xe272('0x27')](_0x23f3fb)['then'](function(_0x2f9258){return _0x2f9258;});}return null;};}function removeEntity(_0x3570f1,_0x4554cf){return function(_0x384fa9){if(_0x384fa9){return _0x384fa9['destroy']()[_0xe272('0x28')](function(){var _0x26c95b=_0x384fa9[_0xe272('0x29')]({'plain':!![]});var _0x371845='Variables';return db[_0xe272('0x2a')][_0xe272('0x2b')]({'where':{'type':_0x371845,'resourceId':_0x26c95b['id']}})[_0xe272('0x28')](function(){return _0x384fa9;});})[_0xe272('0x28')](function(){_0x3570f1[_0xe272('0x1c')](0xcc)[_0xe272('0x1d')]();});}};}function handleEntityNotFound(_0x5a6469,_0x1f793d){return function(_0x16ba8b){if(!_0x16ba8b){_0x5a6469[_0xe272('0x1b')](0x194);}return _0x16ba8b;};}function handleError(_0x3801fc,_0x82a815){_0x82a815=_0x82a815||0x1f4;return function(_0x5a516e){logger['error'](_0x5a516e['stack']);if(_0x5a516e[_0xe272('0x2c')]){delete _0x5a516e['name'];}_0x3801fc[_0xe272('0x1c')](_0x82a815)['send'](_0x5a516e);};}exports[_0xe272('0x2d')]=function(_0x5622ab,_0x299cd4){var _0x44235a={},_0x352df8={},_0x49b2ec={'count':0x0,'rows':[]};var _0x4f790c=_[_0xe272('0x2e')](db[_0xe272('0x2f')][_0xe272('0x30')],function(_0x5c06d8){return{'name':_0x5c06d8[_0xe272('0x31')],'type':_0x5c06d8[_0xe272('0x32')][_0xe272('0x33')]};});_0x352df8[_0xe272('0x34')]=_[_0xe272('0x2e')](_0x4f790c,_0xe272('0x2c'));_0x352df8[_0xe272('0x35')]=_[_0xe272('0x36')](_0x5622ab[_0xe272('0x35')]);_0x352df8[_0xe272('0x37')]=_['intersection'](_0x352df8[_0xe272('0x34')],_0x352df8[_0xe272('0x35')]);_0x44235a['attributes']=_['intersection'](_0x352df8[_0xe272('0x34')],qs[_0xe272('0x38')](_0x5622ab[_0xe272('0x35')][_0xe272('0x38')]));_0x44235a[_0xe272('0x39')]=_0x44235a[_0xe272('0x39')]['length']?_0x44235a[_0xe272('0x39')]:_0x352df8[_0xe272('0x34')];if(!_0x5622ab[_0xe272('0x35')][_0xe272('0x3a')](_0xe272('0x3b'))){_0x44235a[_0xe272('0x20')]=qs[_0xe272('0x20')](_0x5622ab['query'][_0xe272('0x20')]);_0x44235a[_0xe272('0x1e')]=qs[_0xe272('0x1e')](_0x5622ab[_0xe272('0x35')][_0xe272('0x1e')]);}_0x44235a['order']=qs[_0xe272('0x3c')](_0x5622ab[_0xe272('0x35')][_0xe272('0x3c')]);_0x44235a[_0xe272('0x3d')]=qs[_0xe272('0x37')](_[_0xe272('0x3e')](_0x5622ab[_0xe272('0x35')],_0x352df8[_0xe272('0x37')]),_0x4f790c);if(_0x5622ab[_0xe272('0x35')]['filter']){_0x44235a['where']=_[_0xe272('0x3f')](_0x44235a[_0xe272('0x3d')],{'$or':_[_0xe272('0x2e')](_0x4f790c,function(_0x3e9fcd){if(_0x3e9fcd[_0xe272('0x32')]!=='VIRTUAL'){var _0x5d79bc={};_0x5d79bc[_0x3e9fcd[_0xe272('0x2c')]]={'$like':'%'+_0x5622ab['query'][_0xe272('0x40')]+'%'};return _0x5d79bc;}})});}_0x44235a=_[_0xe272('0x3f')]({},_0x44235a,_0x5622ab[_0xe272('0x41')]);var _0x2acb85={'where':_0x44235a[_0xe272('0x3d')]};return db[_0xe272('0x2f')][_0xe272('0x21')](_0x2acb85)[_0xe272('0x28')](function(_0x3518b){_0x49b2ec[_0xe272('0x21')]=_0x3518b;if(_0x5622ab['query'][_0xe272('0x42')]){_0x44235a[_0xe272('0x43')]=[{'all':!![]}];}return db[_0xe272('0x2f')][_0xe272('0x44')](_0x44235a);})[_0xe272('0x28')](function(_0x1f3a6f){_0x49b2ec[_0xe272('0x45')]=_0x1f3a6f;return _0x49b2ec;})[_0xe272('0x28')](respondWithFilteredResult(_0x299cd4,_0x44235a))[_0xe272('0x46')](handleError(_0x299cd4,null));};exports[_0xe272('0x47')]=function(_0xa74e5d,_0x2cf20a){var _0x53420b={'raw':!![],'where':{'id':_0xa74e5d[_0xe272('0x48')]['id']}},_0xcb858d={};_0xcb858d[_0xe272('0x34')]=_[_0xe272('0x36')](db[_0xe272('0x2f')][_0xe272('0x30')]);_0xcb858d[_0xe272('0x35')]=_[_0xe272('0x36')](_0xa74e5d['query']);_0xcb858d[_0xe272('0x37')]=_[_0xe272('0x49')](_0xcb858d[_0xe272('0x34')],_0xcb858d[_0xe272('0x35')]);_0x53420b['attributes']=_[_0xe272('0x49')](_0xcb858d[_0xe272('0x34')],qs[_0xe272('0x38')](_0xa74e5d[_0xe272('0x35')][_0xe272('0x38')]));_0x53420b[_0xe272('0x39')]=_0x53420b[_0xe272('0x39')]['length']?_0x53420b[_0xe272('0x39')]:_0xcb858d['model'];if(_0xa74e5d[_0xe272('0x35')][_0xe272('0x42')]){_0x53420b[_0xe272('0x43')]=[{'all':!![]}];}_0x53420b=_[_0xe272('0x3f')]({},_0x53420b,_0xa74e5d[_0xe272('0x41')]);return db[_0xe272('0x2f')][_0xe272('0x4a')](_0x53420b)[_0xe272('0x28')](handleEntityNotFound(_0x2cf20a,null))['then'](respondWithResult(_0x2cf20a,null))[_0xe272('0x46')](handleError(_0x2cf20a,null));};exports[_0xe272('0x4b')]=function(_0x779354,_0x5e9ee1){return db[_0xe272('0x2f')][_0xe272('0x4b')](_0x779354['body'],{})[_0xe272('0x28')](function(_0x201ef4){var _0x18b0a8=_0x779354[_0xe272('0x4c')][_0xe272('0x29')]({'plain':!![]});if(!_0x18b0a8)throw new Error(_0xe272('0x4d'));if(_0x18b0a8[_0xe272('0x4e')]===_0xe272('0x4c')){var _0x4386d8=_0x201ef4[_0xe272('0x29')]({'plain':!![]});var _0x4ea89c='Variables';return db[_0xe272('0x4f')]['find']({'where':{'name':_0x4ea89c,'userProfileId':_0x18b0a8[_0xe272('0x50')]},'raw':!![]})['then'](function(_0x1fb58f){if(_0x1fb58f&&_0x1fb58f[_0xe272('0x51')]===0x0){return db[_0xe272('0x2a')][_0xe272('0x4b')]({'name':_0x4386d8['name'],'resourceId':_0x4386d8['id'],'type':_0x1fb58f['name'],'sectionId':_0x1fb58f['id']},{})[_0xe272('0x28')](function(){return _0x201ef4;});}else{return _0x201ef4;}})[_0xe272('0x46')](function(_0x58cdb9){logger[_0xe272('0x52')](_0xe272('0x53'),_0x58cdb9);throw _0x58cdb9;});}return _0x201ef4;})[_0xe272('0x28')](respondWithResult(_0x5e9ee1,0xc9))[_0xe272('0x46')](handleError(_0x5e9ee1,null));};exports[_0xe272('0x27')]=function(_0x518bb7,_0xd627bb){if(_0x518bb7['body']['id']){delete _0x518bb7[_0xe272('0x54')]['id'];}return db[_0xe272('0x2f')][_0xe272('0x4a')]({'where':{'id':_0x518bb7['params']['id']}})[_0xe272('0x28')](handleEntityNotFound(_0xd627bb,null))['then'](saveUpdates(_0x518bb7['body'],null))[_0xe272('0x28')](respondWithResult(_0xd627bb,null))[_0xe272('0x46')](handleError(_0xd627bb,null));};exports[_0xe272('0x2b')]=function(_0x2ea923,_0x4475ca){return db[_0xe272('0x2f')][_0xe272('0x4a')]({'where':{'id':_0x2ea923['params']['id']}})[_0xe272('0x28')](handleEntityNotFound(_0x4475ca,null))[_0xe272('0x28')](removeEntity(_0x4475ca,null))[_0xe272('0x46')](handleError(_0x4475ca,null));};
\ No newline at end of file