Built motion from commit 87cd5f02.|2.5.48
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 2e11bc0..26dd009 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ce7=['SquareOdbc','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','ODBC','status','end','error','name','send','index','map'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9ce7,0x176));var _0x79ce=function(_0x4cc43e,_0x2f7a5b){_0x4cc43e=_0x4cc43e-0x0;var _0x17a566=_0x9ce7[_0x4cc43e];return _0x17a566;};'use strict';var emlformat=require(_0x79ce('0x0'));var rimraf=require(_0x79ce('0x1'));var zipdir=require(_0x79ce('0x2'));var jsonpatch=require(_0x79ce('0x3'));var rp=require(_0x79ce('0x4'));var moment=require(_0x79ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x79ce('0x6'));var util=require(_0x79ce('0x7'));var path=require(_0x79ce('0x8'));var sox=require(_0x79ce('0x9'));var csv=require(_0x79ce('0xa'));var ejs=require(_0x79ce('0xb'));var fs=require('fs');var fs_extra=require(_0x79ce('0xc'));var _=require(_0x79ce('0xd'));var squel=require(_0x79ce('0xe'));var crypto=require('crypto');var jsforce=require(_0x79ce('0xf'));var deskjs=require(_0x79ce('0x10'));var toCsv=require(_0x79ce('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x79ce('0x11'));var authService=require(_0x79ce('0x12'));var qs=require(_0x79ce('0x13'));var as=require(_0x79ce('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x79ce('0x15'))(_0x79ce('0x16'));var utils=require(_0x79ce('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x79ce('0x18'))['db'];function respondWithStatusCode(_0x3e9bde,_0x44b855){_0x44b855=_0x44b855||0xcc;return function(_0x437e58){if(_0x437e58){return _0x3e9bde[_0x79ce('0x19')](_0x44b855);}return _0x3e9bde['status'](_0x44b855)['end']();};}function respondWithResult(_0x359475,_0x16ca61){_0x16ca61=_0x16ca61||0xc8;return function(_0x27d127){if(_0x27d127){return _0x359475['status'](_0x16ca61)['json'](_0x27d127);}};}function respondWithFilteredResult(_0x44b25c,_0x5777a1){return function(_0x570523){if(_0x570523){var _0x566728=typeof _0x5777a1['offset']===_0x79ce('0x1a')&&typeof _0x5777a1[_0x79ce('0x1b')]===_0x79ce('0x1a');var _0x280a95=_0x570523[_0x79ce('0x1c')];var _0x42c5c2=_0x566728?0x0:_0x5777a1['offset'];var _0x3f9085=_0x566728?_0x570523[_0x79ce('0x1c')]:_0x5777a1[_0x79ce('0x1d')]+_0x5777a1[_0x79ce('0x1b')];var _0x3b45b7;if(_0x3f9085>=_0x280a95){_0x3f9085=_0x280a95;_0x3b45b7=0xc8;}else{_0x3b45b7=0xce;}_0x44b25c['status'](_0x3b45b7);return _0x44b25c[_0x79ce('0x1e')](_0x79ce('0x1f'),_0x42c5c2+'-'+_0x3f9085+'/'+_0x280a95)['json'](_0x570523);}return null;};}function patchUpdates(_0x274d71){return function(_0x342b89){try{jsonpatch[_0x79ce('0x20')](_0x342b89,_0x274d71,!![]);}catch(_0x3339d1){return BPromise[_0x79ce('0x21')](_0x3339d1);}return _0x342b89[_0x79ce('0x22')]();};}function saveUpdates(_0x1a8e3f,_0x3f08e4){return function(_0x161f46){if(_0x161f46){return _0x161f46['update'](_0x1a8e3f)['then'](function(_0x49d7f4){return _0x49d7f4;});}return null;};}function removeEntity(_0x3d9df8,_0x2d47f4){return function(_0x4d81e9){if(_0x4d81e9){return _0x4d81e9[_0x79ce('0x23')]()[_0x79ce('0x24')](function(){var _0x4b35fe=_0x4d81e9[_0x79ce('0x25')]({'plain':!![]});var _0x2b8812=_0x79ce('0x26');return db['UserProfileResource'][_0x79ce('0x23')]({'where':{'type':_0x2b8812,'resourceId':_0x4b35fe['id']}})[_0x79ce('0x24')](function(){return _0x4d81e9;});})[_0x79ce('0x24')](function(){_0x3d9df8[_0x79ce('0x27')](0xcc)[_0x79ce('0x28')]();});}};}function handleEntityNotFound(_0x14534a,_0x369b64){return function(_0x28f027){if(!_0x28f027){_0x14534a[_0x79ce('0x19')](0x194);}return _0x28f027;};}function handleError(_0x2cc5da,_0x523054){_0x523054=_0x523054||0x1f4;return function(_0x4fb33c){logger[_0x79ce('0x29')](_0x4fb33c['stack']);if(_0x4fb33c[_0x79ce('0x2a')]){delete _0x4fb33c[_0x79ce('0x2a')];}_0x2cc5da[_0x79ce('0x27')](_0x523054)[_0x79ce('0x2b')](_0x4fb33c);};}exports[_0x79ce('0x2c')]=function(_0x48c5ed,_0x1fb3c0){var _0xa495aa={},_0x482b29={},_0x6816af={'count':0x0,'rows':[]};var _0x5cb5a8=_[_0x79ce('0x2d')](db[_0x79ce('0x2e')][_0x79ce('0x2f')],function(_0x1f1bd2){return{'name':_0x1f1bd2[_0x79ce('0x30')],'type':_0x1f1bd2['type'][_0x79ce('0x31')]};});_0x482b29[_0x79ce('0x32')]=_['map'](_0x5cb5a8,_0x79ce('0x2a'));_0x482b29[_0x79ce('0x33')]=_['keys'](_0x48c5ed[_0x79ce('0x33')]);_0x482b29[_0x79ce('0x34')]=_[_0x79ce('0x35')](_0x482b29[_0x79ce('0x32')],_0x482b29[_0x79ce('0x33')]);_0xa495aa[_0x79ce('0x36')]=_['intersection'](_0x482b29[_0x79ce('0x32')],qs[_0x79ce('0x37')](_0x48c5ed[_0x79ce('0x33')]['fields']));_0xa495aa[_0x79ce('0x36')]=_0xa495aa[_0x79ce('0x36')][_0x79ce('0x38')]?_0xa495aa[_0x79ce('0x36')]:_0x482b29[_0x79ce('0x32')];if(!_0x48c5ed['query']['hasOwnProperty']('nolimit')){_0xa495aa[_0x79ce('0x1b')]=qs['limit'](_0x48c5ed[_0x79ce('0x33')][_0x79ce('0x1b')]);_0xa495aa[_0x79ce('0x1d')]=qs[_0x79ce('0x1d')](_0x48c5ed[_0x79ce('0x33')][_0x79ce('0x1d')]);}_0xa495aa[_0x79ce('0x39')]=qs[_0x79ce('0x3a')](_0x48c5ed['query']['sort']);_0xa495aa[_0x79ce('0x3b')]=qs[_0x79ce('0x34')](_[_0x79ce('0x3c')](_0x48c5ed['query'],_0x482b29[_0x79ce('0x34')]),_0x5cb5a8);if(_0x48c5ed[_0x79ce('0x33')][_0x79ce('0x3d')]){_0xa495aa[_0x79ce('0x3b')]=_[_0x79ce('0x3e')](_0xa495aa[_0x79ce('0x3b')],{'$or':_['map'](_0x5cb5a8,function(_0x4f5180){if(_0x4f5180['type']!=='VIRTUAL'){var _0x49ac84={};_0x49ac84[_0x4f5180[_0x79ce('0x2a')]]={'$like':'%'+_0x48c5ed[_0x79ce('0x33')][_0x79ce('0x3d')]+'%'};return _0x49ac84;}})});}_0xa495aa=_['merge']({},_0xa495aa,_0x48c5ed[_0x79ce('0x3f')]);var _0x658af3={'where':_0xa495aa['where']};return db[_0x79ce('0x2e')]['count'](_0x658af3)['then'](function(_0x99720e){_0x6816af[_0x79ce('0x1c')]=_0x99720e;if(_0x48c5ed[_0x79ce('0x33')][_0x79ce('0x40')]){_0xa495aa[_0x79ce('0x41')]=[{'all':!![]}];}return db[_0x79ce('0x2e')]['findAll'](_0xa495aa);})['then'](function(_0x30dcfe){_0x6816af[_0x79ce('0x42')]=_0x30dcfe;return _0x6816af;})[_0x79ce('0x24')](respondWithFilteredResult(_0x1fb3c0,_0xa495aa))['catch'](handleError(_0x1fb3c0,null));};exports[_0x79ce('0x43')]=function(_0x768d88,_0x3a3d9c){var _0x434b60={'raw':!![],'where':{'id':_0x768d88[_0x79ce('0x44')]['id']}},_0x16d3c3={};_0x16d3c3[_0x79ce('0x32')]=_[_0x79ce('0x45')](db[_0x79ce('0x2e')]['rawAttributes']);_0x16d3c3['query']=_[_0x79ce('0x45')](_0x768d88[_0x79ce('0x33')]);_0x16d3c3[_0x79ce('0x34')]=_[_0x79ce('0x35')](_0x16d3c3['model'],_0x16d3c3[_0x79ce('0x33')]);_0x434b60['attributes']=_[_0x79ce('0x35')](_0x16d3c3['model'],qs['fields'](_0x768d88[_0x79ce('0x33')]['fields']));_0x434b60[_0x79ce('0x36')]=_0x434b60['attributes'][_0x79ce('0x38')]?_0x434b60['attributes']:_0x16d3c3[_0x79ce('0x32')];if(_0x768d88[_0x79ce('0x33')][_0x79ce('0x40')]){_0x434b60[_0x79ce('0x41')]=[{'all':!![]}];}_0x434b60=_[_0x79ce('0x3e')]({},_0x434b60,_0x768d88[_0x79ce('0x3f')]);return db[_0x79ce('0x2e')][_0x79ce('0x46')](_0x434b60)[_0x79ce('0x24')](handleEntityNotFound(_0x3a3d9c,null))[_0x79ce('0x24')](respondWithResult(_0x3a3d9c,null))[_0x79ce('0x47')](handleError(_0x3a3d9c,null));};exports[_0x79ce('0x48')]=function(_0x18fd78,_0xe356de){return db[_0x79ce('0x2e')][_0x79ce('0x48')](_0x18fd78[_0x79ce('0x49')],{})[_0x79ce('0x24')](function(_0x2d8677){var _0x571db9=_0x18fd78[_0x79ce('0x4a')][_0x79ce('0x25')]({'plain':!![]});if(!_0x571db9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x571db9['role']===_0x79ce('0x4a')){var _0x1a4c8e=_0x2d8677[_0x79ce('0x25')]({'plain':!![]});var _0x1a0747=_0x79ce('0x26');return db[_0x79ce('0x4b')]['find']({'where':{'name':_0x1a0747,'userProfileId':_0x571db9[_0x79ce('0x4c')]},'raw':!![]})['then'](function(_0x312144){if(_0x312144&&_0x312144[_0x79ce('0x4d')]===0x0){return db[_0x79ce('0x4e')]['create']({'name':_0x1a4c8e[_0x79ce('0x2a')],'resourceId':_0x1a4c8e['id'],'type':_0x312144['name'],'sectionId':_0x312144['id']},{})['then'](function(){return _0x2d8677;});}else{return _0x2d8677;}})[_0x79ce('0x47')](function(_0x310909){logger[_0x79ce('0x29')](_0x79ce('0x4f'),_0x310909);throw _0x310909;});}return _0x2d8677;})[_0x79ce('0x24')](respondWithResult(_0xe356de,0xc9))[_0x79ce('0x47')](handleError(_0xe356de,null));};exports['update']=function(_0x3844d0,_0x4ee1ce){if(_0x3844d0[_0x79ce('0x49')]['id']){delete _0x3844d0[_0x79ce('0x49')]['id'];}return db[_0x79ce('0x2e')][_0x79ce('0x46')]({'where':{'id':_0x3844d0[_0x79ce('0x44')]['id']}})[_0x79ce('0x24')](handleEntityNotFound(_0x4ee1ce,null))['then'](saveUpdates(_0x3844d0[_0x79ce('0x49')],null))[_0x79ce('0x24')](respondWithResult(_0x4ee1ce,null))['catch'](handleError(_0x4ee1ce,null));};exports[_0x79ce('0x23')]=function(_0x2eba72,_0x4f12f3){return db['SquareOdbc'][_0x79ce('0x46')]({'where':{'id':_0x2eba72[_0x79ce('0x44')]['id']}})[_0x79ce('0x24')](handleEntityNotFound(_0x4f12f3,null))['then'](removeEntity(_0x4f12f3,null))[_0x79ce('0x47')](handleError(_0x4f12f3,null));};exports[_0x79ce('0x50')]=function(_0x1d75ca,_0x41c017,_0x371346){var _0xec945c;return db['SquareOdbc']['find']({'where':{'id':_0x1d75ca['params']['id']},'attributes':['id',_0x79ce('0x51')]})[_0x79ce('0x24')](handleEntityNotFound(_0x41c017,null))[_0x79ce('0x24')](function(_0x405716){if(_0x405716){var _0x21ee5a=require('odbc')();_0x21ee5a[_0x79ce('0x52')](_0x405716[_0x79ce('0x51')]);_0x21ee5a[_0x79ce('0x53')]();return _0x405716;}})[_0x79ce('0x24')](respondWithResult(_0x41c017,null))['catch'](handleError(_0x41c017,null));};
\ No newline at end of file
+var _0x1610=['include','rows','catch','show','params','rawAttributes','SquareOdbc','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll'];(function(_0x5cdc79,_0x24beb1){var _0x22ddcf=function(_0x1f92bf){while(--_0x1f92bf){_0x5cdc79['push'](_0x5cdc79['shift']());}};_0x22ddcf(++_0x24beb1);}(_0x1610,0x11e));var _0x0161=function(_0x32cec2,_0x20ab2f){_0x32cec2=_0x32cec2-0x0;var _0x1ad3ed=_0x1610[_0x32cec2];return _0x1ad3ed;};'use strict';var emlformat=require(_0x0161('0x0'));var rimraf=require(_0x0161('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0161('0x2'));var rp=require(_0x0161('0x3'));var moment=require(_0x0161('0x4'));var BPromise=require(_0x0161('0x5'));var Mustache=require(_0x0161('0x6'));var util=require(_0x0161('0x7'));var path=require(_0x0161('0x8'));var sox=require(_0x0161('0x9'));var csv=require(_0x0161('0xa'));var ejs=require(_0x0161('0xb'));var fs=require('fs');var fs_extra=require(_0x0161('0xc'));var _=require(_0x0161('0xd'));var squel=require(_0x0161('0xe'));var crypto=require(_0x0161('0xf'));var jsforce=require(_0x0161('0x10'));var deskjs=require(_0x0161('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0161('0x12'));var Papa=require(_0x0161('0x13'));var Redis=require(_0x0161('0x14'));var authService=require(_0x0161('0x15'));var qs=require(_0x0161('0x16'));var as=require(_0x0161('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0161('0x18'))(_0x0161('0x19'));var utils=require('../../config/utils');var config=require(_0x0161('0x1a'));var licenseUtil=require(_0x0161('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d43ed,_0x2bc45e){_0x2bc45e=_0x2bc45e||0xcc;return function(_0x3a1413){if(_0x3a1413){return _0x1d43ed[_0x0161('0x1c')](_0x2bc45e);}return _0x1d43ed[_0x0161('0x1d')](_0x2bc45e)[_0x0161('0x1e')]();};}function respondWithResult(_0x22e3e6,_0x1295e5){_0x1295e5=_0x1295e5||0xc8;return function(_0x1443a0){if(_0x1443a0){return _0x22e3e6['status'](_0x1295e5)[_0x0161('0x1f')](_0x1443a0);}};}function respondWithFilteredResult(_0x1ef54e,_0x1773eb){return function(_0x5e6b37){if(_0x5e6b37){var _0x1edded=typeof _0x1773eb[_0x0161('0x20')]===_0x0161('0x21')&&typeof _0x1773eb[_0x0161('0x22')]==='undefined';var _0x3bb632=_0x5e6b37[_0x0161('0x23')];var _0x957a06=_0x1edded?0x0:_0x1773eb['offset'];var _0xc474c7=_0x1edded?_0x5e6b37[_0x0161('0x23')]:_0x1773eb[_0x0161('0x20')]+_0x1773eb[_0x0161('0x22')];var _0x5c60f4;if(_0xc474c7>=_0x3bb632){_0xc474c7=_0x3bb632;_0x5c60f4=0xc8;}else{_0x5c60f4=0xce;}_0x1ef54e[_0x0161('0x1d')](_0x5c60f4);return _0x1ef54e['set'](_0x0161('0x24'),_0x957a06+'-'+_0xc474c7+'/'+_0x3bb632)[_0x0161('0x1f')](_0x5e6b37);}return null;};}function patchUpdates(_0x261ae9){return function(_0x4edf5c){try{jsonpatch['apply'](_0x4edf5c,_0x261ae9,!![]);}catch(_0x252f53){return BPromise[_0x0161('0x25')](_0x252f53);}return _0x4edf5c[_0x0161('0x26')]();};}function saveUpdates(_0x5a3cd6,_0x3d7355){return function(_0x2b80cf){if(_0x2b80cf){return _0x2b80cf[_0x0161('0x27')](_0x5a3cd6)[_0x0161('0x28')](function(_0x11285f){return _0x11285f;});}return null;};}function removeEntity(_0x58ec6e,_0x5aa24e){return function(_0x5c21e6){if(_0x5c21e6){return _0x5c21e6[_0x0161('0x29')]()[_0x0161('0x28')](function(){var _0x276d2c=_0x5c21e6[_0x0161('0x2a')]({'plain':!![]});var _0xe73f=_0x0161('0x2b');return db[_0x0161('0x2c')]['destroy']({'where':{'type':_0xe73f,'resourceId':_0x276d2c['id']}})[_0x0161('0x28')](function(){return _0x5c21e6;});})[_0x0161('0x28')](function(){_0x58ec6e[_0x0161('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47fcfa,_0x4d5b71){return function(_0x23c53f){if(!_0x23c53f){_0x47fcfa['sendStatus'](0x194);}return _0x23c53f;};}function handleError(_0x29bbc1,_0x244d09){_0x244d09=_0x244d09||0x1f4;return function(_0x1ce1b6){logger[_0x0161('0x2d')](_0x1ce1b6[_0x0161('0x2e')]);if(_0x1ce1b6[_0x0161('0x2f')]){delete _0x1ce1b6[_0x0161('0x2f')];}_0x29bbc1[_0x0161('0x1d')](_0x244d09)['send'](_0x1ce1b6);};}exports[_0x0161('0x30')]=function(_0x13535b,_0x2b8b4b){var _0x5cc10a={},_0x3b541e={},_0x2d4509={'count':0x0,'rows':[]};var _0x2a8ae9=_[_0x0161('0x31')](db['SquareOdbc']['rawAttributes'],function(_0x599682){return{'name':_0x599682['fieldName'],'type':_0x599682[_0x0161('0x32')][_0x0161('0x33')]};});_0x3b541e[_0x0161('0x34')]=_[_0x0161('0x31')](_0x2a8ae9,'name');_0x3b541e['query']=_[_0x0161('0x35')](_0x13535b[_0x0161('0x36')]);_0x3b541e[_0x0161('0x37')]=_[_0x0161('0x38')](_0x3b541e['model'],_0x3b541e[_0x0161('0x36')]);_0x5cc10a[_0x0161('0x39')]=_['intersection'](_0x3b541e[_0x0161('0x34')],qs['fields'](_0x13535b[_0x0161('0x36')][_0x0161('0x3a')]));_0x5cc10a[_0x0161('0x39')]=_0x5cc10a[_0x0161('0x39')][_0x0161('0x3b')]?_0x5cc10a[_0x0161('0x39')]:_0x3b541e[_0x0161('0x34')];if(!_0x13535b[_0x0161('0x36')][_0x0161('0x3c')](_0x0161('0x3d'))){_0x5cc10a[_0x0161('0x22')]=qs[_0x0161('0x22')](_0x13535b[_0x0161('0x36')][_0x0161('0x22')]);_0x5cc10a[_0x0161('0x20')]=qs[_0x0161('0x20')](_0x13535b['query'][_0x0161('0x20')]);}_0x5cc10a[_0x0161('0x3e')]=qs['sort'](_0x13535b['query'][_0x0161('0x3f')]);_0x5cc10a[_0x0161('0x40')]=qs['filters'](_[_0x0161('0x41')](_0x13535b[_0x0161('0x36')],_0x3b541e[_0x0161('0x37')]),_0x2a8ae9);if(_0x13535b[_0x0161('0x36')][_0x0161('0x42')]){_0x5cc10a[_0x0161('0x40')]=_['merge'](_0x5cc10a[_0x0161('0x40')],{'$or':_[_0x0161('0x31')](_0x2a8ae9,function(_0x23c57d){if(_0x23c57d[_0x0161('0x32')]!==_0x0161('0x43')){var _0xca0737={};_0xca0737[_0x23c57d[_0x0161('0x2f')]]={'$like':'%'+_0x13535b[_0x0161('0x36')][_0x0161('0x42')]+'%'};return _0xca0737;}})});}_0x5cc10a=_[_0x0161('0x44')]({},_0x5cc10a,_0x13535b['options']);var _0x1a7419={'where':_0x5cc10a[_0x0161('0x40')]};return db['SquareOdbc'][_0x0161('0x23')](_0x1a7419)['then'](function(_0x643d96){_0x2d4509[_0x0161('0x23')]=_0x643d96;if(_0x13535b[_0x0161('0x36')][_0x0161('0x45')]){_0x5cc10a[_0x0161('0x46')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x5cc10a);})[_0x0161('0x28')](function(_0x3bf9fc){_0x2d4509[_0x0161('0x47')]=_0x3bf9fc;return _0x2d4509;})['then'](respondWithFilteredResult(_0x2b8b4b,_0x5cc10a))[_0x0161('0x48')](handleError(_0x2b8b4b,null));};exports[_0x0161('0x49')]=function(_0x43802a,_0x403c9b){var _0x560f5b={'raw':!![],'where':{'id':_0x43802a[_0x0161('0x4a')]['id']}},_0x46d89f={};_0x46d89f[_0x0161('0x34')]=_[_0x0161('0x35')](db['SquareOdbc'][_0x0161('0x4b')]);_0x46d89f[_0x0161('0x36')]=_[_0x0161('0x35')](_0x43802a['query']);_0x46d89f['filters']=_[_0x0161('0x38')](_0x46d89f['model'],_0x46d89f['query']);_0x560f5b[_0x0161('0x39')]=_[_0x0161('0x38')](_0x46d89f[_0x0161('0x34')],qs['fields'](_0x43802a['query'][_0x0161('0x3a')]));_0x560f5b[_0x0161('0x39')]=_0x560f5b[_0x0161('0x39')]['length']?_0x560f5b[_0x0161('0x39')]:_0x46d89f[_0x0161('0x34')];if(_0x43802a['query']['includeAll']){_0x560f5b[_0x0161('0x46')]=[{'all':!![]}];}_0x560f5b=_[_0x0161('0x44')]({},_0x560f5b,_0x43802a['options']);return db[_0x0161('0x4c')][_0x0161('0x4d')](_0x560f5b)[_0x0161('0x28')](handleEntityNotFound(_0x403c9b,null))[_0x0161('0x28')](respondWithResult(_0x403c9b,null))['catch'](handleError(_0x403c9b,null));};exports[_0x0161('0x4e')]=function(_0xd014d2,_0x87c504){return db['SquareOdbc'][_0x0161('0x4e')](_0xd014d2[_0x0161('0x4f')],{})['then'](function(_0x4ed5ed){var _0x71cabc=_0xd014d2[_0x0161('0x50')][_0x0161('0x2a')]({'plain':!![]});if(!_0x71cabc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x71cabc[_0x0161('0x51')]==='user'){var _0x4148ca=_0x4ed5ed[_0x0161('0x2a')]({'plain':!![]});var _0x1113c8=_0x0161('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x1113c8,'userProfileId':_0x71cabc[_0x0161('0x52')]},'raw':!![]})[_0x0161('0x28')](function(_0x40b6e3){if(_0x40b6e3&&_0x40b6e3[_0x0161('0x53')]===0x0){return db[_0x0161('0x2c')]['create']({'name':_0x4148ca[_0x0161('0x2f')],'resourceId':_0x4148ca['id'],'type':_0x40b6e3[_0x0161('0x2f')],'sectionId':_0x40b6e3['id']},{})[_0x0161('0x28')](function(){return _0x4ed5ed;});}else{return _0x4ed5ed;}})[_0x0161('0x48')](function(_0x6930d7){logger['error'](_0x0161('0x54'),_0x6930d7);throw _0x6930d7;});}return _0x4ed5ed;})[_0x0161('0x28')](respondWithResult(_0x87c504,0xc9))[_0x0161('0x48')](handleError(_0x87c504,null));};exports[_0x0161('0x27')]=function(_0x59b3aa,_0x3f2f51){if(_0x59b3aa['body']['id']){delete _0x59b3aa[_0x0161('0x4f')]['id'];}return db[_0x0161('0x4c')]['find']({'where':{'id':_0x59b3aa[_0x0161('0x4a')]['id']}})[_0x0161('0x28')](handleEntityNotFound(_0x3f2f51,null))['then'](saveUpdates(_0x59b3aa[_0x0161('0x4f')],null))[_0x0161('0x28')](respondWithResult(_0x3f2f51,null))[_0x0161('0x48')](handleError(_0x3f2f51,null));};exports[_0x0161('0x29')]=function(_0x186a85,_0x26bc3a){return db[_0x0161('0x4c')][_0x0161('0x4d')]({'where':{'id':_0x186a85[_0x0161('0x4a')]['id']}})[_0x0161('0x28')](handleEntityNotFound(_0x26bc3a,null))[_0x0161('0x28')](removeEntity(_0x26bc3a,null))[_0x0161('0x48')](handleError(_0x26bc3a,null));};exports[_0x0161('0x55')]=function(_0x4a80ba,_0x2795e9,_0x5d63fd){var _0x4af032;return db['SquareOdbc'][_0x0161('0x4d')]({'where':{'id':_0x4a80ba[_0x0161('0x4a')]['id']},'attributes':['id','dsn']})[_0x0161('0x28')](handleEntityNotFound(_0x2795e9,null))[_0x0161('0x28')](function(_0x204f90){if(_0x204f90){var _0x3d215c=require(_0x0161('0x56'))();_0x3d215c[_0x0161('0x57')](_0x204f90['dsn']);_0x3d215c[_0x0161('0x58')]();return _0x204f90;}})[_0x0161('0x28')](respondWithResult(_0x2795e9,null))[_0x0161('0x48')](handleError(_0x2795e9,null));};
\ No newline at end of file