Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index ac91b54..cd1b973 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0fe1=['role','ODBC','autoAssociation','dsn','odbc','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x20cb5d,_0x5b6ec7){var _0x33dd23=function(_0x5918a9){while(--_0x5918a9){_0x20cb5d['push'](_0x20cb5d['shift']());}};_0x33dd23(++_0x5b6ec7);}(_0x0fe1,0x19f));var _0x10fe=function(_0x3c3a4d,_0x309438){_0x3c3a4d=_0x3c3a4d-0x0;var _0x251598=_0x0fe1[_0x3c3a4d];return _0x251598;};'use strict';var pdf=require(_0x10fe('0x0'));var emlformat=require(_0x10fe('0x1'));var rimraf=require(_0x10fe('0x2'));var zipdir=require(_0x10fe('0x3'));var jsonpatch=require(_0x10fe('0x4'));var rp=require(_0x10fe('0x5'));var moment=require(_0x10fe('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x10fe('0x7'));var util=require(_0x10fe('0x8'));var path=require('path');var sox=require(_0x10fe('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x10fe('0xa'));var squel=require(_0x10fe('0xb'));var crypto=require(_0x10fe('0xc'));var jsforce=require(_0x10fe('0xd'));var deskjs=require(_0x10fe('0xe'));var toCsv=require(_0x10fe('0xf'));var querystring=require(_0x10fe('0x10'));var Papa=require(_0x10fe('0x11'));var Redis=require('ioredis');var authService=require(_0x10fe('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x10fe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10fe('0x14'))('api');var utils=require(_0x10fe('0x15'));var config=require(_0x10fe('0x16'));var db=require(_0x10fe('0x17'))['db'];function respondWithStatusCode(_0x2ec859,_0x5b05d1){_0x5b05d1=_0x5b05d1||0xcc;return function(_0x55b068){if(_0x55b068){return _0x2ec859[_0x10fe('0x18')](_0x5b05d1);}return _0x2ec859[_0x10fe('0x19')](_0x5b05d1)['end']();};}function respondWithResult(_0x2ee526,_0x564542){_0x564542=_0x564542||0xc8;return function(_0x132edb){if(_0x132edb){return _0x2ee526[_0x10fe('0x19')](_0x564542)[_0x10fe('0x1a')](_0x132edb);}};}function respondWithFilteredResult(_0xd49542,_0x592a17){return function(_0x58fd25){if(_0x58fd25){var _0x221d1f=_0x58fd25[_0x10fe('0x1b')],_0x4959c8=_0x592a17[_0x10fe('0x1c')],_0x434677=_0x592a17[_0x10fe('0x1c')]+_0x592a17[_0x10fe('0x1d')],_0x4bf788;if(_0x434677>=_0x221d1f){_0x434677=_0x221d1f;_0x4bf788=0xc8;}else{_0x4bf788=0xce;}_0xd49542[_0x10fe('0x19')](_0x4bf788);return _0xd49542[_0x10fe('0x1e')]('Content-Range',_0x4959c8+'-'+_0x434677+'/'+_0x221d1f)['json'](_0x58fd25);}return null;};}function patchUpdates(_0x3759e3){return function(_0x2fba34){try{jsonpatch[_0x10fe('0x1f')](_0x2fba34,_0x3759e3,!![]);}catch(_0x49b597){return BPromise['reject'](_0x49b597);}return _0x2fba34[_0x10fe('0x20')]();};}function saveUpdates(_0x43e855,_0x5a28ee){return function(_0x213184){if(_0x213184){return _0x213184[_0x10fe('0x21')](_0x43e855)['then'](function(_0x1856da){return _0x1856da;});}return null;};}function removeEntity(_0x49ceed,_0x3ecf20){return function(_0x30eb3d){if(_0x30eb3d){return _0x30eb3d[_0x10fe('0x22')]()[_0x10fe('0x23')](function(){var _0x2e1993=_0x30eb3d[_0x10fe('0x24')]({'plain':!![]});var _0x2eb4c2='ODBC';return db[_0x10fe('0x25')]['destroy']({'where':{'type':_0x2eb4c2,'resourceId':_0x2e1993['id']}})[_0x10fe('0x23')](function(){return _0x30eb3d;});})[_0x10fe('0x23')](function(){_0x49ceed[_0x10fe('0x19')](0xcc)[_0x10fe('0x26')]();});}};}function handleEntityNotFound(_0x279eb1,_0xdae5b0){return function(_0x2ccc61){if(!_0x2ccc61){_0x279eb1[_0x10fe('0x18')](0x194);}return _0x2ccc61;};}function handleError(_0x17bcdb,_0x41b61c){_0x41b61c=_0x41b61c||0x1f4;return function(_0x292fbb){logger[_0x10fe('0x27')](_0x292fbb[_0x10fe('0x28')]);if(_0x292fbb['name']){delete _0x292fbb[_0x10fe('0x29')];}_0x17bcdb[_0x10fe('0x19')](_0x41b61c)[_0x10fe('0x2a')](_0x292fbb);};}exports[_0x10fe('0x2b')]=function(_0x16fd7d,_0x19b1da){var _0x4705c0={},_0x33c82f={},_0xbbbdf0={'count':0x0,'rows':[]};var _0x60da64=_[_0x10fe('0x2c')](db[_0x10fe('0x2d')]['rawAttributes'],function(_0x3b85e8){return{'name':_0x3b85e8[_0x10fe('0x2e')],'type':_0x3b85e8[_0x10fe('0x2f')][_0x10fe('0x30')]};});_0x33c82f['model']=_['map'](_0x60da64,_0x10fe('0x29'));_0x33c82f[_0x10fe('0x31')]=_[_0x10fe('0x32')](_0x16fd7d[_0x10fe('0x31')]);_0x33c82f[_0x10fe('0x33')]=_['intersection'](_0x33c82f['model'],_0x33c82f[_0x10fe('0x31')]);_0x4705c0[_0x10fe('0x34')]=_['intersection'](_0x33c82f[_0x10fe('0x35')],qs[_0x10fe('0x36')](_0x16fd7d[_0x10fe('0x31')][_0x10fe('0x36')]));_0x4705c0[_0x10fe('0x34')]=_0x4705c0['attributes'][_0x10fe('0x37')]?_0x4705c0['attributes']:_0x33c82f[_0x10fe('0x35')];if(!_0x16fd7d[_0x10fe('0x31')][_0x10fe('0x38')](_0x10fe('0x39'))){_0x4705c0[_0x10fe('0x1d')]=qs[_0x10fe('0x1d')](_0x16fd7d[_0x10fe('0x31')][_0x10fe('0x1d')]);_0x4705c0[_0x10fe('0x1c')]=qs[_0x10fe('0x1c')](_0x16fd7d[_0x10fe('0x31')][_0x10fe('0x1c')]);}_0x4705c0['order']=qs[_0x10fe('0x3a')](_0x16fd7d['query'][_0x10fe('0x3a')]);_0x4705c0[_0x10fe('0x3b')]=qs[_0x10fe('0x33')](_[_0x10fe('0x3c')](_0x16fd7d[_0x10fe('0x31')],_0x33c82f['filters']));if(_0x16fd7d['query']['filter']){_0x4705c0[_0x10fe('0x3b')]=_[_0x10fe('0x3d')](_0x4705c0[_0x10fe('0x3b')],{'$or':_['map'](_0x60da64,function(_0x4e9f34){if(_0x4e9f34[_0x10fe('0x2f')]!=='VIRTUAL'){var _0x551be5={};_0x551be5[_0x4e9f34[_0x10fe('0x29')]]={'$like':'%'+_0x16fd7d[_0x10fe('0x31')][_0x10fe('0x3e')]+'%'};return _0x551be5;}})});}_0x4705c0=_[_0x10fe('0x3d')]({},_0x4705c0,_0x16fd7d[_0x10fe('0x3f')]);var _0x54c116={'where':_0x4705c0['where']};return db[_0x10fe('0x2d')][_0x10fe('0x1b')](_0x54c116)['then'](function(_0x11fc08){_0xbbbdf0[_0x10fe('0x1b')]=_0x11fc08;if(_0x16fd7d[_0x10fe('0x31')][_0x10fe('0x40')]){_0x4705c0[_0x10fe('0x41')]=[{'all':!![]}];}return db[_0x10fe('0x2d')][_0x10fe('0x42')](_0x4705c0);})[_0x10fe('0x23')](function(_0x47b363){_0xbbbdf0['rows']=_0x47b363;return _0xbbbdf0;})[_0x10fe('0x23')](respondWithFilteredResult(_0x19b1da,_0x4705c0))[_0x10fe('0x43')](handleError(_0x19b1da,null));};exports[_0x10fe('0x44')]=function(_0x8d9f71,_0x98c6d1){var _0x30a2d9={'raw':!![],'where':{'id':_0x8d9f71[_0x10fe('0x45')]['id']}},_0x8ef0e9={};_0x8ef0e9[_0x10fe('0x35')]=_[_0x10fe('0x32')](db[_0x10fe('0x2d')][_0x10fe('0x46')]);_0x8ef0e9[_0x10fe('0x31')]=_[_0x10fe('0x32')](_0x8d9f71['query']);_0x8ef0e9[_0x10fe('0x33')]=_[_0x10fe('0x47')](_0x8ef0e9[_0x10fe('0x35')],_0x8ef0e9[_0x10fe('0x31')]);_0x30a2d9['attributes']=_[_0x10fe('0x47')](_0x8ef0e9['model'],qs[_0x10fe('0x36')](_0x8d9f71[_0x10fe('0x31')]['fields']));_0x30a2d9[_0x10fe('0x34')]=_0x30a2d9[_0x10fe('0x34')][_0x10fe('0x37')]?_0x30a2d9[_0x10fe('0x34')]:_0x8ef0e9[_0x10fe('0x35')];if(_0x8d9f71['query'][_0x10fe('0x40')]){_0x30a2d9[_0x10fe('0x41')]=[{'all':!![]}];}_0x30a2d9=_['merge']({},_0x30a2d9,_0x8d9f71[_0x10fe('0x3f')]);return db['SquareOdbc'][_0x10fe('0x48')](_0x30a2d9)[_0x10fe('0x23')](handleEntityNotFound(_0x98c6d1,null))[_0x10fe('0x23')](respondWithResult(_0x98c6d1,null))['catch'](handleError(_0x98c6d1,null));};exports[_0x10fe('0x49')]=function(_0x6b44ad,_0x4807e5){return db[_0x10fe('0x2d')][_0x10fe('0x49')](_0x6b44ad[_0x10fe('0x4a')],{})[_0x10fe('0x23')](function(_0x19f1d1){var _0x3ca2dd=_0x6b44ad[_0x10fe('0x4b')]['get']({'plain':!![]});if(!_0x3ca2dd)throw new Error(_0x10fe('0x4c'));if(_0x3ca2dd[_0x10fe('0x4d')]===_0x10fe('0x4b')){var _0x1da034=_0x19f1d1[_0x10fe('0x24')]({'plain':!![]});var _0x2866d6=_0x10fe('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x2866d6,'userProfileId':_0x3ca2dd['userProfileId']},'raw':!![]})[_0x10fe('0x23')](function(_0x45353c){if(_0x45353c&&_0x45353c[_0x10fe('0x4f')]===0x0){return db['UserProfileResource'][_0x10fe('0x49')]({'name':_0x1da034[_0x10fe('0x29')],'resourceId':_0x1da034['id'],'type':_0x45353c[_0x10fe('0x29')],'sectionId':_0x45353c['id']},{})[_0x10fe('0x23')](function(){return _0x19f1d1;});}else{return _0x19f1d1;}})[_0x10fe('0x43')](function(_0x38b140){logger[_0x10fe('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38b140);throw _0x38b140;});}return _0x19f1d1;})[_0x10fe('0x23')](respondWithResult(_0x4807e5,0xc9))[_0x10fe('0x43')](handleError(_0x4807e5,null));};exports[_0x10fe('0x21')]=function(_0x3d7640,_0x4ba22c){if(_0x3d7640[_0x10fe('0x4a')]['id']){delete _0x3d7640[_0x10fe('0x4a')]['id'];}return db['SquareOdbc'][_0x10fe('0x48')]({'where':{'id':_0x3d7640[_0x10fe('0x45')]['id']}})[_0x10fe('0x23')](handleEntityNotFound(_0x4ba22c,null))['then'](saveUpdates(_0x3d7640['body'],null))[_0x10fe('0x23')](respondWithResult(_0x4ba22c,null))['catch'](handleError(_0x4ba22c,null));};exports[_0x10fe('0x22')]=function(_0x449f61,_0xed42){return db[_0x10fe('0x2d')][_0x10fe('0x48')]({'where':{'id':_0x449f61[_0x10fe('0x45')]['id']}})['then'](handleEntityNotFound(_0xed42,null))[_0x10fe('0x23')](removeEntity(_0xed42,null))['catch'](handleError(_0xed42,null));};exports['test']=function(_0x4c060e,_0x4d33d7,_0x1c84f9){var _0x335f59;return db['SquareOdbc'][_0x10fe('0x48')]({'where':{'id':_0x4c060e[_0x10fe('0x45')]['id']},'attributes':['id',_0x10fe('0x50')]})[_0x10fe('0x23')](handleEntityNotFound(_0x4d33d7,null))['then'](function(_0x365a23){if(_0x365a23){var _0x26e612=require(_0x10fe('0x51'))();_0x26e612['openSync'](_0x365a23['dsn']);_0x26e612['closeSync']();return _0x365a23;}})[_0x10fe('0x23')](respondWithResult(_0x4d33d7,null))[_0x10fe('0x43')](handleError(_0x4d33d7,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