Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / variable / variable.controller.js
index 19e91f6..5b5f0ec 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 _0xc2f5=['error','stack','name','Variable','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','nolimit','limit','order','sort','filter','where','merge','map','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','apply','reject','save','update','then','get','Variables','UserProfileResource'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0xc2f5,0x10f));var _0x5c2f=function(_0x37fbe7,_0x367180){_0x37fbe7=_0x37fbe7-0x0;var _0x158032=_0xc2f5[_0x37fbe7];return _0x158032;};'use strict';var emlformat=require(_0x5c2f('0x0'));var rimraf=require(_0x5c2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c2f('0x2'));var rp=require(_0x5c2f('0x3'));var moment=require(_0x5c2f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5c2f('0x5'));var path=require(_0x5c2f('0x6'));var sox=require('sox');var csv=require(_0x5c2f('0x7'));var ejs=require(_0x5c2f('0x8'));var fs=require('fs');var fs_extra=require(_0x5c2f('0x9'));var _=require(_0x5c2f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5c2f('0xb'));var deskjs=require(_0x5c2f('0xc'));var toCsv=require(_0x5c2f('0x7'));var querystring=require(_0x5c2f('0xd'));var Papa=require(_0x5c2f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c2f('0xf'));var as=require(_0x5c2f('0x10'));var hardwareService=require(_0x5c2f('0x11'));var logger=require(_0x5c2f('0x12'))(_0x5c2f('0x13'));var utils=require(_0x5c2f('0x14'));var config=require(_0x5c2f('0x15'));var licenseUtil=require(_0x5c2f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51e015,_0x45ebac){_0x45ebac=_0x45ebac||0xcc;return function(_0x12ffae){if(_0x12ffae){return _0x51e015[_0x5c2f('0x17')](_0x45ebac);}return _0x51e015[_0x5c2f('0x18')](_0x45ebac)[_0x5c2f('0x19')]();};}function respondWithResult(_0x49f97c,_0x1671a6){_0x1671a6=_0x1671a6||0xc8;return function(_0x1bcd97){if(_0x1bcd97){return _0x49f97c['status'](_0x1671a6)[_0x5c2f('0x1a')](_0x1bcd97);}};}function respondWithFilteredResult(_0x45e4d4,_0x5f50a6){return function(_0x4dffd1){if(_0x4dffd1){var _0x285b44=typeof _0x5f50a6[_0x5c2f('0x1b')]==='undefined'&&typeof _0x5f50a6['limit']==='undefined';var _0x1463f6=_0x4dffd1[_0x5c2f('0x1c')];var _0x28719c=_0x285b44?0x0:_0x5f50a6[_0x5c2f('0x1b')];var _0x51527f=_0x285b44?_0x4dffd1['count']:_0x5f50a6[_0x5c2f('0x1b')]+_0x5f50a6['limit'];var _0x30ecd6;if(_0x51527f>=_0x1463f6){_0x51527f=_0x1463f6;_0x30ecd6=0xc8;}else{_0x30ecd6=0xce;}_0x45e4d4[_0x5c2f('0x18')](_0x30ecd6);return _0x45e4d4['set']('Content-Range',_0x28719c+'-'+_0x51527f+'/'+_0x1463f6)['json'](_0x4dffd1);}return null;};}function patchUpdates(_0x3ce879){return function(_0xbcee77){try{jsonpatch[_0x5c2f('0x1d')](_0xbcee77,_0x3ce879,!![]);}catch(_0x22f07a){return BPromise[_0x5c2f('0x1e')](_0x22f07a);}return _0xbcee77[_0x5c2f('0x1f')]();};}function saveUpdates(_0x443e74,_0xcffc36){return function(_0x28b765){if(_0x28b765){return _0x28b765[_0x5c2f('0x20')](_0x443e74)[_0x5c2f('0x21')](function(_0x142f67){return _0x142f67;});}return null;};}function removeEntity(_0x2961cd,_0x438ca6){return function(_0x3d18d7){if(_0x3d18d7){return _0x3d18d7['destroy']()[_0x5c2f('0x21')](function(){var _0x144444=_0x3d18d7[_0x5c2f('0x22')]({'plain':!![]});var _0x3fa35c=_0x5c2f('0x23');return db[_0x5c2f('0x24')]['destroy']({'where':{'type':_0x3fa35c,'resourceId':_0x144444['id']}})[_0x5c2f('0x21')](function(){return _0x3d18d7;});})[_0x5c2f('0x21')](function(){_0x2961cd['status'](0xcc)[_0x5c2f('0x19')]();});}};}function handleEntityNotFound(_0x13d164,_0x8ca40){return function(_0x57dd52){if(!_0x57dd52){_0x13d164[_0x5c2f('0x17')](0x194);}return _0x57dd52;};}function handleError(_0x2532db,_0x14052d){_0x14052d=_0x14052d||0x1f4;return function(_0x2a10b6){logger[_0x5c2f('0x25')](_0x2a10b6[_0x5c2f('0x26')]);if(_0x2a10b6[_0x5c2f('0x27')]){delete _0x2a10b6[_0x5c2f('0x27')];}_0x2532db[_0x5c2f('0x18')](_0x14052d)['send'](_0x2a10b6);};}exports['index']=function(_0x42a3d6,_0x47b5ef){var _0x9319c8={},_0x5d735c={},_0x4a364a={'count':0x0,'rows':[]};var _0x48e7cd=_['map'](db[_0x5c2f('0x28')][_0x5c2f('0x29')],function(_0x27d8b9){return{'name':_0x27d8b9[_0x5c2f('0x2a')],'type':_0x27d8b9['type'][_0x5c2f('0x2b')]};});_0x5d735c[_0x5c2f('0x2c')]=_['map'](_0x48e7cd,_0x5c2f('0x27'));_0x5d735c[_0x5c2f('0x2d')]=_[_0x5c2f('0x2e')](_0x42a3d6[_0x5c2f('0x2d')]);_0x5d735c[_0x5c2f('0x2f')]=_['intersection'](_0x5d735c['model'],_0x5d735c[_0x5c2f('0x2d')]);_0x9319c8['attributes']=_['intersection'](_0x5d735c[_0x5c2f('0x2c')],qs[_0x5c2f('0x30')](_0x42a3d6[_0x5c2f('0x2d')]['fields']));_0x9319c8[_0x5c2f('0x31')]=_0x9319c8[_0x5c2f('0x31')]['length']?_0x9319c8[_0x5c2f('0x31')]:_0x5d735c[_0x5c2f('0x2c')];if(!_0x42a3d6[_0x5c2f('0x2d')]['hasOwnProperty'](_0x5c2f('0x32'))){_0x9319c8['limit']=qs[_0x5c2f('0x33')](_0x42a3d6[_0x5c2f('0x2d')][_0x5c2f('0x33')]);_0x9319c8[_0x5c2f('0x1b')]=qs[_0x5c2f('0x1b')](_0x42a3d6[_0x5c2f('0x2d')][_0x5c2f('0x1b')]);}_0x9319c8[_0x5c2f('0x34')]=qs[_0x5c2f('0x35')](_0x42a3d6[_0x5c2f('0x2d')][_0x5c2f('0x35')]);_0x9319c8['where']=qs[_0x5c2f('0x2f')](_['pick'](_0x42a3d6[_0x5c2f('0x2d')],_0x5d735c['filters']),_0x48e7cd);if(_0x42a3d6[_0x5c2f('0x2d')][_0x5c2f('0x36')]){_0x9319c8[_0x5c2f('0x37')]=_[_0x5c2f('0x38')](_0x9319c8[_0x5c2f('0x37')],{'$or':_[_0x5c2f('0x39')](_0x48e7cd,function(_0x58119e){if(_0x58119e['type']!==_0x5c2f('0x3a')){var _0x13924f={};_0x13924f[_0x58119e[_0x5c2f('0x27')]]={'$like':'%'+_0x42a3d6[_0x5c2f('0x2d')]['filter']+'%'};return _0x13924f;}})});}_0x9319c8=_[_0x5c2f('0x38')]({},_0x9319c8,_0x42a3d6[_0x5c2f('0x3b')]);var _0x12abaf={'where':_0x9319c8['where']};return db['Variable']['count'](_0x12abaf)['then'](function(_0xa3ced6){_0x4a364a['count']=_0xa3ced6;if(_0x42a3d6['query'][_0x5c2f('0x3c')]){_0x9319c8['include']=[{'all':!![]}];}return db[_0x5c2f('0x28')]['findAll'](_0x9319c8);})[_0x5c2f('0x21')](function(_0x5c1dce){_0x4a364a[_0x5c2f('0x3d')]=_0x5c1dce;return _0x4a364a;})[_0x5c2f('0x21')](respondWithFilteredResult(_0x47b5ef,_0x9319c8))[_0x5c2f('0x3e')](handleError(_0x47b5ef,null));};exports[_0x5c2f('0x3f')]=function(_0x571cbb,_0x589a12){var _0x56ce8c={'raw':!![],'where':{'id':_0x571cbb[_0x5c2f('0x40')]['id']}},_0x51307e={};_0x51307e['model']=_[_0x5c2f('0x2e')](db['Variable'][_0x5c2f('0x29')]);_0x51307e['query']=_[_0x5c2f('0x2e')](_0x571cbb[_0x5c2f('0x2d')]);_0x51307e[_0x5c2f('0x2f')]=_[_0x5c2f('0x41')](_0x51307e[_0x5c2f('0x2c')],_0x51307e['query']);_0x56ce8c[_0x5c2f('0x31')]=_[_0x5c2f('0x41')](_0x51307e[_0x5c2f('0x2c')],qs[_0x5c2f('0x30')](_0x571cbb[_0x5c2f('0x2d')][_0x5c2f('0x30')]));_0x56ce8c[_0x5c2f('0x31')]=_0x56ce8c['attributes'][_0x5c2f('0x42')]?_0x56ce8c['attributes']:_0x51307e[_0x5c2f('0x2c')];if(_0x571cbb[_0x5c2f('0x2d')]['includeAll']){_0x56ce8c[_0x5c2f('0x43')]=[{'all':!![]}];}_0x56ce8c=_[_0x5c2f('0x38')]({},_0x56ce8c,_0x571cbb['options']);return db[_0x5c2f('0x28')]['find'](_0x56ce8c)[_0x5c2f('0x21')](handleEntityNotFound(_0x589a12,null))[_0x5c2f('0x21')](respondWithResult(_0x589a12,null))[_0x5c2f('0x3e')](handleError(_0x589a12,null));};exports[_0x5c2f('0x44')]=function(_0x106e00,_0x40af3d){return db[_0x5c2f('0x28')]['create'](_0x106e00['body'],{})[_0x5c2f('0x21')](function(_0x48a67f){var _0xc3c2eb=_0x106e00[_0x5c2f('0x45')][_0x5c2f('0x22')]({'plain':!![]});if(!_0xc3c2eb)throw new Error(_0x5c2f('0x46'));if(_0xc3c2eb['role']===_0x5c2f('0x45')){var _0x1c960d=_0x48a67f[_0x5c2f('0x22')]({'plain':!![]});var _0x430fed=_0x5c2f('0x23');return db[_0x5c2f('0x47')][_0x5c2f('0x48')]({'where':{'name':_0x430fed,'userProfileId':_0xc3c2eb['userProfileId']},'raw':!![]})['then'](function(_0x1bc589){if(_0x1bc589&&_0x1bc589[_0x5c2f('0x49')]===0x0){return db[_0x5c2f('0x24')][_0x5c2f('0x44')]({'name':_0x1c960d['name'],'resourceId':_0x1c960d['id'],'type':_0x1bc589[_0x5c2f('0x27')],'sectionId':_0x1bc589['id']},{})[_0x5c2f('0x21')](function(){return _0x48a67f;});}else{return _0x48a67f;}})[_0x5c2f('0x3e')](function(_0x57a6d0){logger[_0x5c2f('0x25')](_0x5c2f('0x4a'),_0x57a6d0);throw _0x57a6d0;});}return _0x48a67f;})['then'](respondWithResult(_0x40af3d,0xc9))[_0x5c2f('0x3e')](handleError(_0x40af3d,null));};exports[_0x5c2f('0x20')]=function(_0x2fda16,_0x31d698){if(_0x2fda16['body']['id']){delete _0x2fda16[_0x5c2f('0x4b')]['id'];}return db[_0x5c2f('0x28')][_0x5c2f('0x48')]({'where':{'id':_0x2fda16[_0x5c2f('0x40')]['id']}})[_0x5c2f('0x21')](handleEntityNotFound(_0x31d698,null))['then'](saveUpdates(_0x2fda16[_0x5c2f('0x4b')],null))[_0x5c2f('0x21')](respondWithResult(_0x31d698,null))[_0x5c2f('0x3e')](handleError(_0x31d698,null));};exports[_0x5c2f('0x4c')]=function(_0x38a7ec,_0x24bb8c){return db[_0x5c2f('0x28')][_0x5c2f('0x48')]({'where':{'id':_0x38a7ec['params']['id']}})[_0x5c2f('0x21')](handleEntityNotFound(_0x24bb8c,null))['then'](removeEntity(_0x24bb8c,null))[_0x5c2f('0x3e')](handleError(_0x24bb8c,null));};
\ No newline at end of file