Built motion from commit 936e8062.|2.5.33
[motion2.git] / server / api / variable / variable.controller.js
index 4c551db..3b823be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+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