Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index d8a5a31..cd1b973 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4128=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','options','findAll','rows','catch','show','params','keys','includeAll','merge','find','create','body','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','closeSync','eml-format','moment','bluebird','path','sox','to-csv','ejs','lodash','squel'];(function(_0x71c2ac,_0x32eb1f){var _0x47582e=function(_0x2365f8){while(--_0x2365f8){_0x71c2ac['push'](_0x71c2ac['shift']());}};_0x47582e(++_0x32eb1f);}(_0x4128,0x178));var _0x8412=function(_0x5614fb,_0x40331e){_0x5614fb=_0x5614fb-0x0;var _0x58a63a=_0x4128[_0x5614fb];return _0x58a63a;};'use strict';var emlformat=require(_0x8412('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8412('0x1'));var BPromise=require(_0x8412('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8412('0x3'));var sox=require(_0x8412('0x4'));var csv=require(_0x8412('0x5'));var ejs=require(_0x8412('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8412('0x7'));var squel=require(_0x8412('0x8'));var crypto=require(_0x8412('0x9'));var jsforce=require(_0x8412('0xa'));var deskjs=require(_0x8412('0xb'));var toCsv=require(_0x8412('0x5'));var querystring=require(_0x8412('0xc'));var Papa=require(_0x8412('0xd'));var Redis=require(_0x8412('0xe'));var authService=require(_0x8412('0xf'));var qs=require(_0x8412('0x10'));var as=require(_0x8412('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8412('0x12'))(_0x8412('0x13'));var utils=require('../../config/utils');var config=require(_0x8412('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26b15b,_0x2b15d2){_0x2b15d2=_0x2b15d2||0xcc;return function(_0x5f5a60){if(_0x5f5a60){return _0x26b15b[_0x8412('0x15')](_0x2b15d2);}return _0x26b15b[_0x8412('0x16')](_0x2b15d2)[_0x8412('0x17')]();};}function respondWithResult(_0x434c7f,_0x10d042){_0x10d042=_0x10d042||0xc8;return function(_0x131729){if(_0x131729){return _0x434c7f['status'](_0x10d042)[_0x8412('0x18')](_0x131729);}};}function respondWithFilteredResult(_0x3e5082,_0x11aab9){return function(_0x45775d){if(_0x45775d){var _0x457ea9=typeof _0x11aab9['offset']===_0x8412('0x19')&&typeof _0x11aab9[_0x8412('0x1a')]==='undefined';var _0x4cbe2d=_0x45775d['count'];var _0x128f9d=_0x457ea9?0x0:_0x11aab9[_0x8412('0x1b')];var _0x254ff1=_0x457ea9?_0x45775d[_0x8412('0x1c')]:_0x11aab9[_0x8412('0x1b')]+_0x11aab9['limit'];var _0x4a3f0b;if(_0x254ff1>=_0x4cbe2d){_0x254ff1=_0x4cbe2d;_0x4a3f0b=0xc8;}else{_0x4a3f0b=0xce;}_0x3e5082['status'](_0x4a3f0b);return _0x3e5082['set'](_0x8412('0x1d'),_0x128f9d+'-'+_0x254ff1+'/'+_0x4cbe2d)[_0x8412('0x18')](_0x45775d);}return null;};}function patchUpdates(_0x57a64f){return function(_0x56e167){try{jsonpatch['apply'](_0x56e167,_0x57a64f,!![]);}catch(_0x4476b1){return BPromise[_0x8412('0x1e')](_0x4476b1);}return _0x56e167[_0x8412('0x1f')]();};}function saveUpdates(_0x1a565f,_0x1c4570){return function(_0xc784eb){if(_0xc784eb){return _0xc784eb[_0x8412('0x20')](_0x1a565f)[_0x8412('0x21')](function(_0x5b02df){return _0x5b02df;});}return null;};}function removeEntity(_0x405d8b,_0x1a1c24){return function(_0x54984d){if(_0x54984d){return _0x54984d[_0x8412('0x22')]()[_0x8412('0x21')](function(){var _0x56cdd0=_0x54984d[_0x8412('0x23')]({'plain':!![]});var _0x3ba044=_0x8412('0x24');return db[_0x8412('0x25')][_0x8412('0x22')]({'where':{'type':_0x3ba044,'resourceId':_0x56cdd0['id']}})['then'](function(){return _0x54984d;});})[_0x8412('0x21')](function(){_0x405d8b[_0x8412('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b9181,_0xd7d3eb){return function(_0x2daa76){if(!_0x2daa76){_0x2b9181['sendStatus'](0x194);}return _0x2daa76;};}function handleError(_0x3b1af8,_0x514614){_0x514614=_0x514614||0x1f4;return function(_0x12db70){logger[_0x8412('0x26')](_0x12db70['stack']);if(_0x12db70[_0x8412('0x27')]){delete _0x12db70[_0x8412('0x27')];}_0x3b1af8[_0x8412('0x16')](_0x514614)[_0x8412('0x28')](_0x12db70);};}exports[_0x8412('0x29')]=function(_0x3b4db4,_0x292cd3){var _0x5a12bc={},_0x32951c={},_0x5454a0={'count':0x0,'rows':[]};var _0x11c382=_[_0x8412('0x2a')](db[_0x8412('0x2b')][_0x8412('0x2c')],function(_0x39b2cd){return{'name':_0x39b2cd[_0x8412('0x2d')],'type':_0x39b2cd[_0x8412('0x2e')]['key']};});_0x32951c['model']=_[_0x8412('0x2a')](_0x11c382,_0x8412('0x27'));_0x32951c[_0x8412('0x2f')]=_['keys'](_0x3b4db4[_0x8412('0x2f')]);_0x32951c['filters']=_[_0x8412('0x30')](_0x32951c[_0x8412('0x31')],_0x32951c[_0x8412('0x2f')]);_0x5a12bc[_0x8412('0x32')]=_[_0x8412('0x30')](_0x32951c[_0x8412('0x31')],qs[_0x8412('0x33')](_0x3b4db4[_0x8412('0x2f')][_0x8412('0x33')]));_0x5a12bc['attributes']=_0x5a12bc[_0x8412('0x32')][_0x8412('0x34')]?_0x5a12bc[_0x8412('0x32')]:_0x32951c[_0x8412('0x31')];if(!_0x3b4db4[_0x8412('0x2f')][_0x8412('0x35')](_0x8412('0x36'))){_0x5a12bc[_0x8412('0x1a')]=qs[_0x8412('0x1a')](_0x3b4db4[_0x8412('0x2f')][_0x8412('0x1a')]);_0x5a12bc[_0x8412('0x1b')]=qs[_0x8412('0x1b')](_0x3b4db4[_0x8412('0x2f')][_0x8412('0x1b')]);}_0x5a12bc['order']=qs['sort'](_0x3b4db4['query'][_0x8412('0x37')]);_0x5a12bc[_0x8412('0x38')]=qs[_0x8412('0x39')](_['pick'](_0x3b4db4['query'],_0x32951c[_0x8412('0x39')]),_0x11c382);if(_0x3b4db4[_0x8412('0x2f')]['filter']){_0x5a12bc['where']=_['merge'](_0x5a12bc[_0x8412('0x38')],{'$or':_['map'](_0x11c382,function(_0x5f2ff3){if(_0x5f2ff3[_0x8412('0x2e')]!=='VIRTUAL'){var _0x29bb5b={};_0x29bb5b[_0x5f2ff3['name']]={'$like':'%'+_0x3b4db4[_0x8412('0x2f')][_0x8412('0x3a')]+'%'};return _0x29bb5b;}})});}_0x5a12bc=_['merge']({},_0x5a12bc,_0x3b4db4[_0x8412('0x3b')]);var _0x2c304c={'where':_0x5a12bc[_0x8412('0x38')]};return db[_0x8412('0x2b')][_0x8412('0x1c')](_0x2c304c)['then'](function(_0x3220cf){_0x5454a0['count']=_0x3220cf;if(_0x3b4db4[_0x8412('0x2f')]['includeAll']){_0x5a12bc['include']=[{'all':!![]}];}return db[_0x8412('0x2b')][_0x8412('0x3c')](_0x5a12bc);})[_0x8412('0x21')](function(_0x70bf17){_0x5454a0[_0x8412('0x3d')]=_0x70bf17;return _0x5454a0;})[_0x8412('0x21')](respondWithFilteredResult(_0x292cd3,_0x5a12bc))[_0x8412('0x3e')](handleError(_0x292cd3,null));};exports[_0x8412('0x3f')]=function(_0x9f1069,_0x30070a){var _0x2104ec={'raw':!![],'where':{'id':_0x9f1069[_0x8412('0x40')]['id']}},_0x247182={};_0x247182[_0x8412('0x31')]=_[_0x8412('0x41')](db[_0x8412('0x2b')][_0x8412('0x2c')]);_0x247182[_0x8412('0x2f')]=_[_0x8412('0x41')](_0x9f1069[_0x8412('0x2f')]);_0x247182[_0x8412('0x39')]=_[_0x8412('0x30')](_0x247182['model'],_0x247182[_0x8412('0x2f')]);_0x2104ec[_0x8412('0x32')]=_[_0x8412('0x30')](_0x247182['model'],qs[_0x8412('0x33')](_0x9f1069[_0x8412('0x2f')][_0x8412('0x33')]));_0x2104ec[_0x8412('0x32')]=_0x2104ec['attributes']['length']?_0x2104ec['attributes']:_0x247182[_0x8412('0x31')];if(_0x9f1069[_0x8412('0x2f')][_0x8412('0x42')]){_0x2104ec['include']=[{'all':!![]}];}_0x2104ec=_[_0x8412('0x43')]({},_0x2104ec,_0x9f1069[_0x8412('0x3b')]);return db['SquareOdbc'][_0x8412('0x44')](_0x2104ec)[_0x8412('0x21')](handleEntityNotFound(_0x30070a,null))[_0x8412('0x21')](respondWithResult(_0x30070a,null))['catch'](handleError(_0x30070a,null));};exports[_0x8412('0x45')]=function(_0x534158,_0x1c9122){return db[_0x8412('0x2b')][_0x8412('0x45')](_0x534158[_0x8412('0x46')],{})[_0x8412('0x21')](function(_0x3cab9a){var _0x4eb717=_0x534158[_0x8412('0x47')]['get']({'plain':!![]});if(!_0x4eb717)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4eb717['role']===_0x8412('0x47')){var _0x43272a=_0x3cab9a[_0x8412('0x23')]({'plain':!![]});var _0x1101a2=_0x8412('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x1101a2,'userProfileId':_0x4eb717['userProfileId']},'raw':!![]})['then'](function(_0x107688){if(_0x107688&&_0x107688[_0x8412('0x48')]===0x0){return db[_0x8412('0x25')][_0x8412('0x45')]({'name':_0x43272a[_0x8412('0x27')],'resourceId':_0x43272a['id'],'type':_0x107688['name'],'sectionId':_0x107688['id']},{})['then'](function(){return _0x3cab9a;});}else{return _0x3cab9a;}})['catch'](function(_0x2c5642){logger[_0x8412('0x26')](_0x8412('0x49'),_0x2c5642);throw _0x2c5642;});}return _0x3cab9a;})[_0x8412('0x21')](respondWithResult(_0x1c9122,0xc9))['catch'](handleError(_0x1c9122,null));};exports[_0x8412('0x20')]=function(_0x385153,_0xa9b16e){if(_0x385153[_0x8412('0x46')]['id']){delete _0x385153[_0x8412('0x46')]['id'];}return db[_0x8412('0x2b')]['find']({'where':{'id':_0x385153[_0x8412('0x40')]['id']}})['then'](handleEntityNotFound(_0xa9b16e,null))['then'](saveUpdates(_0x385153[_0x8412('0x46')],null))[_0x8412('0x21')](respondWithResult(_0xa9b16e,null))[_0x8412('0x3e')](handleError(_0xa9b16e,null));};exports['destroy']=function(_0x4a7281,_0x51cc41){return db[_0x8412('0x2b')][_0x8412('0x44')]({'where':{'id':_0x4a7281[_0x8412('0x40')]['id']}})[_0x8412('0x21')](handleEntityNotFound(_0x51cc41,null))[_0x8412('0x21')](removeEntity(_0x51cc41,null))[_0x8412('0x3e')](handleError(_0x51cc41,null));};exports[_0x8412('0x4a')]=function(_0x2bb675,_0x34a276,_0x36b41f){var _0x2060d9;return db[_0x8412('0x2b')]['find']({'where':{'id':_0x2bb675[_0x8412('0x40')]['id']},'attributes':['id',_0x8412('0x4b')]})[_0x8412('0x21')](handleEntityNotFound(_0x34a276,null))[_0x8412('0x21')](function(_0x58a4ed){if(_0x58a4ed){var _0x29ef95=require('odbc')();_0x29ef95['openSync'](_0x58a4ed[_0x8412('0x4b')]);_0x29ef95[_0x8412('0x4c')]();return _0x58a4ed;}})[_0x8412('0x21')](respondWithResult(_0x34a276,null))[_0x8412('0x3e')](handleError(_0x34a276,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