Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index ef10ae8..5333ff0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6043=['ODBC','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get'];(function(_0x509fdb,_0x2230ae){var _0xf0af2d=function(_0x444a5c){while(--_0x444a5c){_0x509fdb['push'](_0x509fdb['shift']());}};_0xf0af2d(++_0x2230ae);}(_0x6043,0x136));var _0x3604=function(_0x32986,_0x4489c8){_0x32986=_0x32986-0x0;var _0x355ebb=_0x6043[_0x32986];return _0x355ebb;};'use strict';var emlformat=require(_0x3604('0x0'));var rimraf=require(_0x3604('0x1'));var zipdir=require(_0x3604('0x2'));var jsonpatch=require(_0x3604('0x3'));var rp=require(_0x3604('0x4'));var moment=require(_0x3604('0x5'));var BPromise=require(_0x3604('0x6'));var Mustache=require(_0x3604('0x7'));var util=require(_0x3604('0x8'));var path=require('path');var sox=require(_0x3604('0x9'));var csv=require(_0x3604('0xa'));var ejs=require(_0x3604('0xb'));var fs=require('fs');var fs_extra=require(_0x3604('0xc'));var _=require(_0x3604('0xd'));var squel=require(_0x3604('0xe'));var crypto=require(_0x3604('0xf'));var jsforce=require(_0x3604('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3604('0xa'));var querystring=require(_0x3604('0x11'));var Papa=require(_0x3604('0x12'));var Redis=require('ioredis');var authService=require(_0x3604('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3604('0x14'));var hardwareService=require(_0x3604('0x15'));var logger=require('../../config/logger')(_0x3604('0x16'));var utils=require(_0x3604('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3604('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4461cf,_0x5da40b){_0x5da40b=_0x5da40b||0xcc;return function(_0x4a51aa){if(_0x4a51aa){return _0x4461cf[_0x3604('0x19')](_0x5da40b);}return _0x4461cf[_0x3604('0x1a')](_0x5da40b)[_0x3604('0x1b')]();};}function respondWithResult(_0x24a4b6,_0x5618a3){_0x5618a3=_0x5618a3||0xc8;return function(_0x157862){if(_0x157862){return _0x24a4b6[_0x3604('0x1a')](_0x5618a3)['json'](_0x157862);}};}function respondWithFilteredResult(_0x4d18b8,_0x1a8db2){return function(_0x1200b5){if(_0x1200b5){var _0x143e7c=typeof _0x1a8db2[_0x3604('0x1c')]===_0x3604('0x1d')&&typeof _0x1a8db2['limit']===_0x3604('0x1d');var _0x5a85f8=_0x1200b5[_0x3604('0x1e')];var _0x2f5e4d=_0x143e7c?0x0:_0x1a8db2[_0x3604('0x1c')];var _0x3ee8cc=_0x143e7c?_0x1200b5[_0x3604('0x1e')]:_0x1a8db2['offset']+_0x1a8db2[_0x3604('0x1f')];var _0x23aefb;if(_0x3ee8cc>=_0x5a85f8){_0x3ee8cc=_0x5a85f8;_0x23aefb=0xc8;}else{_0x23aefb=0xce;}_0x4d18b8[_0x3604('0x1a')](_0x23aefb);return _0x4d18b8[_0x3604('0x20')](_0x3604('0x21'),_0x2f5e4d+'-'+_0x3ee8cc+'/'+_0x5a85f8)[_0x3604('0x22')](_0x1200b5);}return null;};}function patchUpdates(_0x4eb6e1){return function(_0x5ca30f){try{jsonpatch[_0x3604('0x23')](_0x5ca30f,_0x4eb6e1,!![]);}catch(_0x3ec019){return BPromise[_0x3604('0x24')](_0x3ec019);}return _0x5ca30f[_0x3604('0x25')]();};}function saveUpdates(_0x47dc19,_0x1d82ce){return function(_0xeb1606){if(_0xeb1606){return _0xeb1606[_0x3604('0x26')](_0x47dc19)[_0x3604('0x27')](function(_0x590deb){return _0x590deb;});}return null;};}function removeEntity(_0x2f0d52,_0x307039){return function(_0x381717){if(_0x381717){return _0x381717[_0x3604('0x28')]()[_0x3604('0x27')](function(){var _0x5dc9a8=_0x381717[_0x3604('0x29')]({'plain':!![]});var _0x469852=_0x3604('0x2a');return db['UserProfileResource'][_0x3604('0x28')]({'where':{'type':_0x469852,'resourceId':_0x5dc9a8['id']}})[_0x3604('0x27')](function(){return _0x381717;});})[_0x3604('0x27')](function(){_0x2f0d52['status'](0xcc)[_0x3604('0x1b')]();});}};}function handleEntityNotFound(_0x1f6a1d,_0x2cd8b6){return function(_0x3bff32){if(!_0x3bff32){_0x1f6a1d['sendStatus'](0x194);}return _0x3bff32;};}function handleError(_0x30923b,_0x420870){_0x420870=_0x420870||0x1f4;return function(_0x425215){logger['error'](_0x425215[_0x3604('0x2b')]);if(_0x425215[_0x3604('0x2c')]){delete _0x425215[_0x3604('0x2c')];}_0x30923b[_0x3604('0x1a')](_0x420870)[_0x3604('0x2d')](_0x425215);};}exports[_0x3604('0x2e')]=function(_0x337db8,_0x20d8d1){var _0x111d99={},_0x20fa66={},_0x5e8acd={'count':0x0,'rows':[]};var _0x298aa8=_[_0x3604('0x2f')](db[_0x3604('0x30')][_0x3604('0x31')],function(_0x1f5bf7){return{'name':_0x1f5bf7[_0x3604('0x32')],'type':_0x1f5bf7['type']['key']};});_0x20fa66[_0x3604('0x33')]=_[_0x3604('0x2f')](_0x298aa8,_0x3604('0x2c'));_0x20fa66['query']=_[_0x3604('0x34')](_0x337db8[_0x3604('0x35')]);_0x20fa66[_0x3604('0x36')]=_[_0x3604('0x37')](_0x20fa66[_0x3604('0x33')],_0x20fa66['query']);_0x111d99['attributes']=_[_0x3604('0x37')](_0x20fa66[_0x3604('0x33')],qs[_0x3604('0x38')](_0x337db8['query'][_0x3604('0x38')]));_0x111d99['attributes']=_0x111d99[_0x3604('0x39')][_0x3604('0x3a')]?_0x111d99[_0x3604('0x39')]:_0x20fa66[_0x3604('0x33')];if(!_0x337db8[_0x3604('0x35')][_0x3604('0x3b')](_0x3604('0x3c'))){_0x111d99[_0x3604('0x1f')]=qs[_0x3604('0x1f')](_0x337db8['query'][_0x3604('0x1f')]);_0x111d99['offset']=qs[_0x3604('0x1c')](_0x337db8[_0x3604('0x35')][_0x3604('0x1c')]);}_0x111d99[_0x3604('0x3d')]=qs[_0x3604('0x3e')](_0x337db8[_0x3604('0x35')]['sort']);_0x111d99[_0x3604('0x3f')]=qs['filters'](_[_0x3604('0x40')](_0x337db8[_0x3604('0x35')],_0x20fa66['filters']),_0x298aa8);if(_0x337db8['query'][_0x3604('0x41')]){_0x111d99[_0x3604('0x3f')]=_[_0x3604('0x42')](_0x111d99[_0x3604('0x3f')],{'$or':_['map'](_0x298aa8,function(_0x763fcf){if(_0x763fcf[_0x3604('0x43')]!==_0x3604('0x44')){var _0x21d0d9={};_0x21d0d9[_0x763fcf[_0x3604('0x2c')]]={'$like':'%'+_0x337db8[_0x3604('0x35')][_0x3604('0x41')]+'%'};return _0x21d0d9;}})});}_0x111d99=_[_0x3604('0x42')]({},_0x111d99,_0x337db8[_0x3604('0x45')]);var _0x1893e4={'where':_0x111d99[_0x3604('0x3f')]};return db[_0x3604('0x30')][_0x3604('0x1e')](_0x1893e4)[_0x3604('0x27')](function(_0x3244fa){_0x5e8acd[_0x3604('0x1e')]=_0x3244fa;if(_0x337db8[_0x3604('0x35')][_0x3604('0x46')]){_0x111d99[_0x3604('0x47')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x111d99);})[_0x3604('0x27')](function(_0x171ca9){_0x5e8acd[_0x3604('0x48')]=_0x171ca9;return _0x5e8acd;})[_0x3604('0x27')](respondWithFilteredResult(_0x20d8d1,_0x111d99))[_0x3604('0x49')](handleError(_0x20d8d1,null));};exports[_0x3604('0x4a')]=function(_0x2bb460,_0x3105ac){var _0x1606d7={'raw':!![],'where':{'id':_0x2bb460[_0x3604('0x4b')]['id']}},_0x2fc29a={};_0x2fc29a[_0x3604('0x33')]=_[_0x3604('0x34')](db[_0x3604('0x30')]['rawAttributes']);_0x2fc29a[_0x3604('0x35')]=_['keys'](_0x2bb460[_0x3604('0x35')]);_0x2fc29a[_0x3604('0x36')]=_['intersection'](_0x2fc29a[_0x3604('0x33')],_0x2fc29a[_0x3604('0x35')]);_0x1606d7[_0x3604('0x39')]=_[_0x3604('0x37')](_0x2fc29a[_0x3604('0x33')],qs[_0x3604('0x38')](_0x2bb460[_0x3604('0x35')][_0x3604('0x38')]));_0x1606d7[_0x3604('0x39')]=_0x1606d7[_0x3604('0x39')][_0x3604('0x3a')]?_0x1606d7[_0x3604('0x39')]:_0x2fc29a['model'];if(_0x2bb460[_0x3604('0x35')][_0x3604('0x46')]){_0x1606d7['include']=[{'all':!![]}];}_0x1606d7=_[_0x3604('0x42')]({},_0x1606d7,_0x2bb460[_0x3604('0x45')]);return db[_0x3604('0x30')]['find'](_0x1606d7)[_0x3604('0x27')](handleEntityNotFound(_0x3105ac,null))[_0x3604('0x27')](respondWithResult(_0x3105ac,null))['catch'](handleError(_0x3105ac,null));};exports[_0x3604('0x4c')]=function(_0x41ccf4,_0x500f73){return db[_0x3604('0x30')][_0x3604('0x4c')](_0x41ccf4['body'],{})['then'](function(_0x388e70){var _0x3f1684=_0x41ccf4[_0x3604('0x4d')][_0x3604('0x29')]({'plain':!![]});if(!_0x3f1684)throw new Error(_0x3604('0x4e'));if(_0x3f1684[_0x3604('0x4f')]===_0x3604('0x4d')){var _0x13247d=_0x388e70['get']({'plain':!![]});var _0x53eea0=_0x3604('0x2a');return db[_0x3604('0x50')][_0x3604('0x51')]({'where':{'name':_0x53eea0,'userProfileId':_0x3f1684['userProfileId']},'raw':!![]})['then'](function(_0x5413d0){if(_0x5413d0&&_0x5413d0[_0x3604('0x52')]===0x0){return db['UserProfileResource'][_0x3604('0x4c')]({'name':_0x13247d[_0x3604('0x2c')],'resourceId':_0x13247d['id'],'type':_0x5413d0[_0x3604('0x2c')],'sectionId':_0x5413d0['id']},{})['then'](function(){return _0x388e70;});}else{return _0x388e70;}})[_0x3604('0x49')](function(_0x30a692){logger['error'](_0x3604('0x53'),_0x30a692);throw _0x30a692;});}return _0x388e70;})['then'](respondWithResult(_0x500f73,0xc9))[_0x3604('0x49')](handleError(_0x500f73,null));};exports[_0x3604('0x26')]=function(_0x1fcc3e,_0x3e6859){if(_0x1fcc3e['body']['id']){delete _0x1fcc3e[_0x3604('0x54')]['id'];}return db[_0x3604('0x30')]['find']({'where':{'id':_0x1fcc3e[_0x3604('0x4b')]['id']}})[_0x3604('0x27')](handleEntityNotFound(_0x3e6859,null))['then'](saveUpdates(_0x1fcc3e['body'],null))['then'](respondWithResult(_0x3e6859,null))['catch'](handleError(_0x3e6859,null));};exports[_0x3604('0x28')]=function(_0x516fd7,_0x32d7c1){return db[_0x3604('0x30')][_0x3604('0x51')]({'where':{'id':_0x516fd7[_0x3604('0x4b')]['id']}})[_0x3604('0x27')](handleEntityNotFound(_0x32d7c1,null))[_0x3604('0x27')](removeEntity(_0x32d7c1,null))[_0x3604('0x49')](handleError(_0x32d7c1,null));};exports[_0x3604('0x55')]=function(_0x308fc1,_0x5b5584,_0xb0511d){var _0x36da52;return db[_0x3604('0x30')][_0x3604('0x51')]({'where':{'id':_0x308fc1['params']['id']},'attributes':['id',_0x3604('0x56')]})[_0x3604('0x27')](handleEntityNotFound(_0x5b5584,null))[_0x3604('0x27')](function(_0x501e33){if(_0x501e33){var _0x146938=require(_0x3604('0x57'))();_0x146938['openSync'](_0x501e33[_0x3604('0x56')]);_0x146938['closeSync']();return _0x501e33;}})[_0x3604('0x27')](respondWithResult(_0x5b5584,null))['catch'](handleError(_0x5b5584,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