Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index c993cc4..5333ff0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd91=['request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','ODBC','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','where','filters','filter','VIRTUAL','merge','options','SquareOdbc','includeAll','show','keys','include','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','params','test','openSync','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x280e11,_0x136cd0){var _0x1211a6=function(_0x2b4413){while(--_0x2b4413){_0x280e11['push'](_0x280e11['shift']());}};_0x1211a6(++_0x136cd0);}(_0xfd91,0x9a));var _0x1fd9=function(_0x55c8cf,_0x944ebc){_0x55c8cf=_0x55c8cf-0x0;var _0x97fd90=_0xfd91[_0x55c8cf];return _0x97fd90;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1fd9('0x0'));var rimraf=require(_0x1fd9('0x1'));var zipdir=require(_0x1fd9('0x2'));var jsonpatch=require(_0x1fd9('0x3'));var rp=require(_0x1fd9('0x4'));var moment=require(_0x1fd9('0x5'));var BPromise=require(_0x1fd9('0x6'));var Mustache=require(_0x1fd9('0x7'));var util=require(_0x1fd9('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1fd9('0x9'));var fs=require('fs');var _=require(_0x1fd9('0xa'));var squel=require(_0x1fd9('0xb'));var crypto=require('crypto');var jsforce=require(_0x1fd9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1fd9('0xd'));var Papa=require(_0x1fd9('0xe'));var Redis=require(_0x1fd9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1fd9('0x10'));var as=require(_0x1fd9('0x11'));var hardwareService=require(_0x1fd9('0x12'));var logger=require('../../config/logger')(_0x1fd9('0x13'));var utils=require(_0x1fd9('0x14'));var config=require(_0x1fd9('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x377e21,_0x187dbb){_0x187dbb=_0x187dbb||0xcc;return function(_0x48cd29){if(_0x48cd29){return _0x377e21['sendStatus'](_0x187dbb);}return _0x377e21[_0x1fd9('0x16')](_0x187dbb)[_0x1fd9('0x17')]();};}function respondWithResult(_0x1939f0,_0x48f09a){_0x48f09a=_0x48f09a||0xc8;return function(_0x5145d4){if(_0x5145d4){return _0x1939f0[_0x1fd9('0x16')](_0x48f09a)[_0x1fd9('0x18')](_0x5145d4);}};}function respondWithFilteredResult(_0x4dab27,_0x48f49f){return function(_0x3d2360){if(_0x3d2360){var _0x5e6d3d=_0x3d2360[_0x1fd9('0x19')],_0x14718f=_0x48f49f[_0x1fd9('0x1a')],_0xd3b556=_0x48f49f[_0x1fd9('0x1a')]+_0x48f49f[_0x1fd9('0x1b')],_0x2f3b9b;if(_0xd3b556>=_0x5e6d3d){_0xd3b556=_0x5e6d3d;_0x2f3b9b=0xc8;}else{_0x2f3b9b=0xce;}_0x4dab27[_0x1fd9('0x16')](_0x2f3b9b);return _0x4dab27[_0x1fd9('0x1c')](_0x1fd9('0x1d'),_0x14718f+'-'+_0xd3b556+'/'+_0x5e6d3d)[_0x1fd9('0x18')](_0x3d2360);}return null;};}function patchUpdates(_0x1c5f86){return function(_0x56ab0f){try{jsonpatch[_0x1fd9('0x1e')](_0x56ab0f,_0x1c5f86,!![]);}catch(_0x2a9963){return BPromise['reject'](_0x2a9963);}return _0x56ab0f[_0x1fd9('0x1f')]();};}function saveUpdates(_0x4bbc01,_0x425674){return function(_0xa65a3e){if(_0xa65a3e){return _0xa65a3e[_0x1fd9('0x20')](_0x4bbc01)[_0x1fd9('0x21')](function(_0x3d6a3c){return _0x3d6a3c;});}return null;};}function removeEntity(_0x52137e,_0x27e04d){return function(_0x58df7c){if(_0x58df7c){return _0x58df7c[_0x1fd9('0x22')]()[_0x1fd9('0x21')](function(){var _0x4aa3a2=_0x58df7c['get']({'plain':!![]});var _0x4a30df=_0x1fd9('0x23');return db[_0x1fd9('0x24')][_0x1fd9('0x22')]({'where':{'type':_0x4a30df,'resourceId':_0x4aa3a2['id']}})[_0x1fd9('0x21')](function(){return _0x58df7c;});})[_0x1fd9('0x21')](function(){_0x52137e[_0x1fd9('0x16')](0xcc)[_0x1fd9('0x17')]();});}};}function handleEntityNotFound(_0x335587,_0x5504f2){return function(_0xb760f8){if(!_0xb760f8){_0x335587[_0x1fd9('0x25')](0x194);}return _0xb760f8;};}function handleError(_0x46ccae,_0x23fc30){_0x23fc30=_0x23fc30||0x1f4;return function(_0xd09d85){logger['error'](_0xd09d85[_0x1fd9('0x26')]);if(_0xd09d85['name']){delete _0xd09d85[_0x1fd9('0x27')];}_0x46ccae[_0x1fd9('0x16')](_0x23fc30)['send'](_0xd09d85);};}exports[_0x1fd9('0x28')]=function(_0x4a3d66,_0x238fce){var _0x6502f6={},_0x2333da={},_0x18f08e={'count':0x0,'rows':[]};var _0x497f1c=_[_0x1fd9('0x29')](db['SquareOdbc'][_0x1fd9('0x2a')],function(_0x45e907){return{'name':_0x45e907[_0x1fd9('0x2b')],'type':_0x45e907[_0x1fd9('0x2c')][_0x1fd9('0x2d')]};});_0x2333da['model']=_['map'](_0x497f1c,_0x1fd9('0x27'));_0x2333da['query']=_['keys'](_0x4a3d66[_0x1fd9('0x2e')]);_0x2333da['filters']=_[_0x1fd9('0x2f')](_0x2333da[_0x1fd9('0x30')],_0x2333da['query']);_0x6502f6[_0x1fd9('0x31')]=_[_0x1fd9('0x2f')](_0x2333da[_0x1fd9('0x30')],qs[_0x1fd9('0x32')](_0x4a3d66[_0x1fd9('0x2e')][_0x1fd9('0x32')]));_0x6502f6[_0x1fd9('0x31')]=_0x6502f6[_0x1fd9('0x31')][_0x1fd9('0x33')]?_0x6502f6[_0x1fd9('0x31')]:_0x2333da[_0x1fd9('0x30')];if(!_0x4a3d66[_0x1fd9('0x2e')]['hasOwnProperty'](_0x1fd9('0x34'))){_0x6502f6[_0x1fd9('0x1b')]=qs['limit'](_0x4a3d66[_0x1fd9('0x2e')][_0x1fd9('0x1b')]);_0x6502f6[_0x1fd9('0x1a')]=qs[_0x1fd9('0x1a')](_0x4a3d66['query'][_0x1fd9('0x1a')]);}_0x6502f6['order']=qs['sort'](_0x4a3d66[_0x1fd9('0x2e')]['sort']);_0x6502f6[_0x1fd9('0x35')]=qs[_0x1fd9('0x36')](_['pick'](_0x4a3d66[_0x1fd9('0x2e')],_0x2333da['filters']),_0x497f1c);if(_0x4a3d66[_0x1fd9('0x2e')][_0x1fd9('0x37')]){_0x6502f6[_0x1fd9('0x35')]=_['merge'](_0x6502f6['where'],{'$or':_[_0x1fd9('0x29')](_0x497f1c,function(_0x7b8206){if(_0x7b8206[_0x1fd9('0x2c')]!==_0x1fd9('0x38')){var _0x2824eb={};_0x2824eb[_0x7b8206[_0x1fd9('0x27')]]={'$like':'%'+_0x4a3d66[_0x1fd9('0x2e')][_0x1fd9('0x37')]+'%'};return _0x2824eb;}})});}_0x6502f6=_[_0x1fd9('0x39')]({},_0x6502f6,_0x4a3d66[_0x1fd9('0x3a')]);var _0x4f5ba0={'where':_0x6502f6['where']};return db[_0x1fd9('0x3b')][_0x1fd9('0x19')](_0x4f5ba0)[_0x1fd9('0x21')](function(_0x4fb7ef){_0x18f08e[_0x1fd9('0x19')]=_0x4fb7ef;if(_0x4a3d66[_0x1fd9('0x2e')][_0x1fd9('0x3c')]){_0x6502f6['include']=[{'all':!![]}];}return db[_0x1fd9('0x3b')]['findAll'](_0x6502f6);})['then'](function(_0x579ccf){_0x18f08e['rows']=_0x579ccf;return _0x18f08e;})['then'](respondWithFilteredResult(_0x238fce,_0x6502f6))['catch'](handleError(_0x238fce,null));};exports[_0x1fd9('0x3d')]=function(_0x10397d,_0x1b6625){var _0x2d46ec={'raw':!![],'where':{'id':_0x10397d['params']['id']}},_0x416249={};_0x416249[_0x1fd9('0x30')]=_[_0x1fd9('0x3e')](db[_0x1fd9('0x3b')][_0x1fd9('0x2a')]);_0x416249[_0x1fd9('0x2e')]=_[_0x1fd9('0x3e')](_0x10397d['query']);_0x416249[_0x1fd9('0x36')]=_['intersection'](_0x416249[_0x1fd9('0x30')],_0x416249[_0x1fd9('0x2e')]);_0x2d46ec[_0x1fd9('0x31')]=_[_0x1fd9('0x2f')](_0x416249[_0x1fd9('0x30')],qs[_0x1fd9('0x32')](_0x10397d[_0x1fd9('0x2e')][_0x1fd9('0x32')]));_0x2d46ec[_0x1fd9('0x31')]=_0x2d46ec[_0x1fd9('0x31')][_0x1fd9('0x33')]?_0x2d46ec['attributes']:_0x416249[_0x1fd9('0x30')];if(_0x10397d[_0x1fd9('0x2e')][_0x1fd9('0x3c')]){_0x2d46ec[_0x1fd9('0x3f')]=[{'all':!![]}];}_0x2d46ec=_[_0x1fd9('0x39')]({},_0x2d46ec,_0x10397d[_0x1fd9('0x3a')]);return db[_0x1fd9('0x3b')][_0x1fd9('0x40')](_0x2d46ec)[_0x1fd9('0x21')](handleEntityNotFound(_0x1b6625,null))[_0x1fd9('0x21')](respondWithResult(_0x1b6625,null))[_0x1fd9('0x41')](handleError(_0x1b6625,null));};exports[_0x1fd9('0x42')]=function(_0x1aa5a8,_0x1e6145){return db[_0x1fd9('0x3b')][_0x1fd9('0x42')](_0x1aa5a8[_0x1fd9('0x43')],{})['then'](function(_0x6aa07b){var _0x5c0dc8=_0x1aa5a8['user'][_0x1fd9('0x44')]({'plain':!![]});if(!_0x5c0dc8)throw new Error(_0x1fd9('0x45'));if(_0x5c0dc8[_0x1fd9('0x46')]===_0x1fd9('0x47')){var _0x342f48=_0x6aa07b[_0x1fd9('0x44')]({'plain':!![]});var _0x52060b=_0x1fd9('0x23');return db[_0x1fd9('0x48')][_0x1fd9('0x40')]({'where':{'name':_0x52060b,'userProfileId':_0x5c0dc8[_0x1fd9('0x49')]},'raw':!![]})[_0x1fd9('0x21')](function(_0xdbf2ca){if(_0xdbf2ca&&_0xdbf2ca[_0x1fd9('0x4a')]===0x0){return db['UserProfileResource'][_0x1fd9('0x42')]({'name':_0x342f48['name'],'resourceId':_0x342f48['id'],'type':_0xdbf2ca[_0x1fd9('0x27')],'sectionId':_0xdbf2ca['id']},{})['then'](function(){return _0x6aa07b;});}else{return _0x6aa07b;}})[_0x1fd9('0x41')](function(_0x5d6279){logger[_0x1fd9('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d6279);throw _0x5d6279;});}return _0x6aa07b;})[_0x1fd9('0x21')](respondWithResult(_0x1e6145,0xc9))[_0x1fd9('0x41')](handleError(_0x1e6145,null));};exports[_0x1fd9('0x20')]=function(_0x3a7560,_0x4b52d1){if(_0x3a7560[_0x1fd9('0x43')]['id']){delete _0x3a7560['body']['id'];}return db['SquareOdbc'][_0x1fd9('0x40')]({'where':{'id':_0x3a7560[_0x1fd9('0x4c')]['id']}})[_0x1fd9('0x21')](handleEntityNotFound(_0x4b52d1,null))[_0x1fd9('0x21')](saveUpdates(_0x3a7560['body'],null))['then'](respondWithResult(_0x4b52d1,null))[_0x1fd9('0x41')](handleError(_0x4b52d1,null));};exports['destroy']=function(_0x4060b3,_0x10d9ca){return db[_0x1fd9('0x3b')][_0x1fd9('0x40')]({'where':{'id':_0x4060b3['params']['id']}})[_0x1fd9('0x21')](handleEntityNotFound(_0x10d9ca,null))[_0x1fd9('0x21')](removeEntity(_0x10d9ca,null))[_0x1fd9('0x41')](handleError(_0x10d9ca,null));};exports[_0x1fd9('0x4d')]=function(_0x595a6c,_0x9a89a,_0x320ce3){var _0x26394e;return db[_0x1fd9('0x3b')][_0x1fd9('0x40')]({'where':{'id':_0x595a6c['params']['id']},'attributes':['id','dsn']})[_0x1fd9('0x21')](handleEntityNotFound(_0x9a89a,null))['then'](function(_0x43528f){if(_0x43528f){var _0x544cdd=require('odbc')();_0x544cdd[_0x1fd9('0x4e')](_0x43528f['dsn']);_0x544cdd['closeSync']();return _0x43528f;}})[_0x1fd9('0x21')](respondWithResult(_0x9a89a,null))['catch'](handleError(_0x9a89a,null));};
\ No newline at end of file
+var _0xa6fe=['get','ODBC','UserProfileResource','end','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy'];(function(_0x5e745e,_0xde2931){var _0x122dab=function(_0xe396a5){while(--_0xe396a5){_0x5e745e['push'](_0x5e745e['shift']());}};_0x122dab(++_0xde2931);}(_0xa6fe,0x90));var _0xea6f=function(_0x428547,_0x56e2af){_0x428547=_0x428547-0x0;var _0x4c350b=_0xa6fe[_0x428547];return _0x4c350b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea6f('0x0'));var zipdir=require(_0xea6f('0x1'));var jsonpatch=require(_0xea6f('0x2'));var rp=require(_0xea6f('0x3'));var moment=require(_0xea6f('0x4'));var BPromise=require(_0xea6f('0x5'));var Mustache=require(_0xea6f('0x6'));var util=require('util');var path=require(_0xea6f('0x7'));var sox=require('sox');var csv=require(_0xea6f('0x8'));var ejs=require(_0xea6f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea6f('0xa'));var squel=require(_0xea6f('0xb'));var crypto=require(_0xea6f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xea6f('0xd'));var toCsv=require(_0xea6f('0x8'));var querystring=require(_0xea6f('0xe'));var Papa=require(_0xea6f('0xf'));var Redis=require(_0xea6f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xea6f('0x11'));var as=require(_0xea6f('0x12'));var hardwareService=require(_0xea6f('0x13'));var logger=require(_0xea6f('0x14'))('api');var utils=require(_0xea6f('0x15'));var config=require(_0xea6f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xea6f('0x17'))['db'];function respondWithStatusCode(_0x3e4f3c,_0x3b1acc){_0x3b1acc=_0x3b1acc||0xcc;return function(_0x3b6806){if(_0x3b6806){return _0x3e4f3c[_0xea6f('0x18')](_0x3b1acc);}return _0x3e4f3c['status'](_0x3b1acc)['end']();};}function respondWithResult(_0x1cc951,_0x26d4d1){_0x26d4d1=_0x26d4d1||0xc8;return function(_0x171f30){if(_0x171f30){return _0x1cc951[_0xea6f('0x19')](_0x26d4d1)[_0xea6f('0x1a')](_0x171f30);}};}function respondWithFilteredResult(_0xd62a6f,_0x5d673c){return function(_0x59f854){if(_0x59f854){var _0x16d0ae=typeof _0x5d673c['offset']===_0xea6f('0x1b')&&typeof _0x5d673c[_0xea6f('0x1c')]===_0xea6f('0x1b');var _0x320071=_0x59f854['count'];var _0x28b205=_0x16d0ae?0x0:_0x5d673c[_0xea6f('0x1d')];var _0x3a6008=_0x16d0ae?_0x59f854['count']:_0x5d673c['offset']+_0x5d673c[_0xea6f('0x1c')];var _0x284298;if(_0x3a6008>=_0x320071){_0x3a6008=_0x320071;_0x284298=0xc8;}else{_0x284298=0xce;}_0xd62a6f[_0xea6f('0x19')](_0x284298);return _0xd62a6f[_0xea6f('0x1e')](_0xea6f('0x1f'),_0x28b205+'-'+_0x3a6008+'/'+_0x320071)[_0xea6f('0x1a')](_0x59f854);}return null;};}function patchUpdates(_0x6e66d8){return function(_0x1aeec2){try{jsonpatch['apply'](_0x1aeec2,_0x6e66d8,!![]);}catch(_0x435646){return BPromise['reject'](_0x435646);}return _0x1aeec2[_0xea6f('0x20')]();};}function saveUpdates(_0xd8afe4,_0x2d0901){return function(_0x609941){if(_0x609941){return _0x609941[_0xea6f('0x21')](_0xd8afe4)[_0xea6f('0x22')](function(_0x15e1b3){return _0x15e1b3;});}return null;};}function removeEntity(_0x19830f,_0x11e7a8){return function(_0x500c98){if(_0x500c98){return _0x500c98[_0xea6f('0x23')]()[_0xea6f('0x22')](function(){var _0x8ed09f=_0x500c98[_0xea6f('0x24')]({'plain':!![]});var _0x49ec49=_0xea6f('0x25');return db[_0xea6f('0x26')][_0xea6f('0x23')]({'where':{'type':_0x49ec49,'resourceId':_0x8ed09f['id']}})['then'](function(){return _0x500c98;});})[_0xea6f('0x22')](function(){_0x19830f['status'](0xcc)[_0xea6f('0x27')]();});}};}function handleEntityNotFound(_0x5e5e76,_0xec9576){return function(_0x7c78f6){if(!_0x7c78f6){_0x5e5e76['sendStatus'](0x194);}return _0x7c78f6;};}function handleError(_0x4a2ecf,_0x19c5a8){_0x19c5a8=_0x19c5a8||0x1f4;return function(_0x2ca820){logger[_0xea6f('0x28')](_0x2ca820[_0xea6f('0x29')]);if(_0x2ca820[_0xea6f('0x2a')]){delete _0x2ca820[_0xea6f('0x2a')];}_0x4a2ecf[_0xea6f('0x19')](_0x19c5a8)[_0xea6f('0x2b')](_0x2ca820);};}exports[_0xea6f('0x2c')]=function(_0x1f0b8f,_0x23141b){var _0xc4486f={},_0x402dc1={},_0x29a2e5={'count':0x0,'rows':[]};var _0x206802=_[_0xea6f('0x2d')](db[_0xea6f('0x2e')][_0xea6f('0x2f')],function(_0x573244){return{'name':_0x573244[_0xea6f('0x30')],'type':_0x573244[_0xea6f('0x31')][_0xea6f('0x32')]};});_0x402dc1['model']=_[_0xea6f('0x2d')](_0x206802,'name');_0x402dc1['query']=_[_0xea6f('0x33')](_0x1f0b8f[_0xea6f('0x34')]);_0x402dc1[_0xea6f('0x35')]=_[_0xea6f('0x36')](_0x402dc1['model'],_0x402dc1[_0xea6f('0x34')]);_0xc4486f['attributes']=_['intersection'](_0x402dc1[_0xea6f('0x37')],qs[_0xea6f('0x38')](_0x1f0b8f[_0xea6f('0x34')][_0xea6f('0x38')]));_0xc4486f[_0xea6f('0x39')]=_0xc4486f[_0xea6f('0x39')][_0xea6f('0x3a')]?_0xc4486f['attributes']:_0x402dc1[_0xea6f('0x37')];if(!_0x1f0b8f[_0xea6f('0x34')][_0xea6f('0x3b')](_0xea6f('0x3c'))){_0xc4486f[_0xea6f('0x1c')]=qs[_0xea6f('0x1c')](_0x1f0b8f['query'][_0xea6f('0x1c')]);_0xc4486f[_0xea6f('0x1d')]=qs[_0xea6f('0x1d')](_0x1f0b8f[_0xea6f('0x34')][_0xea6f('0x1d')]);}_0xc4486f['order']=qs[_0xea6f('0x3d')](_0x1f0b8f[_0xea6f('0x34')][_0xea6f('0x3d')]);_0xc4486f[_0xea6f('0x3e')]=qs[_0xea6f('0x35')](_[_0xea6f('0x3f')](_0x1f0b8f['query'],_0x402dc1[_0xea6f('0x35')]),_0x206802);if(_0x1f0b8f[_0xea6f('0x34')][_0xea6f('0x40')]){_0xc4486f[_0xea6f('0x3e')]=_[_0xea6f('0x41')](_0xc4486f[_0xea6f('0x3e')],{'$or':_['map'](_0x206802,function(_0x36219e){if(_0x36219e[_0xea6f('0x31')]!==_0xea6f('0x42')){var _0x1b4146={};_0x1b4146[_0x36219e[_0xea6f('0x2a')]]={'$like':'%'+_0x1f0b8f['query']['filter']+'%'};return _0x1b4146;}})});}_0xc4486f=_[_0xea6f('0x41')]({},_0xc4486f,_0x1f0b8f[_0xea6f('0x43')]);var _0x5a5b54={'where':_0xc4486f['where']};return db[_0xea6f('0x2e')][_0xea6f('0x44')](_0x5a5b54)[_0xea6f('0x22')](function(_0x29e5a7){_0x29a2e5[_0xea6f('0x44')]=_0x29e5a7;if(_0x1f0b8f[_0xea6f('0x34')][_0xea6f('0x45')]){_0xc4486f[_0xea6f('0x46')]=[{'all':!![]}];}return db[_0xea6f('0x2e')][_0xea6f('0x47')](_0xc4486f);})[_0xea6f('0x22')](function(_0x35fdaf){_0x29a2e5[_0xea6f('0x48')]=_0x35fdaf;return _0x29a2e5;})[_0xea6f('0x22')](respondWithFilteredResult(_0x23141b,_0xc4486f))[_0xea6f('0x49')](handleError(_0x23141b,null));};exports[_0xea6f('0x4a')]=function(_0x64732b,_0x595251){var _0x145d63={'raw':!![],'where':{'id':_0x64732b['params']['id']}},_0xc13dd6={};_0xc13dd6[_0xea6f('0x37')]=_['keys'](db[_0xea6f('0x2e')][_0xea6f('0x2f')]);_0xc13dd6['query']=_['keys'](_0x64732b[_0xea6f('0x34')]);_0xc13dd6[_0xea6f('0x35')]=_[_0xea6f('0x36')](_0xc13dd6[_0xea6f('0x37')],_0xc13dd6['query']);_0x145d63[_0xea6f('0x39')]=_[_0xea6f('0x36')](_0xc13dd6[_0xea6f('0x37')],qs[_0xea6f('0x38')](_0x64732b[_0xea6f('0x34')][_0xea6f('0x38')]));_0x145d63[_0xea6f('0x39')]=_0x145d63[_0xea6f('0x39')][_0xea6f('0x3a')]?_0x145d63['attributes']:_0xc13dd6['model'];if(_0x64732b[_0xea6f('0x34')]['includeAll']){_0x145d63['include']=[{'all':!![]}];}_0x145d63=_[_0xea6f('0x41')]({},_0x145d63,_0x64732b['options']);return db[_0xea6f('0x2e')][_0xea6f('0x4b')](_0x145d63)[_0xea6f('0x22')](handleEntityNotFound(_0x595251,null))[_0xea6f('0x22')](respondWithResult(_0x595251,null))[_0xea6f('0x49')](handleError(_0x595251,null));};exports[_0xea6f('0x4c')]=function(_0x21713f,_0xcc1e0a){return db[_0xea6f('0x2e')][_0xea6f('0x4c')](_0x21713f[_0xea6f('0x4d')],{})['then'](function(_0x3cb5d9){var _0x32118d=_0x21713f['user'][_0xea6f('0x24')]({'plain':!![]});if(!_0x32118d)throw new Error(_0xea6f('0x4e'));if(_0x32118d[_0xea6f('0x4f')]===_0xea6f('0x50')){var _0x14c6e0=_0x3cb5d9[_0xea6f('0x24')]({'plain':!![]});var _0x6b93c7=_0xea6f('0x25');return db[_0xea6f('0x51')][_0xea6f('0x4b')]({'where':{'name':_0x6b93c7,'userProfileId':_0x32118d[_0xea6f('0x52')]},'raw':!![]})[_0xea6f('0x22')](function(_0x2a8eb1){if(_0x2a8eb1&&_0x2a8eb1[_0xea6f('0x53')]===0x0){return db[_0xea6f('0x26')][_0xea6f('0x4c')]({'name':_0x14c6e0[_0xea6f('0x2a')],'resourceId':_0x14c6e0['id'],'type':_0x2a8eb1[_0xea6f('0x2a')],'sectionId':_0x2a8eb1['id']},{})[_0xea6f('0x22')](function(){return _0x3cb5d9;});}else{return _0x3cb5d9;}})[_0xea6f('0x49')](function(_0x404ea5){logger[_0xea6f('0x28')](_0xea6f('0x54'),_0x404ea5);throw _0x404ea5;});}return _0x3cb5d9;})[_0xea6f('0x22')](respondWithResult(_0xcc1e0a,0xc9))[_0xea6f('0x49')](handleError(_0xcc1e0a,null));};exports['update']=function(_0x12bdc7,_0x41c960){if(_0x12bdc7['body']['id']){delete _0x12bdc7[_0xea6f('0x4d')]['id'];}return db['SquareOdbc'][_0xea6f('0x4b')]({'where':{'id':_0x12bdc7[_0xea6f('0x55')]['id']}})['then'](handleEntityNotFound(_0x41c960,null))['then'](saveUpdates(_0x12bdc7[_0xea6f('0x4d')],null))[_0xea6f('0x22')](respondWithResult(_0x41c960,null))[_0xea6f('0x49')](handleError(_0x41c960,null));};exports[_0xea6f('0x23')]=function(_0x2d8dfb,_0x2800ea){return db['SquareOdbc'][_0xea6f('0x4b')]({'where':{'id':_0x2d8dfb[_0xea6f('0x55')]['id']}})['then'](handleEntityNotFound(_0x2800ea,null))[_0xea6f('0x22')](removeEntity(_0x2800ea,null))[_0xea6f('0x49')](handleError(_0x2800ea,null));};exports[_0xea6f('0x56')]=function(_0x313ead,_0x5be336,_0x2cf4ea){var _0xd5d334;return db[_0xea6f('0x2e')]['find']({'where':{'id':_0x313ead[_0xea6f('0x55')]['id']},'attributes':['id',_0xea6f('0x57')]})[_0xea6f('0x22')](handleEntityNotFound(_0x5be336,null))[_0xea6f('0x22')](function(_0x13004d){if(_0x13004d){var _0x524617=require(_0xea6f('0x58'))();_0x524617[_0xea6f('0x59')](_0x13004d['dsn']);_0x524617['closeSync']();return _0x13004d;}})['then'](respondWithResult(_0x5be336,null))['catch'](handleError(_0x5be336,null));};
\ No newline at end of file