Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 0012de7..cd1b973 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x103b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','update','then','get','ODBC','UserProfileResource','destroy','stack','name','index','SquareOdbc','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','include','findAll','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x103b,0x1e1));var _0xb103=function(_0xc994c0,_0x17f70f){_0xc994c0=_0xc994c0-0x0;var _0x3a0f72=_0x103b[_0xc994c0];return _0x3a0f72;};'use strict';var emlformat=require(_0xb103('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb103('0x1'));var jsonpatch=require(_0xb103('0x2'));var rp=require(_0xb103('0x3'));var moment=require('moment');var BPromise=require(_0xb103('0x4'));var Mustache=require(_0xb103('0x5'));var util=require(_0xb103('0x6'));var path=require(_0xb103('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb103('0x8'));var fs=require('fs');var fs_extra=require(_0xb103('0x9'));var _=require(_0xb103('0xa'));var squel=require('squel');var crypto=require(_0xb103('0xb'));var jsforce=require(_0xb103('0xc'));var deskjs=require(_0xb103('0xd'));var toCsv=require(_0xb103('0xe'));var querystring=require(_0xb103('0xf'));var Papa=require(_0xb103('0x10'));var Redis=require(_0xb103('0x11'));var authService=require(_0xb103('0x12'));var qs=require(_0xb103('0x13'));var as=require(_0xb103('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb103('0x15'));var config=require(_0xb103('0x16'));var licenseUtil=require(_0xb103('0x17'));var db=require(_0xb103('0x18'))['db'];function respondWithStatusCode(_0x14cdd1,_0x3b72bd){_0x3b72bd=_0x3b72bd||0xcc;return function(_0x415ca2){if(_0x415ca2){return _0x14cdd1[_0xb103('0x19')](_0x3b72bd);}return _0x14cdd1[_0xb103('0x1a')](_0x3b72bd)[_0xb103('0x1b')]();};}function respondWithResult(_0x41b10e,_0x348000){_0x348000=_0x348000||0xc8;return function(_0x3cb896){if(_0x3cb896){return _0x41b10e[_0xb103('0x1a')](_0x348000)[_0xb103('0x1c')](_0x3cb896);}};}function respondWithFilteredResult(_0x489cc8,_0x35a69d){return function(_0x17fc15){if(_0x17fc15){var _0x525019=typeof _0x35a69d[_0xb103('0x1d')]==='undefined'&&typeof _0x35a69d['limit']==='undefined';var _0x373e61=_0x17fc15[_0xb103('0x1e')];var _0x1f1f7c=_0x525019?0x0:_0x35a69d[_0xb103('0x1d')];var _0x12ca81=_0x525019?_0x17fc15[_0xb103('0x1e')]:_0x35a69d[_0xb103('0x1d')]+_0x35a69d[_0xb103('0x1f')];var _0x1cdbc2;if(_0x12ca81>=_0x373e61){_0x12ca81=_0x373e61;_0x1cdbc2=0xc8;}else{_0x1cdbc2=0xce;}_0x489cc8[_0xb103('0x1a')](_0x1cdbc2);return _0x489cc8[_0xb103('0x20')](_0xb103('0x21'),_0x1f1f7c+'-'+_0x12ca81+'/'+_0x373e61)[_0xb103('0x1c')](_0x17fc15);}return null;};}function patchUpdates(_0x3a4b22){return function(_0x1381cc){try{jsonpatch[_0xb103('0x22')](_0x1381cc,_0x3a4b22,!![]);}catch(_0x39fc10){return BPromise['reject'](_0x39fc10);}return _0x1381cc[_0xb103('0x23')]();};}function saveUpdates(_0x161047,_0x532b0b){return function(_0x15f652){if(_0x15f652){return _0x15f652[_0xb103('0x24')](_0x161047)['then'](function(_0x33c9ae){return _0x33c9ae;});}return null;};}function removeEntity(_0x1781df,_0x3600ed){return function(_0x29aba6){if(_0x29aba6){return _0x29aba6['destroy']()[_0xb103('0x25')](function(){var _0x3633cc=_0x29aba6[_0xb103('0x26')]({'plain':!![]});var _0xa55dbf=_0xb103('0x27');return db[_0xb103('0x28')][_0xb103('0x29')]({'where':{'type':_0xa55dbf,'resourceId':_0x3633cc['id']}})[_0xb103('0x25')](function(){return _0x29aba6;});})[_0xb103('0x25')](function(){_0x1781df[_0xb103('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bbaa6,_0x50a08c){return function(_0x2c95a2){if(!_0x2c95a2){_0x3bbaa6[_0xb103('0x19')](0x194);}return _0x2c95a2;};}function handleError(_0xa66748,_0x166bf6){_0x166bf6=_0x166bf6||0x1f4;return function(_0x182dec){logger['error'](_0x182dec[_0xb103('0x2a')]);if(_0x182dec[_0xb103('0x2b')]){delete _0x182dec[_0xb103('0x2b')];}_0xa66748[_0xb103('0x1a')](_0x166bf6)['send'](_0x182dec);};}exports[_0xb103('0x2c')]=function(_0x4a1056,_0x128b58){var _0x440095={},_0x4e3ff4={},_0x1967aa={'count':0x0,'rows':[]};var _0x4d1638=_['map'](db[_0xb103('0x2d')]['rawAttributes'],function(_0x11c494){return{'name':_0x11c494[_0xb103('0x2e')],'type':_0x11c494[_0xb103('0x2f')]['key']};});_0x4e3ff4[_0xb103('0x30')]=_[_0xb103('0x31')](_0x4d1638,_0xb103('0x2b'));_0x4e3ff4[_0xb103('0x32')]=_[_0xb103('0x33')](_0x4a1056[_0xb103('0x32')]);_0x4e3ff4['filters']=_[_0xb103('0x34')](_0x4e3ff4[_0xb103('0x30')],_0x4e3ff4['query']);_0x440095[_0xb103('0x35')]=_[_0xb103('0x34')](_0x4e3ff4[_0xb103('0x30')],qs[_0xb103('0x36')](_0x4a1056[_0xb103('0x32')][_0xb103('0x36')]));_0x440095[_0xb103('0x35')]=_0x440095['attributes'][_0xb103('0x37')]?_0x440095[_0xb103('0x35')]:_0x4e3ff4[_0xb103('0x30')];if(!_0x4a1056[_0xb103('0x32')][_0xb103('0x38')]('nolimit')){_0x440095['limit']=qs['limit'](_0x4a1056['query']['limit']);_0x440095['offset']=qs[_0xb103('0x1d')](_0x4a1056[_0xb103('0x32')][_0xb103('0x1d')]);}_0x440095[_0xb103('0x39')]=qs[_0xb103('0x3a')](_0x4a1056['query'][_0xb103('0x3a')]);_0x440095[_0xb103('0x3b')]=qs[_0xb103('0x3c')](_[_0xb103('0x3d')](_0x4a1056[_0xb103('0x32')],_0x4e3ff4[_0xb103('0x3c')]),_0x4d1638);if(_0x4a1056[_0xb103('0x32')]['filter']){_0x440095[_0xb103('0x3b')]=_['merge'](_0x440095[_0xb103('0x3b')],{'$or':_[_0xb103('0x31')](_0x4d1638,function(_0x2dd88d){if(_0x2dd88d[_0xb103('0x2f')]!=='VIRTUAL'){var _0x207898={};_0x207898[_0x2dd88d[_0xb103('0x2b')]]={'$like':'%'+_0x4a1056[_0xb103('0x32')][_0xb103('0x3e')]+'%'};return _0x207898;}})});}_0x440095=_['merge']({},_0x440095,_0x4a1056['options']);var _0xfe26a={'where':_0x440095[_0xb103('0x3b')]};return db[_0xb103('0x2d')][_0xb103('0x1e')](_0xfe26a)['then'](function(_0x1d1dfa){_0x1967aa['count']=_0x1d1dfa;if(_0x4a1056['query']['includeAll']){_0x440095[_0xb103('0x3f')]=[{'all':!![]}];}return db['SquareOdbc'][_0xb103('0x40')](_0x440095);})['then'](function(_0x3cfc62){_0x1967aa['rows']=_0x3cfc62;return _0x1967aa;})[_0xb103('0x25')](respondWithFilteredResult(_0x128b58,_0x440095))[_0xb103('0x41')](handleError(_0x128b58,null));};exports['show']=function(_0x335e29,_0x1a956a){var _0xa6158d={'raw':!![],'where':{'id':_0x335e29[_0xb103('0x42')]['id']}},_0x56655e={};_0x56655e[_0xb103('0x30')]=_[_0xb103('0x33')](db['SquareOdbc']['rawAttributes']);_0x56655e[_0xb103('0x32')]=_['keys'](_0x335e29[_0xb103('0x32')]);_0x56655e[_0xb103('0x3c')]=_[_0xb103('0x34')](_0x56655e['model'],_0x56655e[_0xb103('0x32')]);_0xa6158d[_0xb103('0x35')]=_['intersection'](_0x56655e[_0xb103('0x30')],qs[_0xb103('0x36')](_0x335e29[_0xb103('0x32')][_0xb103('0x36')]));_0xa6158d[_0xb103('0x35')]=_0xa6158d[_0xb103('0x35')]['length']?_0xa6158d[_0xb103('0x35')]:_0x56655e[_0xb103('0x30')];if(_0x335e29['query'][_0xb103('0x43')]){_0xa6158d[_0xb103('0x3f')]=[{'all':!![]}];}_0xa6158d=_['merge']({},_0xa6158d,_0x335e29['options']);return db[_0xb103('0x2d')][_0xb103('0x44')](_0xa6158d)[_0xb103('0x25')](handleEntityNotFound(_0x1a956a,null))[_0xb103('0x25')](respondWithResult(_0x1a956a,null))[_0xb103('0x41')](handleError(_0x1a956a,null));};exports[_0xb103('0x45')]=function(_0x4a0460,_0x1ae691){return db[_0xb103('0x2d')][_0xb103('0x45')](_0x4a0460[_0xb103('0x46')],{})[_0xb103('0x25')](function(_0x471ce1){var _0x589139=_0x4a0460[_0xb103('0x47')]['get']({'plain':!![]});if(!_0x589139)throw new Error(_0xb103('0x48'));if(_0x589139[_0xb103('0x49')]===_0xb103('0x47')){var _0x318f68=_0x471ce1['get']({'plain':!![]});var _0x30c9fc='ODBC';return db[_0xb103('0x4a')][_0xb103('0x44')]({'where':{'name':_0x30c9fc,'userProfileId':_0x589139[_0xb103('0x4b')]},'raw':!![]})['then'](function(_0x36e7cc){if(_0x36e7cc&&_0x36e7cc[_0xb103('0x4c')]===0x0){return db[_0xb103('0x28')][_0xb103('0x45')]({'name':_0x318f68[_0xb103('0x2b')],'resourceId':_0x318f68['id'],'type':_0x36e7cc[_0xb103('0x2b')],'sectionId':_0x36e7cc['id']},{})['then'](function(){return _0x471ce1;});}else{return _0x471ce1;}})['catch'](function(_0x5cb295){logger[_0xb103('0x4d')](_0xb103('0x4e'),_0x5cb295);throw _0x5cb295;});}return _0x471ce1;})[_0xb103('0x25')](respondWithResult(_0x1ae691,0xc9))[_0xb103('0x41')](handleError(_0x1ae691,null));};exports[_0xb103('0x24')]=function(_0xea8aa6,_0xbc067c){if(_0xea8aa6[_0xb103('0x46')]['id']){delete _0xea8aa6[_0xb103('0x46')]['id'];}return db[_0xb103('0x2d')]['find']({'where':{'id':_0xea8aa6['params']['id']}})[_0xb103('0x25')](handleEntityNotFound(_0xbc067c,null))['then'](saveUpdates(_0xea8aa6[_0xb103('0x46')],null))[_0xb103('0x25')](respondWithResult(_0xbc067c,null))[_0xb103('0x41')](handleError(_0xbc067c,null));};exports['destroy']=function(_0x5a6b88,_0x18f19c){return db[_0xb103('0x2d')][_0xb103('0x44')]({'where':{'id':_0x5a6b88[_0xb103('0x42')]['id']}})[_0xb103('0x25')](handleEntityNotFound(_0x18f19c,null))[_0xb103('0x25')](removeEntity(_0x18f19c,null))['catch'](handleError(_0x18f19c,null));};exports['test']=function(_0x5abe11,_0x9158e8,_0x2e74ea){var _0x5c20e2;return db[_0xb103('0x2d')][_0xb103('0x44')]({'where':{'id':_0x5abe11[_0xb103('0x42')]['id']},'attributes':['id',_0xb103('0x4f')]})[_0xb103('0x25')](handleEntityNotFound(_0x9158e8,null))[_0xb103('0x25')](function(_0x7e68ea){if(_0x7e68ea){var _0x960324=require(_0xb103('0x50'))();_0x960324[_0xb103('0x51')](_0x7e68ea[_0xb103('0x4f')]);_0x960324[_0xb103('0x52')]();return _0x7e68ea;}})[_0xb103('0x25')](respondWithResult(_0x9158e8,null))[_0xb103('0x41')](handleError(_0x9158e8,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