Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 55f1c01..5333ff0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcc4c=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','reject','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','keys','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','odbc','openSync','dsn','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcc4c,0xa1));var _0xccc4=function(_0x3275ae,_0x5e7d28){_0x3275ae=_0x3275ae-0x0;var _0x434c35=_0xcc4c[_0x3275ae];return _0x434c35;};'use strict';var pdf=require(_0xccc4('0x0'));var emlformat=require(_0xccc4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xccc4('0x2'));var jsonpatch=require(_0xccc4('0x3'));var rp=require(_0xccc4('0x4'));var moment=require('moment');var BPromise=require(_0xccc4('0x5'));var Mustache=require(_0xccc4('0x6'));var util=require(_0xccc4('0x7'));var path=require(_0xccc4('0x8'));var sox=require(_0xccc4('0x9'));var csv=require(_0xccc4('0xa'));var ejs=require(_0xccc4('0xb'));var fs=require('fs');var _=require(_0xccc4('0xc'));var squel=require('squel');var crypto=require(_0xccc4('0xd'));var jsforce=require(_0xccc4('0xe'));var deskjs=require(_0xccc4('0xf'));var toCsv=require(_0xccc4('0xa'));var querystring=require(_0xccc4('0x10'));var Papa=require(_0xccc4('0x11'));var Redis=require(_0xccc4('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xccc4('0x13'));var logger=require(_0xccc4('0x14'))(_0xccc4('0x15'));var utils=require(_0xccc4('0x16'));var config=require(_0xccc4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501757,_0xa4b629){_0xa4b629=_0xa4b629||0xcc;return function(_0x2a8f91){if(_0x2a8f91){return _0x501757['sendStatus'](_0xa4b629);}return _0x501757[_0xccc4('0x18')](_0xa4b629)[_0xccc4('0x19')]();};}function respondWithResult(_0x39fdab,_0x55c750){_0x55c750=_0x55c750||0xc8;return function(_0x26e8ad){if(_0x26e8ad){return _0x39fdab[_0xccc4('0x18')](_0x55c750)[_0xccc4('0x1a')](_0x26e8ad);}};}function respondWithFilteredResult(_0x3b3271,_0x472309){return function(_0x21fbf5){if(_0x21fbf5){var _0x1026da=_0x21fbf5[_0xccc4('0x1b')],_0x37a52b=_0x472309[_0xccc4('0x1c')],_0xe73cf8=_0x472309[_0xccc4('0x1c')]+_0x472309['limit'],_0x4d59bf;if(_0xe73cf8>=_0x1026da){_0xe73cf8=_0x1026da;_0x4d59bf=0xc8;}else{_0x4d59bf=0xce;}_0x3b3271['status'](_0x4d59bf);return _0x3b3271[_0xccc4('0x1d')](_0xccc4('0x1e'),_0x37a52b+'-'+_0xe73cf8+'/'+_0x1026da)[_0xccc4('0x1a')](_0x21fbf5);}return null;};}function patchUpdates(_0x301cd2){return function(_0x1e14fd){try{jsonpatch['apply'](_0x1e14fd,_0x301cd2,!![]);}catch(_0x13c444){return BPromise[_0xccc4('0x1f')](_0x13c444);}return _0x1e14fd['save']();};}function saveUpdates(_0x375d58,_0x5c311e){return function(_0x1794ac){if(_0x1794ac){return _0x1794ac['update'](_0x375d58)['then'](function(_0x253f9f){return _0x253f9f;});}return null;};}function removeEntity(_0x4d2241,_0x7dab29){return function(_0x3da0b8){if(_0x3da0b8){return _0x3da0b8[_0xccc4('0x20')]()[_0xccc4('0x21')](function(){var _0x516aaa=_0x3da0b8[_0xccc4('0x22')]({'plain':!![]});var _0xd5ebb9=_0xccc4('0x23');return db[_0xccc4('0x24')]['destroy']({'where':{'type':_0xd5ebb9,'resourceId':_0x516aaa['id']}})[_0xccc4('0x21')](function(){return _0x3da0b8;});})[_0xccc4('0x21')](function(){_0x4d2241[_0xccc4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d024,_0x39a0f4){return function(_0x2fcef5){if(!_0x2fcef5){_0x26d024['sendStatus'](0x194);}return _0x2fcef5;};}function handleError(_0x96c0a6,_0x200a22){_0x200a22=_0x200a22||0x1f4;return function(_0x2dfead){logger[_0xccc4('0x25')](_0x2dfead[_0xccc4('0x26')]);if(_0x2dfead[_0xccc4('0x27')]){delete _0x2dfead[_0xccc4('0x27')];}_0x96c0a6[_0xccc4('0x18')](_0x200a22)[_0xccc4('0x28')](_0x2dfead);};}exports[_0xccc4('0x29')]=function(_0x5dbad6,_0x222b7c){var _0x37c86f={},_0x139295={},_0x1efe9a={'count':0x0,'rows':[]};var _0x166ee0=_[_0xccc4('0x2a')](db[_0xccc4('0x2b')][_0xccc4('0x2c')],function(_0x3f5f6c){return{'name':_0x3f5f6c['fieldName'],'type':_0x3f5f6c[_0xccc4('0x2d')][_0xccc4('0x2e')]};});_0x139295['model']=_[_0xccc4('0x2a')](_0x166ee0,_0xccc4('0x27'));_0x139295[_0xccc4('0x2f')]=_['keys'](_0x5dbad6[_0xccc4('0x2f')]);_0x139295[_0xccc4('0x30')]=_['intersection'](_0x139295[_0xccc4('0x31')],_0x139295['query']);_0x37c86f[_0xccc4('0x32')]=_['intersection'](_0x139295[_0xccc4('0x31')],qs[_0xccc4('0x33')](_0x5dbad6[_0xccc4('0x2f')][_0xccc4('0x33')]));_0x37c86f[_0xccc4('0x32')]=_0x37c86f[_0xccc4('0x32')][_0xccc4('0x34')]?_0x37c86f[_0xccc4('0x32')]:_0x139295['model'];if(!_0x5dbad6['query'][_0xccc4('0x35')](_0xccc4('0x36'))){_0x37c86f[_0xccc4('0x37')]=qs[_0xccc4('0x37')](_0x5dbad6[_0xccc4('0x2f')][_0xccc4('0x37')]);_0x37c86f[_0xccc4('0x1c')]=qs[_0xccc4('0x1c')](_0x5dbad6[_0xccc4('0x2f')][_0xccc4('0x1c')]);}_0x37c86f[_0xccc4('0x38')]=qs[_0xccc4('0x39')](_0x5dbad6[_0xccc4('0x2f')]['sort']);_0x37c86f[_0xccc4('0x3a')]=qs[_0xccc4('0x30')](_[_0xccc4('0x3b')](_0x5dbad6['query'],_0x139295[_0xccc4('0x30')]),_0x166ee0);if(_0x5dbad6[_0xccc4('0x2f')][_0xccc4('0x3c')]){_0x37c86f[_0xccc4('0x3a')]=_[_0xccc4('0x3d')](_0x37c86f[_0xccc4('0x3a')],{'$or':_['map'](_0x166ee0,function(_0x5c33fe){if(_0x5c33fe[_0xccc4('0x2d')]!==_0xccc4('0x3e')){var _0x3e4425={};_0x3e4425[_0x5c33fe['name']]={'$like':'%'+_0x5dbad6[_0xccc4('0x2f')][_0xccc4('0x3c')]+'%'};return _0x3e4425;}})});}_0x37c86f=_['merge']({},_0x37c86f,_0x5dbad6[_0xccc4('0x3f')]);var _0x5c516d={'where':_0x37c86f['where']};return db[_0xccc4('0x2b')][_0xccc4('0x1b')](_0x5c516d)['then'](function(_0x39c4c6){_0x1efe9a['count']=_0x39c4c6;if(_0x5dbad6[_0xccc4('0x2f')]['includeAll']){_0x37c86f[_0xccc4('0x40')]=[{'all':!![]}];}return db[_0xccc4('0x2b')][_0xccc4('0x41')](_0x37c86f);})[_0xccc4('0x21')](function(_0xbb6447){_0x1efe9a['rows']=_0xbb6447;return _0x1efe9a;})['then'](respondWithFilteredResult(_0x222b7c,_0x37c86f))[_0xccc4('0x42')](handleError(_0x222b7c,null));};exports['show']=function(_0x292a84,_0x1664f7){var _0x146076={'raw':!![],'where':{'id':_0x292a84['params']['id']}},_0x56d904={};_0x56d904[_0xccc4('0x31')]=_[_0xccc4('0x43')](db[_0xccc4('0x2b')][_0xccc4('0x2c')]);_0x56d904[_0xccc4('0x2f')]=_[_0xccc4('0x43')](_0x292a84[_0xccc4('0x2f')]);_0x56d904[_0xccc4('0x30')]=_[_0xccc4('0x44')](_0x56d904['model'],_0x56d904[_0xccc4('0x2f')]);_0x146076['attributes']=_[_0xccc4('0x44')](_0x56d904[_0xccc4('0x31')],qs[_0xccc4('0x33')](_0x292a84['query'][_0xccc4('0x33')]));_0x146076[_0xccc4('0x32')]=_0x146076['attributes'][_0xccc4('0x34')]?_0x146076[_0xccc4('0x32')]:_0x56d904[_0xccc4('0x31')];if(_0x292a84[_0xccc4('0x2f')][_0xccc4('0x45')]){_0x146076['include']=[{'all':!![]}];}_0x146076=_[_0xccc4('0x3d')]({},_0x146076,_0x292a84[_0xccc4('0x3f')]);return db['SquareOdbc'][_0xccc4('0x46')](_0x146076)[_0xccc4('0x21')](handleEntityNotFound(_0x1664f7,null))[_0xccc4('0x21')](respondWithResult(_0x1664f7,null))[_0xccc4('0x42')](handleError(_0x1664f7,null));};exports[_0xccc4('0x47')]=function(_0x57fa53,_0x4d8251){return db[_0xccc4('0x2b')][_0xccc4('0x47')](_0x57fa53[_0xccc4('0x48')],{})[_0xccc4('0x21')](function(_0x2355e2){var _0x22c619=_0x57fa53[_0xccc4('0x49')][_0xccc4('0x22')]({'plain':!![]});if(!_0x22c619)throw new Error(_0xccc4('0x4a'));if(_0x22c619[_0xccc4('0x4b')]===_0xccc4('0x49')){var _0x2b2401=_0x2355e2[_0xccc4('0x22')]({'plain':!![]});var _0x42352d=_0xccc4('0x23');return db[_0xccc4('0x4c')]['find']({'where':{'name':_0x42352d,'userProfileId':_0x22c619[_0xccc4('0x4d')]},'raw':!![]})['then'](function(_0x2614d7){if(_0x2614d7&&_0x2614d7[_0xccc4('0x4e')]===0x0){return db[_0xccc4('0x24')]['create']({'name':_0x2b2401[_0xccc4('0x27')],'resourceId':_0x2b2401['id'],'type':_0x2614d7[_0xccc4('0x27')],'sectionId':_0x2614d7['id']},{})['then'](function(){return _0x2355e2;});}else{return _0x2355e2;}})['catch'](function(_0x3faf87){logger[_0xccc4('0x25')](_0xccc4('0x4f'),_0x3faf87);throw _0x3faf87;});}return _0x2355e2;})[_0xccc4('0x21')](respondWithResult(_0x4d8251,0xc9))[_0xccc4('0x42')](handleError(_0x4d8251,null));};exports[_0xccc4('0x50')]=function(_0x53a08b,_0x11d901){if(_0x53a08b[_0xccc4('0x48')]['id']){delete _0x53a08b[_0xccc4('0x48')]['id'];}return db[_0xccc4('0x2b')]['find']({'where':{'id':_0x53a08b[_0xccc4('0x51')]['id']}})[_0xccc4('0x21')](handleEntityNotFound(_0x11d901,null))[_0xccc4('0x21')](saveUpdates(_0x53a08b[_0xccc4('0x48')],null))[_0xccc4('0x21')](respondWithResult(_0x11d901,null))[_0xccc4('0x42')](handleError(_0x11d901,null));};exports['destroy']=function(_0x552513,_0x7ec51a){return db[_0xccc4('0x2b')][_0xccc4('0x46')]({'where':{'id':_0x552513[_0xccc4('0x51')]['id']}})[_0xccc4('0x21')](handleEntityNotFound(_0x7ec51a,null))[_0xccc4('0x21')](removeEntity(_0x7ec51a,null))['catch'](handleError(_0x7ec51a,null));};exports[_0xccc4('0x52')]=function(_0x2ec80c,_0x4ef2a0,_0x4d0960){var _0x25a7a9;return db['SquareOdbc'][_0xccc4('0x46')]({'where':{'id':_0x2ec80c[_0xccc4('0x51')]['id']},'attributes':['id','dsn']})[_0xccc4('0x21')](handleEntityNotFound(_0x4ef2a0,null))[_0xccc4('0x21')](function(_0x6c7a86){if(_0x6c7a86){var _0x38a2ed=require(_0xccc4('0x53'))();_0x38a2ed[_0xccc4('0x54')](_0x6c7a86[_0xccc4('0x55')]);_0x38a2ed[_0xccc4('0x56')]();return _0x6c7a86;}})[_0xccc4('0x21')](respondWithResult(_0x4ef2a0,null))[_0xccc4('0x42')](handleError(_0x4ef2a0,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