Built motion from commit 936e8062.|2.5.33
[motion2.git] / server / api / variable / variable.controller.js
index 19e91f6..3b823be 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 _0x34bb=['body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','Variable','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','include','findAll','rows','params','rawAttributes','includeAll','options','find','create'];(function(_0x37395f,_0x9abb58){var _0x5913c6=function(_0xe5f4e){while(--_0xe5f4e){_0x37395f['push'](_0x37395f['shift']());}};_0x5913c6(++_0x9abb58);}(_0x34bb,0x14f));var _0xb34b=function(_0xf8760a,_0x3bc7c9){_0xf8760a=_0xf8760a-0x0;var _0xbaaa00=_0x34bb[_0xf8760a];return _0xbaaa00;};'use strict';var emlformat=require(_0xb34b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb34b('0x1'));var jsonpatch=require(_0xb34b('0x2'));var rp=require(_0xb34b('0x3'));var moment=require(_0xb34b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb34b('0x5'));var util=require('util');var path=require(_0xb34b('0x6'));var sox=require(_0xb34b('0x7'));var csv=require(_0xb34b('0x8'));var ejs=require(_0xb34b('0x9'));var fs=require('fs');var fs_extra=require(_0xb34b('0xa'));var _=require('lodash');var squel=require(_0xb34b('0xb'));var crypto=require(_0xb34b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb34b('0xd'));var toCsv=require(_0xb34b('0x8'));var querystring=require(_0xb34b('0xe'));var Papa=require(_0xb34b('0xf'));var Redis=require('ioredis');var authService=require(_0xb34b('0x10'));var qs=require(_0xb34b('0x11'));var as=require(_0xb34b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb34b('0x13'));var utils=require(_0xb34b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb34b('0x15'));var db=require(_0xb34b('0x16'))['db'];function respondWithStatusCode(_0x1d18e7,_0x5a6079){_0x5a6079=_0x5a6079||0xcc;return function(_0x2cb5cf){if(_0x2cb5cf){return _0x1d18e7['sendStatus'](_0x5a6079);}return _0x1d18e7[_0xb34b('0x17')](_0x5a6079)[_0xb34b('0x18')]();};}function respondWithResult(_0x208357,_0x17b3b9){_0x17b3b9=_0x17b3b9||0xc8;return function(_0x2b3056){if(_0x2b3056){return _0x208357[_0xb34b('0x17')](_0x17b3b9)[_0xb34b('0x19')](_0x2b3056);}};}function respondWithFilteredResult(_0xfd466,_0x3d1b65){return function(_0x1a7876){if(_0x1a7876){var _0x14dc2b=typeof _0x3d1b65[_0xb34b('0x1a')]===_0xb34b('0x1b')&&typeof _0x3d1b65[_0xb34b('0x1c')]==='undefined';var _0x45d406=_0x1a7876[_0xb34b('0x1d')];var _0x14e0a0=_0x14dc2b?0x0:_0x3d1b65['offset'];var _0x2cca6c=_0x14dc2b?_0x1a7876[_0xb34b('0x1d')]:_0x3d1b65[_0xb34b('0x1a')]+_0x3d1b65[_0xb34b('0x1c')];var _0xcf918;if(_0x2cca6c>=_0x45d406){_0x2cca6c=_0x45d406;_0xcf918=0xc8;}else{_0xcf918=0xce;}_0xfd466[_0xb34b('0x17')](_0xcf918);return _0xfd466[_0xb34b('0x1e')](_0xb34b('0x1f'),_0x14e0a0+'-'+_0x2cca6c+'/'+_0x45d406)['json'](_0x1a7876);}return null;};}function patchUpdates(_0x2d6582){return function(_0x447239){try{jsonpatch[_0xb34b('0x20')](_0x447239,_0x2d6582,!![]);}catch(_0x1df761){return BPromise[_0xb34b('0x21')](_0x1df761);}return _0x447239[_0xb34b('0x22')]();};}function saveUpdates(_0x55515d,_0x1a5521){return function(_0x371ba5){if(_0x371ba5){return _0x371ba5[_0xb34b('0x23')](_0x55515d)[_0xb34b('0x24')](function(_0x253fe7){return _0x253fe7;});}return null;};}function removeEntity(_0x277f17,_0x27fcd2){return function(_0x4a8e79){if(_0x4a8e79){return _0x4a8e79[_0xb34b('0x25')]()[_0xb34b('0x24')](function(){var _0x5b0b85=_0x4a8e79[_0xb34b('0x26')]({'plain':!![]});var _0x5f1868=_0xb34b('0x27');return db[_0xb34b('0x28')]['destroy']({'where':{'type':_0x5f1868,'resourceId':_0x5b0b85['id']}})['then'](function(){return _0x4a8e79;});})[_0xb34b('0x24')](function(){_0x277f17[_0xb34b('0x17')](0xcc)[_0xb34b('0x18')]();});}};}function handleEntityNotFound(_0x3d8696,_0x39104f){return function(_0xd450a5){if(!_0xd450a5){_0x3d8696[_0xb34b('0x29')](0x194);}return _0xd450a5;};}function handleError(_0x58b92b,_0x208d80){_0x208d80=_0x208d80||0x1f4;return function(_0xa10972){logger[_0xb34b('0x2a')](_0xa10972[_0xb34b('0x2b')]);if(_0xa10972[_0xb34b('0x2c')]){delete _0xa10972[_0xb34b('0x2c')];}_0x58b92b[_0xb34b('0x17')](_0x208d80)[_0xb34b('0x2d')](_0xa10972);};}exports[_0xb34b('0x2e')]=function(_0x24b182,_0x55af6d){var _0x25fa7d={},_0x1c8803={},_0x1ba6e0={'count':0x0,'rows':[]};var _0x589909=_['map'](db[_0xb34b('0x2f')]['rawAttributes'],function(_0x2cb626){return{'name':_0x2cb626[_0xb34b('0x30')],'type':_0x2cb626[_0xb34b('0x31')]['key']};});_0x1c8803[_0xb34b('0x32')]=_[_0xb34b('0x33')](_0x589909,_0xb34b('0x2c'));_0x1c8803[_0xb34b('0x34')]=_[_0xb34b('0x35')](_0x24b182['query']);_0x1c8803[_0xb34b('0x36')]=_[_0xb34b('0x37')](_0x1c8803['model'],_0x1c8803[_0xb34b('0x34')]);_0x25fa7d['attributes']=_[_0xb34b('0x37')](_0x1c8803[_0xb34b('0x32')],qs[_0xb34b('0x38')](_0x24b182[_0xb34b('0x34')][_0xb34b('0x38')]));_0x25fa7d[_0xb34b('0x39')]=_0x25fa7d[_0xb34b('0x39')][_0xb34b('0x3a')]?_0x25fa7d['attributes']:_0x1c8803['model'];if(!_0x24b182[_0xb34b('0x34')][_0xb34b('0x3b')]('nolimit')){_0x25fa7d['limit']=qs['limit'](_0x24b182[_0xb34b('0x34')][_0xb34b('0x1c')]);_0x25fa7d['offset']=qs[_0xb34b('0x1a')](_0x24b182[_0xb34b('0x34')][_0xb34b('0x1a')]);}_0x25fa7d[_0xb34b('0x3c')]=qs[_0xb34b('0x3d')](_0x24b182[_0xb34b('0x34')]['sort']);_0x25fa7d['where']=qs[_0xb34b('0x36')](_['pick'](_0x24b182[_0xb34b('0x34')],_0x1c8803['filters']),_0x589909);if(_0x24b182[_0xb34b('0x34')][_0xb34b('0x3e')]){_0x25fa7d['where']=_[_0xb34b('0x3f')](_0x25fa7d[_0xb34b('0x40')],{'$or':_[_0xb34b('0x33')](_0x589909,function(_0x2c6efe){if(_0x2c6efe['type']!==_0xb34b('0x41')){var _0x54aa3a={};_0x54aa3a[_0x2c6efe[_0xb34b('0x2c')]]={'$like':'%'+_0x24b182[_0xb34b('0x34')]['filter']+'%'};return _0x54aa3a;}})});}_0x25fa7d=_['merge']({},_0x25fa7d,_0x24b182['options']);var _0x2e44d9={'where':_0x25fa7d[_0xb34b('0x40')]};return db[_0xb34b('0x2f')][_0xb34b('0x1d')](_0x2e44d9)['then'](function(_0x18003a){_0x1ba6e0[_0xb34b('0x1d')]=_0x18003a;if(_0x24b182[_0xb34b('0x34')]['includeAll']){_0x25fa7d[_0xb34b('0x42')]=[{'all':!![]}];}return db[_0xb34b('0x2f')][_0xb34b('0x43')](_0x25fa7d);})[_0xb34b('0x24')](function(_0x398301){_0x1ba6e0[_0xb34b('0x44')]=_0x398301;return _0x1ba6e0;})['then'](respondWithFilteredResult(_0x55af6d,_0x25fa7d))['catch'](handleError(_0x55af6d,null));};exports['show']=function(_0x168443,_0x10c85c){var _0x5bdef2={'raw':!![],'where':{'id':_0x168443[_0xb34b('0x45')]['id']}},_0x5298a1={};_0x5298a1[_0xb34b('0x32')]=_[_0xb34b('0x35')](db[_0xb34b('0x2f')][_0xb34b('0x46')]);_0x5298a1[_0xb34b('0x34')]=_[_0xb34b('0x35')](_0x168443[_0xb34b('0x34')]);_0x5298a1[_0xb34b('0x36')]=_[_0xb34b('0x37')](_0x5298a1[_0xb34b('0x32')],_0x5298a1[_0xb34b('0x34')]);_0x5bdef2[_0xb34b('0x39')]=_['intersection'](_0x5298a1[_0xb34b('0x32')],qs[_0xb34b('0x38')](_0x168443[_0xb34b('0x34')]['fields']));_0x5bdef2[_0xb34b('0x39')]=_0x5bdef2[_0xb34b('0x39')][_0xb34b('0x3a')]?_0x5bdef2['attributes']:_0x5298a1[_0xb34b('0x32')];if(_0x168443[_0xb34b('0x34')][_0xb34b('0x47')]){_0x5bdef2['include']=[{'all':!![]}];}_0x5bdef2=_[_0xb34b('0x3f')]({},_0x5bdef2,_0x168443[_0xb34b('0x48')]);return db[_0xb34b('0x2f')][_0xb34b('0x49')](_0x5bdef2)[_0xb34b('0x24')](handleEntityNotFound(_0x10c85c,null))['then'](respondWithResult(_0x10c85c,null))['catch'](handleError(_0x10c85c,null));};exports['create']=function(_0x3f232b,_0x254a3b){return db[_0xb34b('0x2f')][_0xb34b('0x4a')](_0x3f232b[_0xb34b('0x4b')],{})[_0xb34b('0x24')](function(_0x917249){var _0x472d57=_0x3f232b[_0xb34b('0x4c')]['get']({'plain':!![]});if(!_0x472d57)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x472d57[_0xb34b('0x4d')]==='user'){var _0x57cf7e=_0x917249['get']({'plain':!![]});var _0x27e49e=_0xb34b('0x27');return db[_0xb34b('0x4e')][_0xb34b('0x49')]({'where':{'name':_0x27e49e,'userProfileId':_0x472d57['userProfileId']},'raw':!![]})['then'](function(_0x17df90){if(_0x17df90&&_0x17df90[_0xb34b('0x4f')]===0x0){return db[_0xb34b('0x28')][_0xb34b('0x4a')]({'name':_0x57cf7e['name'],'resourceId':_0x57cf7e['id'],'type':_0x17df90[_0xb34b('0x2c')],'sectionId':_0x17df90['id']},{})[_0xb34b('0x24')](function(){return _0x917249;});}else{return _0x917249;}})['catch'](function(_0x2b1041){logger[_0xb34b('0x2a')](_0xb34b('0x50'),_0x2b1041);throw _0x2b1041;});}return _0x917249;})[_0xb34b('0x24')](respondWithResult(_0x254a3b,0xc9))[_0xb34b('0x51')](handleError(_0x254a3b,null));};exports[_0xb34b('0x23')]=function(_0x5e43cf,_0x4d153b){if(_0x5e43cf[_0xb34b('0x4b')]['id']){delete _0x5e43cf['body']['id'];}return db[_0xb34b('0x2f')][_0xb34b('0x49')]({'where':{'id':_0x5e43cf['params']['id']}})[_0xb34b('0x24')](handleEntityNotFound(_0x4d153b,null))['then'](saveUpdates(_0x5e43cf[_0xb34b('0x4b')],null))[_0xb34b('0x24')](respondWithResult(_0x4d153b,null))[_0xb34b('0x51')](handleError(_0x4d153b,null));};exports['destroy']=function(_0x565848,_0x4b5081){return db[_0xb34b('0x2f')]['find']({'where':{'id':_0x565848[_0xb34b('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b5081,null))[_0xb34b('0x24')](removeEntity(_0x4b5081,null))[_0xb34b('0x51')](handleError(_0x4b5081,null));};
\ No newline at end of file