Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 25afd36..cd1b973 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef50=['index','map','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SquareOdbc','includeAll','params','rawAttributes','include','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','ODBC','UserProfileResource','end','error','stack','name','send'];(function(_0x160509,_0x4a6214){var _0x450715=function(_0x5c2d5d){while(--_0x5c2d5d){_0x160509['push'](_0x160509['shift']());}};_0x450715(++_0x4a6214);}(_0xef50,0x177));var _0x0ef5=function(_0x3767cb,_0x40d8f4){_0x3767cb=_0x3767cb-0x0;var _0x4a1165=_0xef50[_0x3767cb];return _0x4a1165;};'use strict';var emlformat=require(_0x0ef5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ef5('0x1'));var jsonpatch=require(_0x0ef5('0x2'));var rp=require(_0x0ef5('0x3'));var moment=require(_0x0ef5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ef5('0x5'));var path=require(_0x0ef5('0x6'));var sox=require(_0x0ef5('0x7'));var csv=require(_0x0ef5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ef5('0x9'));var _=require(_0x0ef5('0xa'));var squel=require(_0x0ef5('0xb'));var crypto=require(_0x0ef5('0xc'));var jsforce=require(_0x0ef5('0xd'));var deskjs=require(_0x0ef5('0xe'));var toCsv=require(_0x0ef5('0x8'));var querystring=require(_0x0ef5('0xf'));var Papa=require(_0x0ef5('0x10'));var Redis=require('ioredis');var authService=require(_0x0ef5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0ef5('0x12'));var hardwareService=require(_0x0ef5('0x13'));var logger=require(_0x0ef5('0x14'))('api');var utils=require(_0x0ef5('0x15'));var config=require(_0x0ef5('0x16'));var licenseUtil=require(_0x0ef5('0x17'));var db=require(_0x0ef5('0x18'))['db'];function respondWithStatusCode(_0x3d3742,_0x49748b){_0x49748b=_0x49748b||0xcc;return function(_0x233e53){if(_0x233e53){return _0x3d3742[_0x0ef5('0x19')](_0x49748b);}return _0x3d3742[_0x0ef5('0x1a')](_0x49748b)['end']();};}function respondWithResult(_0x5948c0,_0x1a6de0){_0x1a6de0=_0x1a6de0||0xc8;return function(_0x5a02c8){if(_0x5a02c8){return _0x5948c0[_0x0ef5('0x1a')](_0x1a6de0)[_0x0ef5('0x1b')](_0x5a02c8);}};}function respondWithFilteredResult(_0x3ee603,_0xc1188f){return function(_0x15c0e2){if(_0x15c0e2){var _0x5ba3b1=typeof _0xc1188f[_0x0ef5('0x1c')]===_0x0ef5('0x1d')&&typeof _0xc1188f[_0x0ef5('0x1e')]===_0x0ef5('0x1d');var _0xd39bb4=_0x15c0e2[_0x0ef5('0x1f')];var _0x357534=_0x5ba3b1?0x0:_0xc1188f[_0x0ef5('0x1c')];var _0x872917=_0x5ba3b1?_0x15c0e2[_0x0ef5('0x1f')]:_0xc1188f[_0x0ef5('0x1c')]+_0xc1188f['limit'];var _0x5d962e;if(_0x872917>=_0xd39bb4){_0x872917=_0xd39bb4;_0x5d962e=0xc8;}else{_0x5d962e=0xce;}_0x3ee603[_0x0ef5('0x1a')](_0x5d962e);return _0x3ee603[_0x0ef5('0x20')]('Content-Range',_0x357534+'-'+_0x872917+'/'+_0xd39bb4)[_0x0ef5('0x1b')](_0x15c0e2);}return null;};}function patchUpdates(_0xf23191){return function(_0x5d489d){try{jsonpatch[_0x0ef5('0x21')](_0x5d489d,_0xf23191,!![]);}catch(_0x1fab7d){return BPromise['reject'](_0x1fab7d);}return _0x5d489d[_0x0ef5('0x22')]();};}function saveUpdates(_0x5f0ec8,_0x733002){return function(_0x4f3a4b){if(_0x4f3a4b){return _0x4f3a4b[_0x0ef5('0x23')](_0x5f0ec8)['then'](function(_0x439e50){return _0x439e50;});}return null;};}function removeEntity(_0x5643ca,_0x59c80f){return function(_0x2ce34b){if(_0x2ce34b){return _0x2ce34b[_0x0ef5('0x24')]()[_0x0ef5('0x25')](function(){var _0x53690e=_0x2ce34b['get']({'plain':!![]});var _0x5e3cc1=_0x0ef5('0x26');return db[_0x0ef5('0x27')][_0x0ef5('0x24')]({'where':{'type':_0x5e3cc1,'resourceId':_0x53690e['id']}})[_0x0ef5('0x25')](function(){return _0x2ce34b;});})['then'](function(){_0x5643ca[_0x0ef5('0x1a')](0xcc)[_0x0ef5('0x28')]();});}};}function handleEntityNotFound(_0x4dfff8,_0x471497){return function(_0x44ad62){if(!_0x44ad62){_0x4dfff8[_0x0ef5('0x19')](0x194);}return _0x44ad62;};}function handleError(_0x8e89d3,_0x2652df){_0x2652df=_0x2652df||0x1f4;return function(_0xb85f54){logger[_0x0ef5('0x29')](_0xb85f54[_0x0ef5('0x2a')]);if(_0xb85f54[_0x0ef5('0x2b')]){delete _0xb85f54['name'];}_0x8e89d3['status'](_0x2652df)[_0x0ef5('0x2c')](_0xb85f54);};}exports[_0x0ef5('0x2d')]=function(_0x1555d4,_0x29691e){var _0x3c571a={},_0x5d7087={},_0x24facc={'count':0x0,'rows':[]};var _0x35325b=_[_0x0ef5('0x2e')](db['SquareOdbc']['rawAttributes'],function(_0x244800){return{'name':_0x244800['fieldName'],'type':_0x244800[_0x0ef5('0x2f')][_0x0ef5('0x30')]};});_0x5d7087[_0x0ef5('0x31')]=_[_0x0ef5('0x2e')](_0x35325b,_0x0ef5('0x2b'));_0x5d7087['query']=_[_0x0ef5('0x32')](_0x1555d4[_0x0ef5('0x33')]);_0x5d7087[_0x0ef5('0x34')]=_['intersection'](_0x5d7087[_0x0ef5('0x31')],_0x5d7087[_0x0ef5('0x33')]);_0x3c571a['attributes']=_[_0x0ef5('0x35')](_0x5d7087[_0x0ef5('0x31')],qs[_0x0ef5('0x36')](_0x1555d4[_0x0ef5('0x33')][_0x0ef5('0x36')]));_0x3c571a[_0x0ef5('0x37')]=_0x3c571a['attributes'][_0x0ef5('0x38')]?_0x3c571a[_0x0ef5('0x37')]:_0x5d7087[_0x0ef5('0x31')];if(!_0x1555d4['query'][_0x0ef5('0x39')](_0x0ef5('0x3a'))){_0x3c571a['limit']=qs[_0x0ef5('0x1e')](_0x1555d4[_0x0ef5('0x33')]['limit']);_0x3c571a[_0x0ef5('0x1c')]=qs['offset'](_0x1555d4['query'][_0x0ef5('0x1c')]);}_0x3c571a[_0x0ef5('0x3b')]=qs[_0x0ef5('0x3c')](_0x1555d4[_0x0ef5('0x33')]['sort']);_0x3c571a[_0x0ef5('0x3d')]=qs[_0x0ef5('0x34')](_[_0x0ef5('0x3e')](_0x1555d4[_0x0ef5('0x33')],_0x5d7087[_0x0ef5('0x34')]),_0x35325b);if(_0x1555d4[_0x0ef5('0x33')][_0x0ef5('0x3f')]){_0x3c571a[_0x0ef5('0x3d')]=_[_0x0ef5('0x40')](_0x3c571a[_0x0ef5('0x3d')],{'$or':_[_0x0ef5('0x2e')](_0x35325b,function(_0xfa08eb){if(_0xfa08eb[_0x0ef5('0x2f')]!=='VIRTUAL'){var _0x181edf={};_0x181edf[_0xfa08eb['name']]={'$like':'%'+_0x1555d4[_0x0ef5('0x33')][_0x0ef5('0x3f')]+'%'};return _0x181edf;}})});}_0x3c571a=_[_0x0ef5('0x40')]({},_0x3c571a,_0x1555d4['options']);var _0x1ca31a={'where':_0x3c571a[_0x0ef5('0x3d')]};return db[_0x0ef5('0x41')][_0x0ef5('0x1f')](_0x1ca31a)['then'](function(_0x5150ff){_0x24facc['count']=_0x5150ff;if(_0x1555d4[_0x0ef5('0x33')][_0x0ef5('0x42')]){_0x3c571a['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3c571a);})[_0x0ef5('0x25')](function(_0x5de926){_0x24facc['rows']=_0x5de926;return _0x24facc;})[_0x0ef5('0x25')](respondWithFilteredResult(_0x29691e,_0x3c571a))['catch'](handleError(_0x29691e,null));};exports['show']=function(_0x4290c7,_0x2bf7f4){var _0xfb70b6={'raw':!![],'where':{'id':_0x4290c7[_0x0ef5('0x43')]['id']}},_0x32500a={};_0x32500a['model']=_[_0x0ef5('0x32')](db[_0x0ef5('0x41')][_0x0ef5('0x44')]);_0x32500a['query']=_['keys'](_0x4290c7[_0x0ef5('0x33')]);_0x32500a['filters']=_[_0x0ef5('0x35')](_0x32500a['model'],_0x32500a[_0x0ef5('0x33')]);_0xfb70b6['attributes']=_[_0x0ef5('0x35')](_0x32500a[_0x0ef5('0x31')],qs['fields'](_0x4290c7[_0x0ef5('0x33')][_0x0ef5('0x36')]));_0xfb70b6['attributes']=_0xfb70b6['attributes'][_0x0ef5('0x38')]?_0xfb70b6[_0x0ef5('0x37')]:_0x32500a[_0x0ef5('0x31')];if(_0x4290c7[_0x0ef5('0x33')][_0x0ef5('0x42')]){_0xfb70b6[_0x0ef5('0x45')]=[{'all':!![]}];}_0xfb70b6=_[_0x0ef5('0x40')]({},_0xfb70b6,_0x4290c7['options']);return db['SquareOdbc']['find'](_0xfb70b6)['then'](handleEntityNotFound(_0x2bf7f4,null))[_0x0ef5('0x25')](respondWithResult(_0x2bf7f4,null))[_0x0ef5('0x46')](handleError(_0x2bf7f4,null));};exports[_0x0ef5('0x47')]=function(_0xecac93,_0x239411){return db[_0x0ef5('0x41')][_0x0ef5('0x47')](_0xecac93[_0x0ef5('0x48')],{})[_0x0ef5('0x25')](function(_0x203962){var _0xb4fd3b=_0xecac93[_0x0ef5('0x49')][_0x0ef5('0x4a')]({'plain':!![]});if(!_0xb4fd3b)throw new Error(_0x0ef5('0x4b'));if(_0xb4fd3b[_0x0ef5('0x4c')]===_0x0ef5('0x49')){var _0x4cf1c7=_0x203962['get']({'plain':!![]});var _0x32e673=_0x0ef5('0x26');return db['UserProfileSection'][_0x0ef5('0x4d')]({'where':{'name':_0x32e673,'userProfileId':_0xb4fd3b['userProfileId']},'raw':!![]})['then'](function(_0x3cb568){if(_0x3cb568&&_0x3cb568[_0x0ef5('0x4e')]===0x0){return db[_0x0ef5('0x27')][_0x0ef5('0x47')]({'name':_0x4cf1c7[_0x0ef5('0x2b')],'resourceId':_0x4cf1c7['id'],'type':_0x3cb568[_0x0ef5('0x2b')],'sectionId':_0x3cb568['id']},{})[_0x0ef5('0x25')](function(){return _0x203962;});}else{return _0x203962;}})[_0x0ef5('0x46')](function(_0x28635a){logger[_0x0ef5('0x29')](_0x0ef5('0x4f'),_0x28635a);throw _0x28635a;});}return _0x203962;})['then'](respondWithResult(_0x239411,0xc9))[_0x0ef5('0x46')](handleError(_0x239411,null));};exports[_0x0ef5('0x23')]=function(_0x415249,_0x4a06f7){if(_0x415249[_0x0ef5('0x48')]['id']){delete _0x415249[_0x0ef5('0x48')]['id'];}return db[_0x0ef5('0x41')][_0x0ef5('0x4d')]({'where':{'id':_0x415249[_0x0ef5('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a06f7,null))[_0x0ef5('0x25')](saveUpdates(_0x415249[_0x0ef5('0x48')],null))[_0x0ef5('0x25')](respondWithResult(_0x4a06f7,null))[_0x0ef5('0x46')](handleError(_0x4a06f7,null));};exports[_0x0ef5('0x24')]=function(_0x10f1ec,_0xa80c41){return db[_0x0ef5('0x41')][_0x0ef5('0x4d')]({'where':{'id':_0x10f1ec[_0x0ef5('0x43')]['id']}})[_0x0ef5('0x25')](handleEntityNotFound(_0xa80c41,null))[_0x0ef5('0x25')](removeEntity(_0xa80c41,null))[_0x0ef5('0x46')](handleError(_0xa80c41,null));};exports['test']=function(_0x32af99,_0x1cffb9,_0x540511){var _0x31bcfe;return db[_0x0ef5('0x41')][_0x0ef5('0x4d')]({'where':{'id':_0x32af99[_0x0ef5('0x43')]['id']},'attributes':['id',_0x0ef5('0x50')]})[_0x0ef5('0x25')](handleEntityNotFound(_0x1cffb9,null))[_0x0ef5('0x25')](function(_0x2dba6c){if(_0x2dba6c){var _0xd4c6a6=require(_0x0ef5('0x51'))();_0xd4c6a6[_0x0ef5('0x52')](_0x2dba6c[_0x0ef5('0x50')]);_0xd4c6a6[_0x0ef5('0x53')]();return _0x2dba6c;}})[_0x0ef5('0x25')](respondWithResult(_0x1cffb9,null))['catch'](handleError(_0x1cffb9,null));};
\ No newline at end of file
+var _0xdd0e=['stack','name','send','map','SquareOdbc','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','get','ODBC','UserProfileResource','destroy','error'];(function(_0x172dfd,_0x869e62){var _0x248c26=function(_0x11c307){while(--_0x11c307){_0x172dfd['push'](_0x172dfd['shift']());}};_0x248c26(++_0x869e62);}(_0xdd0e,0x1d0));var _0xedd0=function(_0x59cba9,_0x1e8f27){_0x59cba9=_0x59cba9-0x0;var _0xae4206=_0xdd0e[_0x59cba9];return _0xae4206;};'use strict';var emlformat=require(_0xedd0('0x0'));var rimraf=require(_0xedd0('0x1'));var zipdir=require(_0xedd0('0x2'));var jsonpatch=require(_0xedd0('0x3'));var rp=require(_0xedd0('0x4'));var moment=require(_0xedd0('0x5'));var BPromise=require(_0xedd0('0x6'));var Mustache=require(_0xedd0('0x7'));var util=require(_0xedd0('0x8'));var path=require('path');var sox=require(_0xedd0('0x9'));var csv=require(_0xedd0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedd0('0xb'));var squel=require(_0xedd0('0xc'));var crypto=require(_0xedd0('0xd'));var jsforce=require(_0xedd0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xedd0('0xa'));var querystring=require(_0xedd0('0xf'));var Papa=require(_0xedd0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xedd0('0x11'));var hardwareService=require(_0xedd0('0x12'));var logger=require('../../config/logger')(_0xedd0('0x13'));var utils=require(_0xedd0('0x14'));var config=require(_0xedd0('0x15'));var licenseUtil=require(_0xedd0('0x16'));var db=require(_0xedd0('0x17'))['db'];function respondWithStatusCode(_0x20a293,_0x452ed4){_0x452ed4=_0x452ed4||0xcc;return function(_0x4e559d){if(_0x4e559d){return _0x20a293['sendStatus'](_0x452ed4);}return _0x20a293[_0xedd0('0x18')](_0x452ed4)[_0xedd0('0x19')]();};}function respondWithResult(_0x1ff09d,_0x4373bf){_0x4373bf=_0x4373bf||0xc8;return function(_0x951af8){if(_0x951af8){return _0x1ff09d[_0xedd0('0x18')](_0x4373bf)[_0xedd0('0x1a')](_0x951af8);}};}function respondWithFilteredResult(_0x2d240b,_0x3b3c94){return function(_0x52246d){if(_0x52246d){var _0x267eec=typeof _0x3b3c94[_0xedd0('0x1b')]===_0xedd0('0x1c')&&typeof _0x3b3c94[_0xedd0('0x1d')]==='undefined';var _0x24c878=_0x52246d[_0xedd0('0x1e')];var _0x41dc66=_0x267eec?0x0:_0x3b3c94[_0xedd0('0x1b')];var _0x4155b2=_0x267eec?_0x52246d['count']:_0x3b3c94[_0xedd0('0x1b')]+_0x3b3c94[_0xedd0('0x1d')];var _0x410344;if(_0x4155b2>=_0x24c878){_0x4155b2=_0x24c878;_0x410344=0xc8;}else{_0x410344=0xce;}_0x2d240b[_0xedd0('0x18')](_0x410344);return _0x2d240b[_0xedd0('0x1f')](_0xedd0('0x20'),_0x41dc66+'-'+_0x4155b2+'/'+_0x24c878)[_0xedd0('0x1a')](_0x52246d);}return null;};}function patchUpdates(_0x42df9a){return function(_0x3c2117){try{jsonpatch['apply'](_0x3c2117,_0x42df9a,!![]);}catch(_0x31a9c3){return BPromise[_0xedd0('0x21')](_0x31a9c3);}return _0x3c2117['save']();};}function saveUpdates(_0x581127,_0x55d6c9){return function(_0x159a93){if(_0x159a93){return _0x159a93['update'](_0x581127)[_0xedd0('0x22')](function(_0x53eb37){return _0x53eb37;});}return null;};}function removeEntity(_0x3d8768,_0x37dfdd){return function(_0x213f54){if(_0x213f54){return _0x213f54['destroy']()[_0xedd0('0x22')](function(){var _0x51111c=_0x213f54[_0xedd0('0x23')]({'plain':!![]});var _0x5768a5=_0xedd0('0x24');return db[_0xedd0('0x25')][_0xedd0('0x26')]({'where':{'type':_0x5768a5,'resourceId':_0x51111c['id']}})[_0xedd0('0x22')](function(){return _0x213f54;});})[_0xedd0('0x22')](function(){_0x3d8768['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x133351,_0x35a02b){return function(_0x4f2147){if(!_0x4f2147){_0x133351['sendStatus'](0x194);}return _0x4f2147;};}function handleError(_0x2e84c1,_0x1fca97){_0x1fca97=_0x1fca97||0x1f4;return function(_0x15a284){logger[_0xedd0('0x27')](_0x15a284[_0xedd0('0x28')]);if(_0x15a284['name']){delete _0x15a284[_0xedd0('0x29')];}_0x2e84c1[_0xedd0('0x18')](_0x1fca97)[_0xedd0('0x2a')](_0x15a284);};}exports['index']=function(_0xc33d61,_0x3a389f){var _0x3c362d={},_0x2926d3={},_0x2185f2={'count':0x0,'rows':[]};var _0x560c27=_[_0xedd0('0x2b')](db[_0xedd0('0x2c')]['rawAttributes'],function(_0x3eda58){return{'name':_0x3eda58[_0xedd0('0x2d')],'type':_0x3eda58[_0xedd0('0x2e')]['key']};});_0x2926d3[_0xedd0('0x2f')]=_[_0xedd0('0x2b')](_0x560c27,_0xedd0('0x29'));_0x2926d3[_0xedd0('0x30')]=_[_0xedd0('0x31')](_0xc33d61[_0xedd0('0x30')]);_0x2926d3[_0xedd0('0x32')]=_[_0xedd0('0x33')](_0x2926d3[_0xedd0('0x2f')],_0x2926d3[_0xedd0('0x30')]);_0x3c362d[_0xedd0('0x34')]=_['intersection'](_0x2926d3[_0xedd0('0x2f')],qs[_0xedd0('0x35')](_0xc33d61[_0xedd0('0x30')][_0xedd0('0x35')]));_0x3c362d['attributes']=_0x3c362d[_0xedd0('0x34')][_0xedd0('0x36')]?_0x3c362d['attributes']:_0x2926d3[_0xedd0('0x2f')];if(!_0xc33d61['query'][_0xedd0('0x37')](_0xedd0('0x38'))){_0x3c362d[_0xedd0('0x1d')]=qs[_0xedd0('0x1d')](_0xc33d61[_0xedd0('0x30')][_0xedd0('0x1d')]);_0x3c362d[_0xedd0('0x1b')]=qs[_0xedd0('0x1b')](_0xc33d61[_0xedd0('0x30')][_0xedd0('0x1b')]);}_0x3c362d['order']=qs['sort'](_0xc33d61[_0xedd0('0x30')][_0xedd0('0x39')]);_0x3c362d[_0xedd0('0x3a')]=qs[_0xedd0('0x32')](_[_0xedd0('0x3b')](_0xc33d61[_0xedd0('0x30')],_0x2926d3[_0xedd0('0x32')]),_0x560c27);if(_0xc33d61[_0xedd0('0x30')]['filter']){_0x3c362d[_0xedd0('0x3a')]=_[_0xedd0('0x3c')](_0x3c362d[_0xedd0('0x3a')],{'$or':_['map'](_0x560c27,function(_0x3bc3a3){if(_0x3bc3a3[_0xedd0('0x2e')]!==_0xedd0('0x3d')){var _0x36d058={};_0x36d058[_0x3bc3a3['name']]={'$like':'%'+_0xc33d61['query']['filter']+'%'};return _0x36d058;}})});}_0x3c362d=_['merge']({},_0x3c362d,_0xc33d61[_0xedd0('0x3e')]);var _0x11262d={'where':_0x3c362d[_0xedd0('0x3a')]};return db[_0xedd0('0x2c')][_0xedd0('0x1e')](_0x11262d)[_0xedd0('0x22')](function(_0x2f5777){_0x2185f2[_0xedd0('0x1e')]=_0x2f5777;if(_0xc33d61['query'][_0xedd0('0x3f')]){_0x3c362d[_0xedd0('0x40')]=[{'all':!![]}];}return db[_0xedd0('0x2c')][_0xedd0('0x41')](_0x3c362d);})[_0xedd0('0x22')](function(_0x4d5764){_0x2185f2[_0xedd0('0x42')]=_0x4d5764;return _0x2185f2;})['then'](respondWithFilteredResult(_0x3a389f,_0x3c362d))[_0xedd0('0x43')](handleError(_0x3a389f,null));};exports['show']=function(_0x47b400,_0x2c6a25){var _0x56b408={'raw':!![],'where':{'id':_0x47b400[_0xedd0('0x44')]['id']}},_0x1a7d41={};_0x1a7d41['model']=_[_0xedd0('0x31')](db['SquareOdbc'][_0xedd0('0x45')]);_0x1a7d41[_0xedd0('0x30')]=_[_0xedd0('0x31')](_0x47b400[_0xedd0('0x30')]);_0x1a7d41[_0xedd0('0x32')]=_['intersection'](_0x1a7d41[_0xedd0('0x2f')],_0x1a7d41[_0xedd0('0x30')]);_0x56b408[_0xedd0('0x34')]=_[_0xedd0('0x33')](_0x1a7d41[_0xedd0('0x2f')],qs[_0xedd0('0x35')](_0x47b400['query']['fields']));_0x56b408[_0xedd0('0x34')]=_0x56b408[_0xedd0('0x34')][_0xedd0('0x36')]?_0x56b408[_0xedd0('0x34')]:_0x1a7d41[_0xedd0('0x2f')];if(_0x47b400['query']['includeAll']){_0x56b408[_0xedd0('0x40')]=[{'all':!![]}];}_0x56b408=_['merge']({},_0x56b408,_0x47b400[_0xedd0('0x3e')]);return db[_0xedd0('0x2c')][_0xedd0('0x46')](_0x56b408)[_0xedd0('0x22')](handleEntityNotFound(_0x2c6a25,null))['then'](respondWithResult(_0x2c6a25,null))[_0xedd0('0x43')](handleError(_0x2c6a25,null));};exports[_0xedd0('0x47')]=function(_0x4ad2e1,_0xcec4b6){return db[_0xedd0('0x2c')][_0xedd0('0x47')](_0x4ad2e1[_0xedd0('0x48')],{})[_0xedd0('0x22')](function(_0x3fc4aa){var _0x227083=_0x4ad2e1['user'][_0xedd0('0x23')]({'plain':!![]});if(!_0x227083)throw new Error(_0xedd0('0x49'));if(_0x227083[_0xedd0('0x4a')]==='user'){var _0x48b8cb=_0x3fc4aa[_0xedd0('0x23')]({'plain':!![]});var _0x315943=_0xedd0('0x24');return db[_0xedd0('0x4b')][_0xedd0('0x46')]({'where':{'name':_0x315943,'userProfileId':_0x227083[_0xedd0('0x4c')]},'raw':!![]})[_0xedd0('0x22')](function(_0x507ee8){if(_0x507ee8&&_0x507ee8[_0xedd0('0x4d')]===0x0){return db[_0xedd0('0x25')][_0xedd0('0x47')]({'name':_0x48b8cb[_0xedd0('0x29')],'resourceId':_0x48b8cb['id'],'type':_0x507ee8[_0xedd0('0x29')],'sectionId':_0x507ee8['id']},{})[_0xedd0('0x22')](function(){return _0x3fc4aa;});}else{return _0x3fc4aa;}})[_0xedd0('0x43')](function(_0x38a526){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38a526);throw _0x38a526;});}return _0x3fc4aa;})[_0xedd0('0x22')](respondWithResult(_0xcec4b6,0xc9))[_0xedd0('0x43')](handleError(_0xcec4b6,null));};exports[_0xedd0('0x4e')]=function(_0x1e5321,_0x4b3330){if(_0x1e5321[_0xedd0('0x48')]['id']){delete _0x1e5321['body']['id'];}return db[_0xedd0('0x2c')]['find']({'where':{'id':_0x1e5321[_0xedd0('0x44')]['id']}})[_0xedd0('0x22')](handleEntityNotFound(_0x4b3330,null))[_0xedd0('0x22')](saveUpdates(_0x1e5321[_0xedd0('0x48')],null))[_0xedd0('0x22')](respondWithResult(_0x4b3330,null))[_0xedd0('0x43')](handleError(_0x4b3330,null));};exports['destroy']=function(_0x2ec0c3,_0x3e0407){return db['SquareOdbc'][_0xedd0('0x46')]({'where':{'id':_0x2ec0c3[_0xedd0('0x44')]['id']}})[_0xedd0('0x22')](handleEntityNotFound(_0x3e0407,null))['then'](removeEntity(_0x3e0407,null))['catch'](handleError(_0x3e0407,null));};exports[_0xedd0('0x4f')]=function(_0x1fdfdc,_0x437b65,_0x4f6f97){var _0x4543f8;return db[_0xedd0('0x2c')][_0xedd0('0x46')]({'where':{'id':_0x1fdfdc[_0xedd0('0x44')]['id']},'attributes':['id',_0xedd0('0x50')]})['then'](handleEntityNotFound(_0x437b65,null))[_0xedd0('0x22')](function(_0x14028a){if(_0x14028a){var _0x2c8b75=require(_0xedd0('0x51'))();_0x2c8b75[_0xedd0('0x52')](_0x14028a['dsn']);_0x2c8b75[_0xedd0('0x53')]();return _0x14028a;}})[_0xedd0('0x22')](respondWithResult(_0x437b65,null))[_0xedd0('0x43')](handleError(_0x437b65,null));};
\ No newline at end of file