Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / variable / variable.controller.js
index 19e91f6..af34340 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x462f=['send','index','map','Variable','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Variables','UserProfileResource','destroy','then','error','stack','name'];(function(_0x122481,_0x4ab9ec){var _0x8f8026=function(_0x146f26){while(--_0x146f26){_0x122481['push'](_0x122481['shift']());}};_0x8f8026(++_0x4ab9ec);}(_0x462f,0x1d7));var _0xf462=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x462f[_0x188a93];return _0x23b40d;};'use strict';var pdf=require(_0xf462('0x0'));var emlformat=require(_0xf462('0x1'));var rimraf=require(_0xf462('0x2'));var zipdir=require(_0xf462('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf462('0x4'));var moment=require(_0xf462('0x5'));var BPromise=require(_0xf462('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf462('0x7'));var sox=require(_0xf462('0x8'));var csv=require(_0xf462('0x9'));var ejs=require(_0xf462('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf462('0xb'));var crypto=require(_0xf462('0xc'));var jsforce=require(_0xf462('0xd'));var deskjs=require(_0xf462('0xe'));var toCsv=require(_0xf462('0x9'));var querystring=require(_0xf462('0xf'));var Papa=require(_0xf462('0x10'));var Redis=require('ioredis');var authService=require(_0xf462('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf462('0x12'));var hardwareService=require(_0xf462('0x13'));var logger=require(_0xf462('0x14'))(_0xf462('0x15'));var utils=require(_0xf462('0x16'));var config=require(_0xf462('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17653c,_0x230d84){_0x230d84=_0x230d84||0xcc;return function(_0x2b8b18){if(_0x2b8b18){return _0x17653c[_0xf462('0x18')](_0x230d84);}return _0x17653c[_0xf462('0x19')](_0x230d84)[_0xf462('0x1a')]();};}function respondWithResult(_0x218da6,_0x5e4360){_0x5e4360=_0x5e4360||0xc8;return function(_0x18705f){if(_0x18705f){return _0x218da6[_0xf462('0x19')](_0x5e4360)[_0xf462('0x1b')](_0x18705f);}};}function respondWithFilteredResult(_0x57796d,_0x5e270d){return function(_0xdafe28){if(_0xdafe28){var _0x364f97=_0xdafe28[_0xf462('0x1c')],_0x539987=_0x5e270d[_0xf462('0x1d')],_0x3de162=_0x5e270d[_0xf462('0x1d')]+_0x5e270d[_0xf462('0x1e')],_0x3f1496;if(_0x3de162>=_0x364f97){_0x3de162=_0x364f97;_0x3f1496=0xc8;}else{_0x3f1496=0xce;}_0x57796d[_0xf462('0x19')](_0x3f1496);return _0x57796d[_0xf462('0x1f')](_0xf462('0x20'),_0x539987+'-'+_0x3de162+'/'+_0x364f97)[_0xf462('0x1b')](_0xdafe28);}return null;};}function patchUpdates(_0x2de176){return function(_0x5a0fa9){try{jsonpatch[_0xf462('0x21')](_0x5a0fa9,_0x2de176,!![]);}catch(_0x5ce136){return BPromise[_0xf462('0x22')](_0x5ce136);}return _0x5a0fa9[_0xf462('0x23')]();};}function saveUpdates(_0x49367c,_0x2b8394){return function(_0x3afd17){if(_0x3afd17){return _0x3afd17[_0xf462('0x24')](_0x49367c)['then'](function(_0x4a9345){return _0x4a9345;});}return null;};}function removeEntity(_0x39439c,_0x1c1a18){return function(_0xdda554){if(_0xdda554){return _0xdda554['destroy']()['then'](function(){var _0x3853b9=_0xdda554[_0xf462('0x25')]({'plain':!![]});var _0x297d42=_0xf462('0x26');return db[_0xf462('0x27')][_0xf462('0x28')]({'where':{'type':_0x297d42,'resourceId':_0x3853b9['id']}})[_0xf462('0x29')](function(){return _0xdda554;});})[_0xf462('0x29')](function(){_0x39439c[_0xf462('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d9d18,_0x2494ec){return function(_0x4c37f2){if(!_0x4c37f2){_0x1d9d18[_0xf462('0x18')](0x194);}return _0x4c37f2;};}function handleError(_0x40c436,_0x111083){_0x111083=_0x111083||0x1f4;return function(_0x267669){logger[_0xf462('0x2a')](_0x267669[_0xf462('0x2b')]);if(_0x267669[_0xf462('0x2c')]){delete _0x267669[_0xf462('0x2c')];}_0x40c436[_0xf462('0x19')](_0x111083)[_0xf462('0x2d')](_0x267669);};}exports[_0xf462('0x2e')]=function(_0x519637,_0x3b0d25){var _0x18bc27={},_0x46e4dd={},_0x57e098={'count':0x0,'rows':[]};var _0x39a575=_[_0xf462('0x2f')](db[_0xf462('0x30')][_0xf462('0x31')],function(_0xb49c5a){return{'name':_0xb49c5a['fieldName'],'type':_0xb49c5a[_0xf462('0x32')][_0xf462('0x33')]};});_0x46e4dd[_0xf462('0x34')]=_[_0xf462('0x2f')](_0x39a575,_0xf462('0x2c'));_0x46e4dd['query']=_[_0xf462('0x35')](_0x519637[_0xf462('0x36')]);_0x46e4dd[_0xf462('0x37')]=_[_0xf462('0x38')](_0x46e4dd[_0xf462('0x34')],_0x46e4dd[_0xf462('0x36')]);_0x18bc27['attributes']=_[_0xf462('0x38')](_0x46e4dd[_0xf462('0x34')],qs[_0xf462('0x39')](_0x519637[_0xf462('0x36')]['fields']));_0x18bc27[_0xf462('0x3a')]=_0x18bc27[_0xf462('0x3a')]['length']?_0x18bc27['attributes']:_0x46e4dd[_0xf462('0x34')];if(!_0x519637[_0xf462('0x36')][_0xf462('0x3b')](_0xf462('0x3c'))){_0x18bc27['limit']=qs['limit'](_0x519637[_0xf462('0x36')]['limit']);_0x18bc27[_0xf462('0x1d')]=qs[_0xf462('0x1d')](_0x519637[_0xf462('0x36')][_0xf462('0x1d')]);}_0x18bc27[_0xf462('0x3d')]=qs[_0xf462('0x3e')](_0x519637[_0xf462('0x36')][_0xf462('0x3e')]);_0x18bc27[_0xf462('0x3f')]=qs[_0xf462('0x37')](_[_0xf462('0x40')](_0x519637[_0xf462('0x36')],_0x46e4dd[_0xf462('0x37')]),_0x39a575);if(_0x519637['query']['filter']){_0x18bc27['where']=_['merge'](_0x18bc27[_0xf462('0x3f')],{'$or':_[_0xf462('0x2f')](_0x39a575,function(_0x482135){if(_0x482135[_0xf462('0x32')]!==_0xf462('0x41')){var _0x3fb2ab={};_0x3fb2ab[_0x482135['name']]={'$like':'%'+_0x519637['query'][_0xf462('0x42')]+'%'};return _0x3fb2ab;}})});}_0x18bc27=_[_0xf462('0x43')]({},_0x18bc27,_0x519637[_0xf462('0x44')]);var _0x36483e={'where':_0x18bc27['where']};return db[_0xf462('0x30')][_0xf462('0x1c')](_0x36483e)[_0xf462('0x29')](function(_0x3c8e1b){_0x57e098['count']=_0x3c8e1b;if(_0x519637[_0xf462('0x36')][_0xf462('0x45')]){_0x18bc27[_0xf462('0x46')]=[{'all':!![]}];}return db[_0xf462('0x30')][_0xf462('0x47')](_0x18bc27);})[_0xf462('0x29')](function(_0x3beb7d){_0x57e098[_0xf462('0x48')]=_0x3beb7d;return _0x57e098;})['then'](respondWithFilteredResult(_0x3b0d25,_0x18bc27))[_0xf462('0x49')](handleError(_0x3b0d25,null));};exports[_0xf462('0x4a')]=function(_0x364537,_0x8a3636){var _0x277596={'raw':!![],'where':{'id':_0x364537[_0xf462('0x4b')]['id']}},_0x57e628={};_0x57e628[_0xf462('0x34')]=_[_0xf462('0x35')](db[_0xf462('0x30')][_0xf462('0x31')]);_0x57e628['query']=_['keys'](_0x364537[_0xf462('0x36')]);_0x57e628[_0xf462('0x37')]=_[_0xf462('0x38')](_0x57e628[_0xf462('0x34')],_0x57e628[_0xf462('0x36')]);_0x277596[_0xf462('0x3a')]=_[_0xf462('0x38')](_0x57e628[_0xf462('0x34')],qs[_0xf462('0x39')](_0x364537[_0xf462('0x36')][_0xf462('0x39')]));_0x277596[_0xf462('0x3a')]=_0x277596[_0xf462('0x3a')][_0xf462('0x4c')]?_0x277596[_0xf462('0x3a')]:_0x57e628[_0xf462('0x34')];if(_0x364537[_0xf462('0x36')][_0xf462('0x45')]){_0x277596[_0xf462('0x46')]=[{'all':!![]}];}_0x277596=_[_0xf462('0x43')]({},_0x277596,_0x364537[_0xf462('0x44')]);return db['Variable'][_0xf462('0x4d')](_0x277596)['then'](handleEntityNotFound(_0x8a3636,null))[_0xf462('0x29')](respondWithResult(_0x8a3636,null))[_0xf462('0x49')](handleError(_0x8a3636,null));};exports['create']=function(_0x3c720e,_0x3516ff){return db[_0xf462('0x30')][_0xf462('0x4e')](_0x3c720e[_0xf462('0x4f')],{})[_0xf462('0x29')](function(_0x36de6f){var _0x33bbce=_0x3c720e['user'][_0xf462('0x25')]({'plain':!![]});if(!_0x33bbce)throw new Error(_0xf462('0x50'));if(_0x33bbce[_0xf462('0x51')]===_0xf462('0x52')){var _0x96dac1=_0x36de6f[_0xf462('0x25')]({'plain':!![]});var _0x3ce44b=_0xf462('0x26');return db[_0xf462('0x53')][_0xf462('0x4d')]({'where':{'name':_0x3ce44b,'userProfileId':_0x33bbce['userProfileId']},'raw':!![]})[_0xf462('0x29')](function(_0x52766b){if(_0x52766b&&_0x52766b[_0xf462('0x54')]===0x0){return db[_0xf462('0x27')]['create']({'name':_0x96dac1['name'],'resourceId':_0x96dac1['id'],'type':_0x52766b[_0xf462('0x2c')],'sectionId':_0x52766b['id']},{})['then'](function(){return _0x36de6f;});}else{return _0x36de6f;}})[_0xf462('0x49')](function(_0x38e5dd){logger[_0xf462('0x2a')](_0xf462('0x55'),_0x38e5dd);throw _0x38e5dd;});}return _0x36de6f;})[_0xf462('0x29')](respondWithResult(_0x3516ff,0xc9))[_0xf462('0x49')](handleError(_0x3516ff,null));};exports[_0xf462('0x24')]=function(_0x4096ff,_0x672555){if(_0x4096ff['body']['id']){delete _0x4096ff[_0xf462('0x4f')]['id'];}return db['Variable'][_0xf462('0x4d')]({'where':{'id':_0x4096ff['params']['id']}})['then'](handleEntityNotFound(_0x672555,null))[_0xf462('0x29')](saveUpdates(_0x4096ff[_0xf462('0x4f')],null))['then'](respondWithResult(_0x672555,null))[_0xf462('0x49')](handleError(_0x672555,null));};exports[_0xf462('0x28')]=function(_0x2ff315,_0x433271){return db[_0xf462('0x30')][_0xf462('0x4d')]({'where':{'id':_0x2ff315[_0xf462('0x4b')]['id']}})[_0xf462('0x29')](handleEntityNotFound(_0x433271,null))[_0xf462('0x29')](removeEntity(_0x433271,null))[_0xf462('0x49')](handleError(_0x433271,null));};
\ No newline at end of file
+var _0x8181=['filter','merge','VIRTUAL','includeAll','show','include','find','catch','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x5eb370,_0x2f1ce3){var _0x5dbcbd=function(_0x266c10){while(--_0x266c10){_0x5eb370['push'](_0x5eb370['shift']());}};_0x5dbcbd(++_0x2f1ce3);}(_0x8181,0x1af));var _0x1818=function(_0xe249f0,_0x59b2a4){_0xe249f0=_0xe249f0-0x0;var _0x5a69ca=_0x8181[_0xe249f0];return _0x5a69ca;};'use strict';var emlformat=require(_0x1818('0x0'));var rimraf=require(_0x1818('0x1'));var zipdir=require(_0x1818('0x2'));var jsonpatch=require(_0x1818('0x3'));var rp=require(_0x1818('0x4'));var moment=require(_0x1818('0x5'));var BPromise=require(_0x1818('0x6'));var Mustache=require('mustache');var util=require(_0x1818('0x7'));var path=require(_0x1818('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1818('0x9'));var fs=require('fs');var fs_extra=require(_0x1818('0xa'));var _=require(_0x1818('0xb'));var squel=require('squel');var crypto=require(_0x1818('0xc'));var jsforce=require(_0x1818('0xd'));var deskjs=require(_0x1818('0xe'));var toCsv=require(_0x1818('0xf'));var querystring=require(_0x1818('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1818('0x11'));var qs=require(_0x1818('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1818('0x13'));var logger=require(_0x1818('0x14'))('api');var utils=require(_0x1818('0x15'));var config=require(_0x1818('0x16'));var licenseUtil=require(_0x1818('0x17'));var db=require(_0x1818('0x18'))['db'];function respondWithStatusCode(_0x1dabd1,_0x51238f){_0x51238f=_0x51238f||0xcc;return function(_0x13d901){if(_0x13d901){return _0x1dabd1[_0x1818('0x19')](_0x51238f);}return _0x1dabd1['status'](_0x51238f)[_0x1818('0x1a')]();};}function respondWithResult(_0x3c2f93,_0x3ebb15){_0x3ebb15=_0x3ebb15||0xc8;return function(_0x5820e3){if(_0x5820e3){return _0x3c2f93[_0x1818('0x1b')](_0x3ebb15)[_0x1818('0x1c')](_0x5820e3);}};}function respondWithFilteredResult(_0x41235f,_0x2b3da9){return function(_0x2f58be){if(_0x2f58be){var _0x128e97=typeof _0x2b3da9['offset']===_0x1818('0x1d')&&typeof _0x2b3da9['limit']===_0x1818('0x1d');var _0x2f7bc5=_0x2f58be[_0x1818('0x1e')];var _0x413bf0=_0x128e97?0x0:_0x2b3da9[_0x1818('0x1f')];var _0x47b10b=_0x128e97?_0x2f58be[_0x1818('0x1e')]:_0x2b3da9[_0x1818('0x1f')]+_0x2b3da9['limit'];var _0x339bda;if(_0x47b10b>=_0x2f7bc5){_0x47b10b=_0x2f7bc5;_0x339bda=0xc8;}else{_0x339bda=0xce;}_0x41235f[_0x1818('0x1b')](_0x339bda);return _0x41235f[_0x1818('0x20')](_0x1818('0x21'),_0x413bf0+'-'+_0x47b10b+'/'+_0x2f7bc5)['json'](_0x2f58be);}return null;};}function patchUpdates(_0x57a91a){return function(_0x7ef4af){try{jsonpatch[_0x1818('0x22')](_0x7ef4af,_0x57a91a,!![]);}catch(_0x4dc821){return BPromise['reject'](_0x4dc821);}return _0x7ef4af[_0x1818('0x23')]();};}function saveUpdates(_0x57d11c,_0x26d07f){return function(_0x303dbb){if(_0x303dbb){return _0x303dbb[_0x1818('0x24')](_0x57d11c)[_0x1818('0x25')](function(_0x2366cd){return _0x2366cd;});}return null;};}function removeEntity(_0x51452b,_0x12179e){return function(_0x368cfb){if(_0x368cfb){return _0x368cfb[_0x1818('0x26')]()[_0x1818('0x25')](function(){var _0x35ef4e=_0x368cfb[_0x1818('0x27')]({'plain':!![]});var _0x18b51a=_0x1818('0x28');return db[_0x1818('0x29')][_0x1818('0x26')]({'where':{'type':_0x18b51a,'resourceId':_0x35ef4e['id']}})[_0x1818('0x25')](function(){return _0x368cfb;});})['then'](function(){_0x51452b['status'](0xcc)[_0x1818('0x1a')]();});}};}function handleEntityNotFound(_0x5221a8,_0x59bf9c){return function(_0x2af2a2){if(!_0x2af2a2){_0x5221a8[_0x1818('0x19')](0x194);}return _0x2af2a2;};}function handleError(_0x57e3d3,_0x291bff){_0x291bff=_0x291bff||0x1f4;return function(_0x26b025){logger[_0x1818('0x2a')](_0x26b025[_0x1818('0x2b')]);if(_0x26b025['name']){delete _0x26b025[_0x1818('0x2c')];}_0x57e3d3[_0x1818('0x1b')](_0x291bff)[_0x1818('0x2d')](_0x26b025);};}exports[_0x1818('0x2e')]=function(_0x3eefb0,_0x900683){var _0x3535b9={},_0x24864a={},_0x50209c={'count':0x0,'rows':[]};var _0x1fe234=_[_0x1818('0x2f')](db[_0x1818('0x30')][_0x1818('0x31')],function(_0x58384e){return{'name':_0x58384e[_0x1818('0x32')],'type':_0x58384e[_0x1818('0x33')][_0x1818('0x34')]};});_0x24864a['model']=_[_0x1818('0x2f')](_0x1fe234,_0x1818('0x2c'));_0x24864a[_0x1818('0x35')]=_[_0x1818('0x36')](_0x3eefb0[_0x1818('0x35')]);_0x24864a[_0x1818('0x37')]=_[_0x1818('0x38')](_0x24864a['model'],_0x24864a['query']);_0x3535b9['attributes']=_['intersection'](_0x24864a[_0x1818('0x39')],qs[_0x1818('0x3a')](_0x3eefb0['query'][_0x1818('0x3a')]));_0x3535b9[_0x1818('0x3b')]=_0x3535b9['attributes'][_0x1818('0x3c')]?_0x3535b9['attributes']:_0x24864a[_0x1818('0x39')];if(!_0x3eefb0['query'][_0x1818('0x3d')](_0x1818('0x3e'))){_0x3535b9['limit']=qs[_0x1818('0x3f')](_0x3eefb0[_0x1818('0x35')][_0x1818('0x3f')]);_0x3535b9['offset']=qs[_0x1818('0x1f')](_0x3eefb0[_0x1818('0x35')][_0x1818('0x1f')]);}_0x3535b9['order']=qs[_0x1818('0x40')](_0x3eefb0[_0x1818('0x35')][_0x1818('0x40')]);_0x3535b9[_0x1818('0x41')]=qs[_0x1818('0x37')](_[_0x1818('0x42')](_0x3eefb0[_0x1818('0x35')],_0x24864a[_0x1818('0x37')]),_0x1fe234);if(_0x3eefb0[_0x1818('0x35')][_0x1818('0x43')]){_0x3535b9['where']=_[_0x1818('0x44')](_0x3535b9[_0x1818('0x41')],{'$or':_[_0x1818('0x2f')](_0x1fe234,function(_0x1a75e7){if(_0x1a75e7[_0x1818('0x33')]!==_0x1818('0x45')){var _0x2a4deb={};_0x2a4deb[_0x1a75e7[_0x1818('0x2c')]]={'$like':'%'+_0x3eefb0[_0x1818('0x35')][_0x1818('0x43')]+'%'};return _0x2a4deb;}})});}_0x3535b9=_[_0x1818('0x44')]({},_0x3535b9,_0x3eefb0['options']);var _0x4cc483={'where':_0x3535b9[_0x1818('0x41')]};return db[_0x1818('0x30')][_0x1818('0x1e')](_0x4cc483)[_0x1818('0x25')](function(_0x3510ca){_0x50209c['count']=_0x3510ca;if(_0x3eefb0[_0x1818('0x35')][_0x1818('0x46')]){_0x3535b9['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x3535b9);})[_0x1818('0x25')](function(_0x38d327){_0x50209c['rows']=_0x38d327;return _0x50209c;})['then'](respondWithFilteredResult(_0x900683,_0x3535b9))['catch'](handleError(_0x900683,null));};exports[_0x1818('0x47')]=function(_0x2990d2,_0x3bb338){var _0x9875bc={'raw':!![],'where':{'id':_0x2990d2['params']['id']}},_0x4015ac={};_0x4015ac['model']=_[_0x1818('0x36')](db[_0x1818('0x30')]['rawAttributes']);_0x4015ac['query']=_['keys'](_0x2990d2[_0x1818('0x35')]);_0x4015ac[_0x1818('0x37')]=_[_0x1818('0x38')](_0x4015ac[_0x1818('0x39')],_0x4015ac['query']);_0x9875bc[_0x1818('0x3b')]=_[_0x1818('0x38')](_0x4015ac[_0x1818('0x39')],qs[_0x1818('0x3a')](_0x2990d2[_0x1818('0x35')][_0x1818('0x3a')]));_0x9875bc[_0x1818('0x3b')]=_0x9875bc['attributes'][_0x1818('0x3c')]?_0x9875bc[_0x1818('0x3b')]:_0x4015ac[_0x1818('0x39')];if(_0x2990d2[_0x1818('0x35')][_0x1818('0x46')]){_0x9875bc[_0x1818('0x48')]=[{'all':!![]}];}_0x9875bc=_[_0x1818('0x44')]({},_0x9875bc,_0x2990d2['options']);return db[_0x1818('0x30')][_0x1818('0x49')](_0x9875bc)['then'](handleEntityNotFound(_0x3bb338,null))[_0x1818('0x25')](respondWithResult(_0x3bb338,null))[_0x1818('0x4a')](handleError(_0x3bb338,null));};exports['create']=function(_0x47bc2a,_0x20e51b){return db[_0x1818('0x30')][_0x1818('0x4b')](_0x47bc2a['body'],{})[_0x1818('0x25')](function(_0x590168){var _0x73263a=_0x47bc2a[_0x1818('0x4c')]['get']({'plain':!![]});if(!_0x73263a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x73263a[_0x1818('0x4d')]===_0x1818('0x4c')){var _0x252ba9=_0x590168[_0x1818('0x27')]({'plain':!![]});var _0x26c3fe='Variables';return db[_0x1818('0x4e')][_0x1818('0x49')]({'where':{'name':_0x26c3fe,'userProfileId':_0x73263a['userProfileId']},'raw':!![]})['then'](function(_0x17f717){if(_0x17f717&&_0x17f717[_0x1818('0x4f')]===0x0){return db['UserProfileResource'][_0x1818('0x4b')]({'name':_0x252ba9['name'],'resourceId':_0x252ba9['id'],'type':_0x17f717[_0x1818('0x2c')],'sectionId':_0x17f717['id']},{})[_0x1818('0x25')](function(){return _0x590168;});}else{return _0x590168;}})[_0x1818('0x4a')](function(_0x535356){logger[_0x1818('0x2a')](_0x1818('0x50'),_0x535356);throw _0x535356;});}return _0x590168;})[_0x1818('0x25')](respondWithResult(_0x20e51b,0xc9))['catch'](handleError(_0x20e51b,null));};exports[_0x1818('0x24')]=function(_0x22aaab,_0x52db89){if(_0x22aaab[_0x1818('0x51')]['id']){delete _0x22aaab['body']['id'];}return db[_0x1818('0x30')][_0x1818('0x49')]({'where':{'id':_0x22aaab[_0x1818('0x52')]['id']}})[_0x1818('0x25')](handleEntityNotFound(_0x52db89,null))[_0x1818('0x25')](saveUpdates(_0x22aaab[_0x1818('0x51')],null))[_0x1818('0x25')](respondWithResult(_0x52db89,null))[_0x1818('0x4a')](handleError(_0x52db89,null));};exports[_0x1818('0x26')]=function(_0x412b50,_0x516ccf){return db[_0x1818('0x30')]['find']({'where':{'id':_0x412b50['params']['id']}})['then'](handleEntityNotFound(_0x516ccf,null))[_0x1818('0x25')](removeEntity(_0x516ccf,null))[_0x1818('0x4a')](handleError(_0x516ccf,null));};
\ No newline at end of file