Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / variable / variable.controller.js
index b3e871c..40e776b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xad1b=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','find'];(function(_0xae3cf1,_0x5bf320){var _0x2588ee=function(_0x23715c){while(--_0x23715c){_0xae3cf1['push'](_0xae3cf1['shift']());}};_0x2588ee(++_0x5bf320);}(_0xad1b,0x100));var _0xbad1=function(_0xa4dfd3,_0x16cca2){_0xa4dfd3=_0xa4dfd3-0x0;var _0x49efb7=_0xad1b[_0xa4dfd3];return _0x49efb7;};'use strict';var emlformat=require(_0xbad1('0x0'));var rimraf=require(_0xbad1('0x1'));var zipdir=require(_0xbad1('0x2'));var jsonpatch=require(_0xbad1('0x3'));var rp=require('request-promise');var moment=require(_0xbad1('0x4'));var BPromise=require(_0xbad1('0x5'));var Mustache=require(_0xbad1('0x6'));var util=require('util');var path=require(_0xbad1('0x7'));var sox=require(_0xbad1('0x8'));var csv=require(_0xbad1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbad1('0xa'));var squel=require('squel');var crypto=require(_0xbad1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbad1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbad1('0xd'));var Papa=require(_0xbad1('0xe'));var Redis=require(_0xbad1('0xf'));var authService=require(_0xbad1('0x10'));var qs=require(_0xbad1('0x11'));var as=require(_0xbad1('0x12'));var hardwareService=require(_0xbad1('0x13'));var logger=require('../../config/logger')(_0xbad1('0x14'));var utils=require(_0xbad1('0x15'));var config=require(_0xbad1('0x16'));var licenseUtil=require(_0xbad1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x293c5b,_0xcaacfc){_0xcaacfc=_0xcaacfc||0xcc;return function(_0x1e7f3f){if(_0x1e7f3f){return _0x293c5b['sendStatus'](_0xcaacfc);}return _0x293c5b[_0xbad1('0x18')](_0xcaacfc)[_0xbad1('0x19')]();};}function respondWithResult(_0x5f2b10,_0x3b2475){_0x3b2475=_0x3b2475||0xc8;return function(_0x1cc528){if(_0x1cc528){return _0x5f2b10['status'](_0x3b2475)[_0xbad1('0x1a')](_0x1cc528);}};}function respondWithFilteredResult(_0x58612e,_0x90125c){return function(_0x175e62){if(_0x175e62){var _0x2feb30=typeof _0x90125c[_0xbad1('0x1b')]===_0xbad1('0x1c')&&typeof _0x90125c[_0xbad1('0x1d')]==='undefined';var _0x5acffd=_0x175e62[_0xbad1('0x1e')];var _0x53ed7b=_0x2feb30?0x0:_0x90125c[_0xbad1('0x1b')];var _0x21789a=_0x2feb30?_0x175e62[_0xbad1('0x1e')]:_0x90125c[_0xbad1('0x1b')]+_0x90125c[_0xbad1('0x1d')];var _0x26a777;if(_0x21789a>=_0x5acffd){_0x21789a=_0x5acffd;_0x26a777=0xc8;}else{_0x26a777=0xce;}_0x58612e['status'](_0x26a777);return _0x58612e[_0xbad1('0x1f')](_0xbad1('0x20'),_0x53ed7b+'-'+_0x21789a+'/'+_0x5acffd)['json'](_0x175e62);}return null;};}function patchUpdates(_0x40430f){return function(_0x4b23a9){try{jsonpatch['apply'](_0x4b23a9,_0x40430f,!![]);}catch(_0x173982){return BPromise[_0xbad1('0x21')](_0x173982);}return _0x4b23a9[_0xbad1('0x22')]();};}function saveUpdates(_0x22735f,_0x22a850){return function(_0x418287){if(_0x418287){return _0x418287[_0xbad1('0x23')](_0x22735f)[_0xbad1('0x24')](function(_0x113d70){return _0x113d70;});}return null;};}function removeEntity(_0x21fed2,_0x423622){return function(_0x2faff2){if(_0x2faff2){return _0x2faff2[_0xbad1('0x25')]()['then'](function(){var _0x2fa46e=_0x2faff2[_0xbad1('0x26')]({'plain':!![]});var _0x529b67=_0xbad1('0x27');return db[_0xbad1('0x28')][_0xbad1('0x25')]({'where':{'type':_0x529b67,'resourceId':_0x2fa46e['id']}})['then'](function(){return _0x2faff2;});})[_0xbad1('0x24')](function(){_0x21fed2[_0xbad1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a4e3,_0x4b3299){return function(_0x108013){if(!_0x108013){_0x59a4e3[_0xbad1('0x29')](0x194);}return _0x108013;};}function handleError(_0x492b17,_0x21076b){_0x21076b=_0x21076b||0x1f4;return function(_0x1194be){logger[_0xbad1('0x2a')](_0x1194be[_0xbad1('0x2b')]);if(_0x1194be['name']){delete _0x1194be[_0xbad1('0x2c')];}_0x492b17['status'](_0x21076b)[_0xbad1('0x2d')](_0x1194be);};}exports[_0xbad1('0x2e')]=function(_0x4f6bfb,_0x1d50b7){var _0x436eb2={},_0x5d97dd={},_0x157cf3={'count':0x0,'rows':[]};var _0x13c9e1=_[_0xbad1('0x2f')](db[_0xbad1('0x30')][_0xbad1('0x31')],function(_0x5c0c77){return{'name':_0x5c0c77[_0xbad1('0x32')],'type':_0x5c0c77[_0xbad1('0x33')][_0xbad1('0x34')]};});_0x5d97dd['model']=_[_0xbad1('0x2f')](_0x13c9e1,_0xbad1('0x2c'));_0x5d97dd[_0xbad1('0x35')]=_[_0xbad1('0x36')](_0x4f6bfb[_0xbad1('0x35')]);_0x5d97dd['filters']=_['intersection'](_0x5d97dd[_0xbad1('0x37')],_0x5d97dd['query']);_0x436eb2['attributes']=_[_0xbad1('0x38')](_0x5d97dd[_0xbad1('0x37')],qs[_0xbad1('0x39')](_0x4f6bfb['query'][_0xbad1('0x39')]));_0x436eb2[_0xbad1('0x3a')]=_0x436eb2['attributes'][_0xbad1('0x3b')]?_0x436eb2['attributes']:_0x5d97dd[_0xbad1('0x37')];if(!_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x3c')]('nolimit')){_0x436eb2[_0xbad1('0x1d')]=qs[_0xbad1('0x1d')](_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x1d')]);_0x436eb2[_0xbad1('0x1b')]=qs[_0xbad1('0x1b')](_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x1b')]);}_0x436eb2[_0xbad1('0x3d')]=qs[_0xbad1('0x3e')](_0x4f6bfb['query'][_0xbad1('0x3e')]);_0x436eb2[_0xbad1('0x3f')]=qs[_0xbad1('0x40')](_[_0xbad1('0x41')](_0x4f6bfb[_0xbad1('0x35')],_0x5d97dd['filters']),_0x13c9e1);if(_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x42')]){_0x436eb2[_0xbad1('0x3f')]=_[_0xbad1('0x43')](_0x436eb2[_0xbad1('0x3f')],{'$or':_['map'](_0x13c9e1,function(_0x2a073f){if(_0x2a073f[_0xbad1('0x33')]!==_0xbad1('0x44')){var _0x240143={};_0x240143[_0x2a073f[_0xbad1('0x2c')]]={'$like':'%'+_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x42')]+'%'};return _0x240143;}})});}_0x436eb2=_[_0xbad1('0x43')]({},_0x436eb2,_0x4f6bfb[_0xbad1('0x45')]);var _0x17fb75={'where':_0x436eb2[_0xbad1('0x3f')]};return db[_0xbad1('0x30')][_0xbad1('0x1e')](_0x17fb75)[_0xbad1('0x24')](function(_0x2ae129){_0x157cf3[_0xbad1('0x1e')]=_0x2ae129;if(_0x4f6bfb[_0xbad1('0x35')]['includeAll']){_0x436eb2['include']=[{'all':!![]}];}return db[_0xbad1('0x30')][_0xbad1('0x46')](_0x436eb2);})['then'](function(_0x4b4c69){_0x157cf3[_0xbad1('0x47')]=_0x4b4c69;return _0x157cf3;})[_0xbad1('0x24')](respondWithFilteredResult(_0x1d50b7,_0x436eb2))[_0xbad1('0x48')](handleError(_0x1d50b7,null));};exports[_0xbad1('0x49')]=function(_0x24fda6,_0x3e52d3){var _0xa29eba={'raw':!![],'where':{'id':_0x24fda6[_0xbad1('0x4a')]['id']}},_0x2dac66={};_0x2dac66[_0xbad1('0x37')]=_[_0xbad1('0x36')](db['Variable'][_0xbad1('0x31')]);_0x2dac66[_0xbad1('0x35')]=_[_0xbad1('0x36')](_0x24fda6[_0xbad1('0x35')]);_0x2dac66[_0xbad1('0x40')]=_[_0xbad1('0x38')](_0x2dac66['model'],_0x2dac66[_0xbad1('0x35')]);_0xa29eba[_0xbad1('0x3a')]=_['intersection'](_0x2dac66[_0xbad1('0x37')],qs[_0xbad1('0x39')](_0x24fda6[_0xbad1('0x35')][_0xbad1('0x39')]));_0xa29eba[_0xbad1('0x3a')]=_0xa29eba[_0xbad1('0x3a')][_0xbad1('0x3b')]?_0xa29eba['attributes']:_0x2dac66[_0xbad1('0x37')];if(_0x24fda6[_0xbad1('0x35')]['includeAll']){_0xa29eba['include']=[{'all':!![]}];}_0xa29eba=_[_0xbad1('0x43')]({},_0xa29eba,_0x24fda6['options']);return db['Variable'][_0xbad1('0x4b')](_0xa29eba)[_0xbad1('0x24')](handleEntityNotFound(_0x3e52d3,null))['then'](respondWithResult(_0x3e52d3,null))[_0xbad1('0x48')](handleError(_0x3e52d3,null));};exports[_0xbad1('0x4c')]=function(_0x320c55,_0x4e1210){return db[_0xbad1('0x30')][_0xbad1('0x4c')](_0x320c55[_0xbad1('0x4d')],{})['then'](function(_0x2d5590){var _0x51bf23=_0x320c55[_0xbad1('0x4e')][_0xbad1('0x26')]({'plain':!![]});if(!_0x51bf23)throw new Error(_0xbad1('0x4f'));if(_0x51bf23[_0xbad1('0x50')]==='user'){var _0x2dccdb=_0x2d5590[_0xbad1('0x26')]({'plain':!![]});var _0x49cfe3=_0xbad1('0x27');return db['UserProfileSection'][_0xbad1('0x4b')]({'where':{'name':_0x49cfe3,'userProfileId':_0x51bf23[_0xbad1('0x51')]},'raw':!![]})[_0xbad1('0x24')](function(_0x21132a){if(_0x21132a&&_0x21132a[_0xbad1('0x52')]===0x0){return db['UserProfileResource'][_0xbad1('0x4c')]({'name':_0x2dccdb['name'],'resourceId':_0x2dccdb['id'],'type':_0x21132a[_0xbad1('0x2c')],'sectionId':_0x21132a['id']},{})[_0xbad1('0x24')](function(){return _0x2d5590;});}else{return _0x2d5590;}})[_0xbad1('0x48')](function(_0x46ef45){logger[_0xbad1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46ef45);throw _0x46ef45;});}return _0x2d5590;})[_0xbad1('0x24')](respondWithResult(_0x4e1210,0xc9))[_0xbad1('0x48')](handleError(_0x4e1210,null));};exports[_0xbad1('0x23')]=function(_0x5bda0f,_0x366c7a){if(_0x5bda0f[_0xbad1('0x4d')]['id']){delete _0x5bda0f[_0xbad1('0x4d')]['id'];}return db['Variable'][_0xbad1('0x4b')]({'where':{'id':_0x5bda0f[_0xbad1('0x4a')]['id']}})[_0xbad1('0x24')](handleEntityNotFound(_0x366c7a,null))[_0xbad1('0x24')](saveUpdates(_0x5bda0f['body'],null))[_0xbad1('0x24')](respondWithResult(_0x366c7a,null))[_0xbad1('0x48')](handleError(_0x366c7a,null));};exports[_0xbad1('0x25')]=function(_0x9c875f,_0x5d8152){return db[_0xbad1('0x30')][_0xbad1('0x4b')]({'where':{'id':_0x9c875f[_0xbad1('0x4a')]['id']}})[_0xbad1('0x24')](handleEntityNotFound(_0x5d8152,null))[_0xbad1('0x24')](removeEntity(_0x5d8152,null))['catch'](handleError(_0x5d8152,null));};
\ No newline at end of file
+var _0x71f7=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','rawAttributes','type','key','map','query','intersection','model','attributes'];(function(_0x574de7,_0x24ce60){var _0x568f46=function(_0x516004){while(--_0x516004){_0x574de7['push'](_0x574de7['shift']());}};_0x568f46(++_0x24ce60);}(_0x71f7,0x6a));var _0x771f=function(_0x3be286,_0x42a0f6){_0x3be286=_0x3be286-0x0;var _0x529393=_0x71f7[_0x3be286];return _0x529393;};'use strict';var emlformat=require(_0x771f('0x0'));var rimraf=require(_0x771f('0x1'));var zipdir=require(_0x771f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x771f('0x3'));var BPromise=require(_0x771f('0x4'));var Mustache=require(_0x771f('0x5'));var util=require(_0x771f('0x6'));var path=require(_0x771f('0x7'));var sox=require('sox');var csv=require(_0x771f('0x8'));var ejs=require(_0x771f('0x9'));var fs=require('fs');var fs_extra=require(_0x771f('0xa'));var _=require(_0x771f('0xb'));var squel=require(_0x771f('0xc'));var crypto=require(_0x771f('0xd'));var jsforce=require(_0x771f('0xe'));var deskjs=require(_0x771f('0xf'));var toCsv=require(_0x771f('0x8'));var querystring=require(_0x771f('0x10'));var Papa=require('papaparse');var Redis=require(_0x771f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x771f('0x12'));var hardwareService=require(_0x771f('0x13'));var logger=require('../../config/logger')(_0x771f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x771f('0x15'))['db'];function respondWithStatusCode(_0x5964b7,_0x1073b8){_0x1073b8=_0x1073b8||0xcc;return function(_0x14ac7d){if(_0x14ac7d){return _0x5964b7[_0x771f('0x16')](_0x1073b8);}return _0x5964b7[_0x771f('0x17')](_0x1073b8)[_0x771f('0x18')]();};}function respondWithResult(_0x4bbcae,_0x295dad){_0x295dad=_0x295dad||0xc8;return function(_0x33b371){if(_0x33b371){return _0x4bbcae[_0x771f('0x17')](_0x295dad)[_0x771f('0x19')](_0x33b371);}};}function respondWithFilteredResult(_0x4ca19e,_0x1aa0bc){return function(_0x36ecc3){if(_0x36ecc3){var _0x4c92bd=typeof _0x1aa0bc[_0x771f('0x1a')]===_0x771f('0x1b')&&typeof _0x1aa0bc['limit']===_0x771f('0x1b');var _0x1457b5=_0x36ecc3[_0x771f('0x1c')];var _0x10f061=_0x4c92bd?0x0:_0x1aa0bc['offset'];var _0x3996cc=_0x4c92bd?_0x36ecc3[_0x771f('0x1c')]:_0x1aa0bc[_0x771f('0x1a')]+_0x1aa0bc[_0x771f('0x1d')];var _0x21aaf5;if(_0x3996cc>=_0x1457b5){_0x3996cc=_0x1457b5;_0x21aaf5=0xc8;}else{_0x21aaf5=0xce;}_0x4ca19e[_0x771f('0x17')](_0x21aaf5);return _0x4ca19e['set'](_0x771f('0x1e'),_0x10f061+'-'+_0x3996cc+'/'+_0x1457b5)[_0x771f('0x19')](_0x36ecc3);}return null;};}function patchUpdates(_0x1bf45f){return function(_0x15deee){try{jsonpatch[_0x771f('0x1f')](_0x15deee,_0x1bf45f,!![]);}catch(_0x52e7f0){return BPromise['reject'](_0x52e7f0);}return _0x15deee[_0x771f('0x20')]();};}function saveUpdates(_0x14c5ee,_0x3f9f42){return function(_0x4ade73){if(_0x4ade73){return _0x4ade73[_0x771f('0x21')](_0x14c5ee)[_0x771f('0x22')](function(_0x1f2b47){return _0x1f2b47;});}return null;};}function removeEntity(_0x4a2b53,_0x416bd1){return function(_0xe03af5){if(_0xe03af5){return _0xe03af5['destroy']()[_0x771f('0x22')](function(){var _0x48e936=_0xe03af5[_0x771f('0x23')]({'plain':!![]});var _0x381d38=_0x771f('0x24');return db[_0x771f('0x25')][_0x771f('0x26')]({'where':{'type':_0x381d38,'resourceId':_0x48e936['id']}})[_0x771f('0x22')](function(){return _0xe03af5;});})[_0x771f('0x22')](function(){_0x4a2b53[_0x771f('0x17')](0xcc)[_0x771f('0x18')]();});}};}function handleEntityNotFound(_0x2e8d46,_0x74d370){return function(_0x30c94b){if(!_0x30c94b){_0x2e8d46[_0x771f('0x16')](0x194);}return _0x30c94b;};}function handleError(_0x8ded7b,_0x270cab){_0x270cab=_0x270cab||0x1f4;return function(_0x1c96e1){logger[_0x771f('0x27')](_0x1c96e1[_0x771f('0x28')]);if(_0x1c96e1[_0x771f('0x29')]){delete _0x1c96e1[_0x771f('0x29')];}_0x8ded7b['status'](_0x270cab)['send'](_0x1c96e1);};}exports['index']=function(_0x413572,_0x249f0f){var _0x4650a7={},_0x341c5d={},_0x1ed525={'count':0x0,'rows':[]};var _0xb58a5b=_['map'](db['Variable'][_0x771f('0x2a')],function(_0x2402a5){return{'name':_0x2402a5['fieldName'],'type':_0x2402a5[_0x771f('0x2b')][_0x771f('0x2c')]};});_0x341c5d['model']=_[_0x771f('0x2d')](_0xb58a5b,_0x771f('0x29'));_0x341c5d['query']=_['keys'](_0x413572[_0x771f('0x2e')]);_0x341c5d['filters']=_[_0x771f('0x2f')](_0x341c5d[_0x771f('0x30')],_0x341c5d[_0x771f('0x2e')]);_0x4650a7[_0x771f('0x31')]=_['intersection'](_0x341c5d[_0x771f('0x30')],qs[_0x771f('0x32')](_0x413572['query']['fields']));_0x4650a7[_0x771f('0x31')]=_0x4650a7[_0x771f('0x31')][_0x771f('0x33')]?_0x4650a7[_0x771f('0x31')]:_0x341c5d[_0x771f('0x30')];if(!_0x413572[_0x771f('0x2e')][_0x771f('0x34')](_0x771f('0x35'))){_0x4650a7['limit']=qs['limit'](_0x413572[_0x771f('0x2e')]['limit']);_0x4650a7[_0x771f('0x1a')]=qs[_0x771f('0x1a')](_0x413572[_0x771f('0x2e')][_0x771f('0x1a')]);}_0x4650a7[_0x771f('0x36')]=qs[_0x771f('0x37')](_0x413572[_0x771f('0x2e')][_0x771f('0x37')]);_0x4650a7[_0x771f('0x38')]=qs[_0x771f('0x39')](_['pick'](_0x413572[_0x771f('0x2e')],_0x341c5d['filters']),_0xb58a5b);if(_0x413572[_0x771f('0x2e')][_0x771f('0x3a')]){_0x4650a7['where']=_[_0x771f('0x3b')](_0x4650a7[_0x771f('0x38')],{'$or':_[_0x771f('0x2d')](_0xb58a5b,function(_0x2bfb3d){if(_0x2bfb3d[_0x771f('0x2b')]!==_0x771f('0x3c')){var _0x3963c5={};_0x3963c5[_0x2bfb3d[_0x771f('0x29')]]={'$like':'%'+_0x413572[_0x771f('0x2e')][_0x771f('0x3a')]+'%'};return _0x3963c5;}})});}_0x4650a7=_[_0x771f('0x3b')]({},_0x4650a7,_0x413572[_0x771f('0x3d')]);var _0x3323fe={'where':_0x4650a7[_0x771f('0x38')]};return db[_0x771f('0x3e')][_0x771f('0x1c')](_0x3323fe)[_0x771f('0x22')](function(_0x58e141){_0x1ed525['count']=_0x58e141;if(_0x413572['query'][_0x771f('0x3f')]){_0x4650a7[_0x771f('0x40')]=[{'all':!![]}];}return db[_0x771f('0x3e')][_0x771f('0x41')](_0x4650a7);})['then'](function(_0x4cfa99){_0x1ed525[_0x771f('0x42')]=_0x4cfa99;return _0x1ed525;})[_0x771f('0x22')](respondWithFilteredResult(_0x249f0f,_0x4650a7))[_0x771f('0x43')](handleError(_0x249f0f,null));};exports[_0x771f('0x44')]=function(_0x40bac3,_0x18d9c0){var _0x469b23={'raw':!![],'where':{'id':_0x40bac3[_0x771f('0x45')]['id']}},_0x2d5a66={};_0x2d5a66[_0x771f('0x30')]=_['keys'](db[_0x771f('0x3e')]['rawAttributes']);_0x2d5a66[_0x771f('0x2e')]=_['keys'](_0x40bac3[_0x771f('0x2e')]);_0x2d5a66[_0x771f('0x39')]=_['intersection'](_0x2d5a66['model'],_0x2d5a66[_0x771f('0x2e')]);_0x469b23[_0x771f('0x31')]=_[_0x771f('0x2f')](_0x2d5a66[_0x771f('0x30')],qs[_0x771f('0x32')](_0x40bac3['query'][_0x771f('0x32')]));_0x469b23['attributes']=_0x469b23['attributes']['length']?_0x469b23[_0x771f('0x31')]:_0x2d5a66[_0x771f('0x30')];if(_0x40bac3[_0x771f('0x2e')]['includeAll']){_0x469b23[_0x771f('0x40')]=[{'all':!![]}];}_0x469b23=_[_0x771f('0x3b')]({},_0x469b23,_0x40bac3['options']);return db[_0x771f('0x3e')][_0x771f('0x46')](_0x469b23)[_0x771f('0x22')](handleEntityNotFound(_0x18d9c0,null))[_0x771f('0x22')](respondWithResult(_0x18d9c0,null))[_0x771f('0x43')](handleError(_0x18d9c0,null));};exports['create']=function(_0x47f607,_0xdae94e){return db['Variable'][_0x771f('0x47')](_0x47f607[_0x771f('0x48')],{})[_0x771f('0x22')](function(_0x476847){var _0x12dd4f=_0x47f607[_0x771f('0x49')][_0x771f('0x23')]({'plain':!![]});if(!_0x12dd4f)throw new Error(_0x771f('0x4a'));if(_0x12dd4f[_0x771f('0x4b')]===_0x771f('0x49')){var _0x4bdb75=_0x476847[_0x771f('0x23')]({'plain':!![]});var _0x38cbe2=_0x771f('0x24');return db[_0x771f('0x4c')][_0x771f('0x46')]({'where':{'name':_0x38cbe2,'userProfileId':_0x12dd4f['userProfileId']},'raw':!![]})[_0x771f('0x22')](function(_0x51ffb0){if(_0x51ffb0&&_0x51ffb0[_0x771f('0x4d')]===0x0){return db['UserProfileResource'][_0x771f('0x47')]({'name':_0x4bdb75[_0x771f('0x29')],'resourceId':_0x4bdb75['id'],'type':_0x51ffb0[_0x771f('0x29')],'sectionId':_0x51ffb0['id']},{})[_0x771f('0x22')](function(){return _0x476847;});}else{return _0x476847;}})['catch'](function(_0x3f8c9e){logger[_0x771f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f8c9e);throw _0x3f8c9e;});}return _0x476847;})['then'](respondWithResult(_0xdae94e,0xc9))[_0x771f('0x43')](handleError(_0xdae94e,null));};exports[_0x771f('0x21')]=function(_0x556337,_0x19d52d){if(_0x556337[_0x771f('0x48')]['id']){delete _0x556337[_0x771f('0x48')]['id'];}return db[_0x771f('0x3e')][_0x771f('0x46')]({'where':{'id':_0x556337[_0x771f('0x45')]['id']}})[_0x771f('0x22')](handleEntityNotFound(_0x19d52d,null))['then'](saveUpdates(_0x556337[_0x771f('0x48')],null))[_0x771f('0x22')](respondWithResult(_0x19d52d,null))[_0x771f('0x43')](handleError(_0x19d52d,null));};exports['destroy']=function(_0x3e84b6,_0x1527a9){return db[_0x771f('0x3e')][_0x771f('0x46')]({'where':{'id':_0x3e84b6[_0x771f('0x45')]['id']}})['then'](handleEntityNotFound(_0x1527a9,null))[_0x771f('0x22')](removeEntity(_0x1527a9,null))[_0x771f('0x43')](handleError(_0x1527a9,null));};
\ No newline at end of file