Built motion from commit 775e2a94.|2.6.3
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index bc4853b..5c455f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x346f=['merge','VIRTUAL','options','count','include','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','ODBC','destroy','stack','name','send','index','map','SquareOdbc','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x346f,0xd1));var _0xf346=function(_0x8481e,_0x591803){_0x8481e=_0x8481e-0x0;var _0x2e7a8d=_0x346f[_0x8481e];return _0x2e7a8d;};'use strict';var pdf=require(_0xf346('0x0'));var emlformat=require(_0xf346('0x1'));var rimraf=require(_0xf346('0x2'));var zipdir=require(_0xf346('0x3'));var jsonpatch=require(_0xf346('0x4'));var rp=require(_0xf346('0x5'));var moment=require('moment');var BPromise=require(_0xf346('0x6'));var Mustache=require(_0xf346('0x7'));var util=require(_0xf346('0x8'));var path=require(_0xf346('0x9'));var sox=require(_0xf346('0xa'));var csv=require(_0xf346('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf346('0xc'));var squel=require(_0xf346('0xd'));var crypto=require(_0xf346('0xe'));var jsforce=require(_0xf346('0xf'));var deskjs=require(_0xf346('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf346('0x11'));var Papa=require(_0xf346('0x12'));var Redis=require(_0xf346('0x13'));var authService=require(_0xf346('0x14'));var qs=require(_0xf346('0x15'));var as=require(_0xf346('0x16'));var hardwareService=require(_0xf346('0x17'));var logger=require(_0xf346('0x18'))(_0xf346('0x19'));var utils=require(_0xf346('0x1a'));var config=require(_0xf346('0x1b'));var db=require(_0xf346('0x1c'))['db'];function respondWithStatusCode(_0x105c47,_0x4525a4){_0x4525a4=_0x4525a4||0xcc;return function(_0x267fb8){if(_0x267fb8){return _0x105c47[_0xf346('0x1d')](_0x4525a4);}return _0x105c47['status'](_0x4525a4)[_0xf346('0x1e')]();};}function respondWithResult(_0x49dc31,_0x8800e3){_0x8800e3=_0x8800e3||0xc8;return function(_0x5007c4){if(_0x5007c4){return _0x49dc31[_0xf346('0x1f')](_0x8800e3)['json'](_0x5007c4);}};}function respondWithFilteredResult(_0x37e426,_0x186d09){return function(_0x493185){if(_0x493185){var _0x3f7b39=_0x493185['count'],_0xce0ffd=_0x186d09[_0xf346('0x20')],_0x4a1a45=_0x186d09['offset']+_0x186d09[_0xf346('0x21')],_0x1a2732;if(_0x4a1a45>=_0x3f7b39){_0x4a1a45=_0x3f7b39;_0x1a2732=0xc8;}else{_0x1a2732=0xce;}_0x37e426[_0xf346('0x1f')](_0x1a2732);return _0x37e426[_0xf346('0x22')](_0xf346('0x23'),_0xce0ffd+'-'+_0x4a1a45+'/'+_0x3f7b39)[_0xf346('0x24')](_0x493185);}return null;};}function patchUpdates(_0x4fb38c){return function(_0x26288e){try{jsonpatch[_0xf346('0x25')](_0x26288e,_0x4fb38c,!![]);}catch(_0x3a86da){return BPromise[_0xf346('0x26')](_0x3a86da);}return _0x26288e[_0xf346('0x27')]();};}function saveUpdates(_0x5dd33e,_0x1cc17e){return function(_0x30e769){if(_0x30e769){return _0x30e769[_0xf346('0x28')](_0x5dd33e)[_0xf346('0x29')](function(_0x84b57d){return _0x84b57d;});}return null;};}function removeEntity(_0xee7f8c,_0x159b88){return function(_0x46789a){if(_0x46789a){return _0x46789a['destroy']()[_0xf346('0x29')](function(){var _0x39d067=_0x46789a[_0xf346('0x2a')]({'plain':!![]});var _0x5adb3f=_0xf346('0x2b');return db['UserProfileResource'][_0xf346('0x2c')]({'where':{'type':_0x5adb3f,'resourceId':_0x39d067['id']}})['then'](function(){return _0x46789a;});})[_0xf346('0x29')](function(){_0xee7f8c[_0xf346('0x1f')](0xcc)[_0xf346('0x1e')]();});}};}function handleEntityNotFound(_0x3fea8d,_0x181c53){return function(_0x336bba){if(!_0x336bba){_0x3fea8d[_0xf346('0x1d')](0x194);}return _0x336bba;};}function handleError(_0x3a63a5,_0x46c3fe){_0x46c3fe=_0x46c3fe||0x1f4;return function(_0xe86fc7){logger['error'](_0xe86fc7[_0xf346('0x2d')]);if(_0xe86fc7[_0xf346('0x2e')]){delete _0xe86fc7[_0xf346('0x2e')];}_0x3a63a5[_0xf346('0x1f')](_0x46c3fe)[_0xf346('0x2f')](_0xe86fc7);};}exports[_0xf346('0x30')]=function(_0x51c159,_0x3dfccb){var _0x3f5251={},_0x43a01b={},_0xdd5396={'count':0x0,'rows':[]};var _0x57eec0=_[_0xf346('0x31')](db[_0xf346('0x32')]['rawAttributes'],function(_0x2a0146){return{'name':_0x2a0146[_0xf346('0x33')],'type':_0x2a0146[_0xf346('0x34')]['key']};});_0x43a01b[_0xf346('0x35')]=_['map'](_0x57eec0,_0xf346('0x2e'));_0x43a01b['query']=_[_0xf346('0x36')](_0x51c159[_0xf346('0x37')]);_0x43a01b['filters']=_['intersection'](_0x43a01b[_0xf346('0x35')],_0x43a01b[_0xf346('0x37')]);_0x3f5251[_0xf346('0x38')]=_[_0xf346('0x39')](_0x43a01b['model'],qs[_0xf346('0x3a')](_0x51c159[_0xf346('0x37')][_0xf346('0x3a')]));_0x3f5251[_0xf346('0x38')]=_0x3f5251[_0xf346('0x38')][_0xf346('0x3b')]?_0x3f5251['attributes']:_0x43a01b[_0xf346('0x35')];if(!_0x51c159[_0xf346('0x37')][_0xf346('0x3c')]('nolimit')){_0x3f5251[_0xf346('0x21')]=qs[_0xf346('0x21')](_0x51c159['query'][_0xf346('0x21')]);_0x3f5251[_0xf346('0x20')]=qs[_0xf346('0x20')](_0x51c159[_0xf346('0x37')][_0xf346('0x20')]);}_0x3f5251[_0xf346('0x3d')]=qs[_0xf346('0x3e')](_0x51c159['query'][_0xf346('0x3e')]);_0x3f5251[_0xf346('0x3f')]=qs[_0xf346('0x40')](_[_0xf346('0x41')](_0x51c159[_0xf346('0x37')],_0x43a01b[_0xf346('0x40')]));if(_0x51c159['query'][_0xf346('0x42')]){_0x3f5251[_0xf346('0x3f')]=_[_0xf346('0x43')](_0x3f5251[_0xf346('0x3f')],{'$or':_['map'](_0x57eec0,function(_0x5329d2){if(_0x5329d2['type']!==_0xf346('0x44')){var _0x36217e={};_0x36217e[_0x5329d2[_0xf346('0x2e')]]={'$like':'%'+_0x51c159[_0xf346('0x37')][_0xf346('0x42')]+'%'};return _0x36217e;}})});}_0x3f5251=_['merge']({},_0x3f5251,_0x51c159[_0xf346('0x45')]);var _0x318e09={'where':_0x3f5251['where']};return db[_0xf346('0x32')][_0xf346('0x46')](_0x318e09)[_0xf346('0x29')](function(_0x281b29){_0xdd5396[_0xf346('0x46')]=_0x281b29;if(_0x51c159[_0xf346('0x37')]['includeAll']){_0x3f5251[_0xf346('0x47')]=[{'all':!![]}];}return db[_0xf346('0x32')]['findAll'](_0x3f5251);})[_0xf346('0x29')](function(_0x430eec){_0xdd5396['rows']=_0x430eec;return _0xdd5396;})[_0xf346('0x29')](respondWithFilteredResult(_0x3dfccb,_0x3f5251))[_0xf346('0x48')](handleError(_0x3dfccb,null));};exports[_0xf346('0x49')]=function(_0x565ef7,_0x462bbb){var _0x468a0a={'raw':!![],'where':{'id':_0x565ef7[_0xf346('0x4a')]['id']}},_0x283cc5={};_0x283cc5[_0xf346('0x35')]=_[_0xf346('0x36')](db[_0xf346('0x32')]['rawAttributes']);_0x283cc5[_0xf346('0x37')]=_[_0xf346('0x36')](_0x565ef7['query']);_0x283cc5[_0xf346('0x40')]=_[_0xf346('0x39')](_0x283cc5[_0xf346('0x35')],_0x283cc5['query']);_0x468a0a[_0xf346('0x38')]=_[_0xf346('0x39')](_0x283cc5[_0xf346('0x35')],qs['fields'](_0x565ef7[_0xf346('0x37')][_0xf346('0x3a')]));_0x468a0a[_0xf346('0x38')]=_0x468a0a[_0xf346('0x38')][_0xf346('0x3b')]?_0x468a0a['attributes']:_0x283cc5[_0xf346('0x35')];if(_0x565ef7[_0xf346('0x37')][_0xf346('0x4b')]){_0x468a0a[_0xf346('0x47')]=[{'all':!![]}];}_0x468a0a=_['merge']({},_0x468a0a,_0x565ef7[_0xf346('0x45')]);return db[_0xf346('0x32')]['find'](_0x468a0a)[_0xf346('0x29')](handleEntityNotFound(_0x462bbb,null))[_0xf346('0x29')](respondWithResult(_0x462bbb,null))[_0xf346('0x48')](handleError(_0x462bbb,null));};exports[_0xf346('0x4c')]=function(_0x28d6fa,_0x4e0442){return db[_0xf346('0x32')][_0xf346('0x4c')](_0x28d6fa[_0xf346('0x4d')],{})[_0xf346('0x29')](function(_0x3685a5){var _0x361f07=_0x28d6fa[_0xf346('0x4e')][_0xf346('0x2a')]({'plain':!![]});if(!_0x361f07)throw new Error(_0xf346('0x4f'));if(_0x361f07[_0xf346('0x50')]===_0xf346('0x4e')){var _0x4af475=_0x3685a5[_0xf346('0x2a')]({'plain':!![]});var _0x52fb17='ODBC';return db[_0xf346('0x51')]['find']({'where':{'name':_0x52fb17,'userProfileId':_0x361f07[_0xf346('0x52')]},'raw':!![]})[_0xf346('0x29')](function(_0x4a50c4){if(_0x4a50c4&&_0x4a50c4[_0xf346('0x53')]===0x0){return db[_0xf346('0x54')][_0xf346('0x4c')]({'name':_0x4af475['name'],'resourceId':_0x4af475['id'],'type':_0x4a50c4[_0xf346('0x2e')],'sectionId':_0x4a50c4['id']},{})[_0xf346('0x29')](function(){return _0x3685a5;});}else{return _0x3685a5;}})[_0xf346('0x48')](function(_0x38b4b1){logger[_0xf346('0x55')](_0xf346('0x56'),_0x38b4b1);throw _0x38b4b1;});}return _0x3685a5;})['then'](respondWithResult(_0x4e0442,0xc9))[_0xf346('0x48')](handleError(_0x4e0442,null));};exports['update']=function(_0x3753b0,_0x96d2f9){if(_0x3753b0[_0xf346('0x4d')]['id']){delete _0x3753b0[_0xf346('0x4d')]['id'];}return db[_0xf346('0x32')][_0xf346('0x57')]({'where':{'id':_0x3753b0[_0xf346('0x4a')]['id']}})[_0xf346('0x29')](handleEntityNotFound(_0x96d2f9,null))[_0xf346('0x29')](saveUpdates(_0x3753b0[_0xf346('0x4d')],null))[_0xf346('0x29')](respondWithResult(_0x96d2f9,null))[_0xf346('0x48')](handleError(_0x96d2f9,null));};exports[_0xf346('0x2c')]=function(_0x48c87b,_0x58492d){return db[_0xf346('0x32')][_0xf346('0x57')]({'where':{'id':_0x48c87b['params']['id']}})[_0xf346('0x29')](handleEntityNotFound(_0x58492d,null))[_0xf346('0x29')](removeEntity(_0x58492d,null))[_0xf346('0x48')](handleError(_0x58492d,null));};exports['test']=function(_0x3de72e,_0x3b1b25,_0x443fd4){var _0x5a940e;return db[_0xf346('0x32')][_0xf346('0x57')]({'where':{'id':_0x3de72e[_0xf346('0x4a')]['id']},'attributes':['id',_0xf346('0x58')]})[_0xf346('0x29')](handleEntityNotFound(_0x3b1b25,null))[_0xf346('0x29')](function(_0x5485c1){if(_0x5485c1){var _0xf0fcb0=require(_0xf346('0x59'))();_0xf0fcb0[_0xf346('0x5a')](_0x5485c1[_0xf346('0x58')]);_0xf0fcb0[_0xf346('0x5b')]();return _0x5485c1;}})[_0xf346('0x29')](respondWithResult(_0x3b1b25,null))['catch'](handleError(_0x3b1b25,null));};
\ No newline at end of file
+var _0xc202=['order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','openSync','dsn','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','name','send','index','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xc202,0x126));var _0x2c20=function(_0x2dd16b,_0x2afbbf){_0x2dd16b=_0x2dd16b-0x0;var _0x456d44=_0xc202[_0x2dd16b];return _0x456d44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c20('0x0'));var zipdir=require(_0x2c20('0x1'));var jsonpatch=require(_0x2c20('0x2'));var rp=require(_0x2c20('0x3'));var moment=require(_0x2c20('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c20('0x5'));var path=require('path');var sox=require(_0x2c20('0x6'));var csv=require(_0x2c20('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c20('0x8'));var _=require(_0x2c20('0x9'));var squel=require(_0x2c20('0xa'));var crypto=require(_0x2c20('0xb'));var jsforce=require(_0x2c20('0xc'));var deskjs=require(_0x2c20('0xd'));var toCsv=require(_0x2c20('0x7'));var querystring=require(_0x2c20('0xe'));var Papa=require(_0x2c20('0xf'));var Redis=require(_0x2c20('0x10'));var authService=require(_0x2c20('0x11'));var qs=require(_0x2c20('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c20('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c20('0x14'));var db=require(_0x2c20('0x15'))['db'];function respondWithStatusCode(_0x1bfbaa,_0x4dc561){_0x4dc561=_0x4dc561||0xcc;return function(_0x1f4007){if(_0x1f4007){return _0x1bfbaa[_0x2c20('0x16')](_0x4dc561);}return _0x1bfbaa[_0x2c20('0x17')](_0x4dc561)[_0x2c20('0x18')]();};}function respondWithResult(_0x5bed76,_0x565fbe){_0x565fbe=_0x565fbe||0xc8;return function(_0x4adb14){if(_0x4adb14){return _0x5bed76['status'](_0x565fbe)[_0x2c20('0x19')](_0x4adb14);}};}function respondWithFilteredResult(_0x178154,_0x29d09e){return function(_0xef11f0){if(_0xef11f0){var _0x1149f3=typeof _0x29d09e[_0x2c20('0x1a')]==='undefined'&&typeof _0x29d09e[_0x2c20('0x1b')]===_0x2c20('0x1c');var _0x2977bc=_0xef11f0[_0x2c20('0x1d')];var _0x15cf3e=_0x1149f3?0x0:_0x29d09e[_0x2c20('0x1a')];var _0x18f2bf=_0x1149f3?_0xef11f0[_0x2c20('0x1d')]:_0x29d09e['offset']+_0x29d09e['limit'];var _0x1e67de;if(_0x18f2bf>=_0x2977bc){_0x18f2bf=_0x2977bc;_0x1e67de=0xc8;}else{_0x1e67de=0xce;}_0x178154['status'](_0x1e67de);return _0x178154[_0x2c20('0x1e')](_0x2c20('0x1f'),_0x15cf3e+'-'+_0x18f2bf+'/'+_0x2977bc)[_0x2c20('0x19')](_0xef11f0);}return null;};}function patchUpdates(_0x258f23){return function(_0x7edd7){try{jsonpatch[_0x2c20('0x20')](_0x7edd7,_0x258f23,!![]);}catch(_0x2ea6aa){return BPromise[_0x2c20('0x21')](_0x2ea6aa);}return _0x7edd7[_0x2c20('0x22')]();};}function saveUpdates(_0x53e58e,_0x483ab6){return function(_0x511959){if(_0x511959){return _0x511959[_0x2c20('0x23')](_0x53e58e)[_0x2c20('0x24')](function(_0x434425){return _0x434425;});}return null;};}function removeEntity(_0x3639ed,_0x5e68d){return function(_0x464dc9){if(_0x464dc9){return _0x464dc9[_0x2c20('0x25')]()[_0x2c20('0x24')](function(){var _0x32177c=_0x464dc9[_0x2c20('0x26')]({'plain':!![]});var _0x3e7453=_0x2c20('0x27');return db[_0x2c20('0x28')][_0x2c20('0x25')]({'where':{'type':_0x3e7453,'resourceId':_0x32177c['id']}})['then'](function(){return _0x464dc9;});})[_0x2c20('0x24')](function(){_0x3639ed[_0x2c20('0x17')](0xcc)[_0x2c20('0x18')]();});}};}function handleEntityNotFound(_0xa51e24,_0x3cf044){return function(_0x2318b8){if(!_0x2318b8){_0xa51e24['sendStatus'](0x194);}return _0x2318b8;};}function handleError(_0x7074ac,_0x533c6f){_0x533c6f=_0x533c6f||0x1f4;return function(_0x295d74){logger['error'](_0x295d74['stack']);if(_0x295d74['name']){delete _0x295d74[_0x2c20('0x29')];}_0x7074ac[_0x2c20('0x17')](_0x533c6f)[_0x2c20('0x2a')](_0x295d74);};}exports[_0x2c20('0x2b')]=function(_0x44b49c,_0x736050){var _0x3b42fe={},_0x33cf23={},_0x1bc52c={'count':0x0,'rows':[]};var _0x2212d6=_['map'](db[_0x2c20('0x2c')][_0x2c20('0x2d')],function(_0x21c2e0){return{'name':_0x21c2e0[_0x2c20('0x2e')],'type':_0x21c2e0['type'][_0x2c20('0x2f')]};});_0x33cf23[_0x2c20('0x30')]=_['map'](_0x2212d6,_0x2c20('0x29'));_0x33cf23[_0x2c20('0x31')]=_[_0x2c20('0x32')](_0x44b49c[_0x2c20('0x31')]);_0x33cf23[_0x2c20('0x33')]=_['intersection'](_0x33cf23[_0x2c20('0x30')],_0x33cf23[_0x2c20('0x31')]);_0x3b42fe[_0x2c20('0x34')]=_[_0x2c20('0x35')](_0x33cf23[_0x2c20('0x30')],qs[_0x2c20('0x36')](_0x44b49c['query'][_0x2c20('0x36')]));_0x3b42fe[_0x2c20('0x34')]=_0x3b42fe['attributes'][_0x2c20('0x37')]?_0x3b42fe['attributes']:_0x33cf23['model'];if(!_0x44b49c['query'][_0x2c20('0x38')](_0x2c20('0x39'))){_0x3b42fe[_0x2c20('0x1b')]=qs['limit'](_0x44b49c[_0x2c20('0x31')][_0x2c20('0x1b')]);_0x3b42fe[_0x2c20('0x1a')]=qs[_0x2c20('0x1a')](_0x44b49c[_0x2c20('0x31')][_0x2c20('0x1a')]);}_0x3b42fe[_0x2c20('0x3a')]=qs[_0x2c20('0x3b')](_0x44b49c[_0x2c20('0x31')][_0x2c20('0x3b')]);_0x3b42fe[_0x2c20('0x3c')]=qs[_0x2c20('0x33')](_['pick'](_0x44b49c[_0x2c20('0x31')],_0x33cf23['filters']),_0x2212d6);if(_0x44b49c[_0x2c20('0x31')][_0x2c20('0x3d')]){_0x3b42fe[_0x2c20('0x3c')]=_[_0x2c20('0x3e')](_0x3b42fe['where'],{'$or':_['map'](_0x2212d6,function(_0x5b8d32){if(_0x5b8d32['type']!==_0x2c20('0x3f')){var _0x47abf4={};_0x47abf4[_0x5b8d32[_0x2c20('0x29')]]={'$like':'%'+_0x44b49c['query'][_0x2c20('0x3d')]+'%'};return _0x47abf4;}})});}_0x3b42fe=_[_0x2c20('0x3e')]({},_0x3b42fe,_0x44b49c['options']);var _0x5eff67={'where':_0x3b42fe[_0x2c20('0x3c')]};return db[_0x2c20('0x2c')][_0x2c20('0x1d')](_0x5eff67)['then'](function(_0x51345c){_0x1bc52c[_0x2c20('0x1d')]=_0x51345c;if(_0x44b49c[_0x2c20('0x31')][_0x2c20('0x40')]){_0x3b42fe[_0x2c20('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0x2c20('0x42')](_0x3b42fe);})[_0x2c20('0x24')](function(_0x2ba6d4){_0x1bc52c[_0x2c20('0x43')]=_0x2ba6d4;return _0x1bc52c;})[_0x2c20('0x24')](respondWithFilteredResult(_0x736050,_0x3b42fe))[_0x2c20('0x44')](handleError(_0x736050,null));};exports[_0x2c20('0x45')]=function(_0x13012b,_0x3af5c5){var _0x243eaf={'raw':!![],'where':{'id':_0x13012b[_0x2c20('0x46')]['id']}},_0x1019aa={};_0x1019aa[_0x2c20('0x30')]=_[_0x2c20('0x32')](db[_0x2c20('0x2c')][_0x2c20('0x2d')]);_0x1019aa[_0x2c20('0x31')]=_[_0x2c20('0x32')](_0x13012b[_0x2c20('0x31')]);_0x1019aa[_0x2c20('0x33')]=_[_0x2c20('0x35')](_0x1019aa[_0x2c20('0x30')],_0x1019aa['query']);_0x243eaf[_0x2c20('0x34')]=_['intersection'](_0x1019aa[_0x2c20('0x30')],qs[_0x2c20('0x36')](_0x13012b[_0x2c20('0x31')][_0x2c20('0x36')]));_0x243eaf['attributes']=_0x243eaf[_0x2c20('0x34')][_0x2c20('0x37')]?_0x243eaf[_0x2c20('0x34')]:_0x1019aa[_0x2c20('0x30')];if(_0x13012b['query'][_0x2c20('0x40')]){_0x243eaf[_0x2c20('0x41')]=[{'all':!![]}];}_0x243eaf=_[_0x2c20('0x3e')]({},_0x243eaf,_0x13012b[_0x2c20('0x47')]);return db[_0x2c20('0x2c')][_0x2c20('0x48')](_0x243eaf)[_0x2c20('0x24')](handleEntityNotFound(_0x3af5c5,null))[_0x2c20('0x24')](respondWithResult(_0x3af5c5,null))[_0x2c20('0x44')](handleError(_0x3af5c5,null));};exports[_0x2c20('0x49')]=function(_0x1f8706,_0x1f0373){return db[_0x2c20('0x2c')][_0x2c20('0x49')](_0x1f8706['body'],{})[_0x2c20('0x24')](function(_0x354e84){var _0x48d02c=_0x1f8706[_0x2c20('0x4a')][_0x2c20('0x26')]({'plain':!![]});if(!_0x48d02c)throw new Error(_0x2c20('0x4b'));if(_0x48d02c[_0x2c20('0x4c')]===_0x2c20('0x4a')){var _0x2478ff=_0x354e84[_0x2c20('0x26')]({'plain':!![]});var _0xa20931=_0x2c20('0x27');return db[_0x2c20('0x4d')]['find']({'where':{'name':_0xa20931,'userProfileId':_0x48d02c[_0x2c20('0x4e')]},'raw':!![]})[_0x2c20('0x24')](function(_0x5768cd){if(_0x5768cd&&_0x5768cd[_0x2c20('0x4f')]===0x0){return db['UserProfileResource'][_0x2c20('0x49')]({'name':_0x2478ff[_0x2c20('0x29')],'resourceId':_0x2478ff['id'],'type':_0x5768cd[_0x2c20('0x29')],'sectionId':_0x5768cd['id']},{})[_0x2c20('0x24')](function(){return _0x354e84;});}else{return _0x354e84;}})[_0x2c20('0x44')](function(_0x788832){logger[_0x2c20('0x50')](_0x2c20('0x51'),_0x788832);throw _0x788832;});}return _0x354e84;})[_0x2c20('0x24')](respondWithResult(_0x1f0373,0xc9))[_0x2c20('0x44')](handleError(_0x1f0373,null));};exports['update']=function(_0x4f34d7,_0x54be70){if(_0x4f34d7['body']['id']){delete _0x4f34d7['body']['id'];}return db[_0x2c20('0x2c')][_0x2c20('0x48')]({'where':{'id':_0x4f34d7['params']['id']}})['then'](handleEntityNotFound(_0x54be70,null))[_0x2c20('0x24')](saveUpdates(_0x4f34d7[_0x2c20('0x52')],null))[_0x2c20('0x24')](respondWithResult(_0x54be70,null))[_0x2c20('0x44')](handleError(_0x54be70,null));};exports[_0x2c20('0x25')]=function(_0x28d439,_0x8934ba){return db[_0x2c20('0x2c')][_0x2c20('0x48')]({'where':{'id':_0x28d439[_0x2c20('0x46')]['id']}})[_0x2c20('0x24')](handleEntityNotFound(_0x8934ba,null))['then'](removeEntity(_0x8934ba,null))['catch'](handleError(_0x8934ba,null));};exports[_0x2c20('0x53')]=function(_0x4f67e6,_0xc5bb8,_0x413976){var _0x4479e2;return db[_0x2c20('0x2c')][_0x2c20('0x48')]({'where':{'id':_0x4f67e6[_0x2c20('0x46')]['id']},'attributes':['id','dsn']})[_0x2c20('0x24')](handleEntityNotFound(_0xc5bb8,null))[_0x2c20('0x24')](function(_0x3cce93){if(_0x3cce93){var _0x5347f2=require(_0x2c20('0x54'))();_0x5347f2[_0x2c20('0x55')](_0x3cce93[_0x2c20('0x56')]);_0x5347f2[_0x2c20('0x57')]();return _0x3cce93;}})[_0x2c20('0x24')](respondWithResult(_0xc5bb8,null))['catch'](handleError(_0xc5bb8,null));};
\ No newline at end of file