Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 1bd96df..5333ff0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98a8=['SquareOdbc','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ODBC','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map'];(function(_0x3588b2,_0x510cf0){var _0x504cf2=function(_0x293477){while(--_0x293477){_0x3588b2['push'](_0x3588b2['shift']());}};_0x504cf2(++_0x510cf0);}(_0x98a8,0x12c));var _0x898a=function(_0x227532,_0x2944d1){_0x227532=_0x227532-0x0;var _0x1e425a=_0x98a8[_0x227532];return _0x1e425a;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){var _0x32eca5=_0x274cdf[_0x898a('0x25')]({'plain':!![]});var _0x1426e3='ODBC';return db[_0x898a('0x26')]['destroy']({'where':{'type':_0x1426e3,'resourceId':_0x32eca5['id']}})['then'](function(){return _0x274cdf;});})['then'](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x420b25,_0x40b3db){return function(_0x28ae6a){if(!_0x28ae6a){_0x420b25[_0x898a('0x27')](0x194);}return _0x28ae6a;};}function handleError(_0x398e98,_0xac1fc4){_0xac1fc4=_0xac1fc4||0x1f4;return function(_0xd31922){logger['error'](_0xd31922['stack']);if(_0xd31922['name']){delete _0xd31922[_0x898a('0x28')];}_0x398e98[_0x898a('0x1a')](_0xac1fc4)[_0x898a('0x29')](_0xd31922);};}exports[_0x898a('0x2a')]=function(_0x34f447,_0x560000){var _0xe3c983={},_0xf74645={},_0x18773a={'count':0x0,'rows':[]};var _0x4287da=_[_0x898a('0x2b')](db[_0x898a('0x2c')]['rawAttributes'],function(_0x7a1eb5){return{'name':_0x7a1eb5[_0x898a('0x2d')],'type':_0x7a1eb5[_0x898a('0x2e')][_0x898a('0x2f')]};});_0xf74645[_0x898a('0x30')]=_['map'](_0x4287da,'name');_0xf74645[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34f447[_0x898a('0x31')]);_0xf74645['filters']=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],_0xf74645[_0x898a('0x31')]);_0xe3c983[_0x898a('0x34')]=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],qs[_0x898a('0x35')](_0x34f447[_0x898a('0x31')]['fields']));_0xe3c983[_0x898a('0x34')]=_0xe3c983['attributes']['length']?_0xe3c983[_0x898a('0x34')]:_0xf74645['model'];if(!_0x34f447[_0x898a('0x31')]['hasOwnProperty'](_0x898a('0x36'))){_0xe3c983['limit']=qs[_0x898a('0x37')](_0x34f447[_0x898a('0x31')][_0x898a('0x37')]);_0xe3c983['offset']=qs['offset'](_0x34f447['query'][_0x898a('0x1e')]);}_0xe3c983[_0x898a('0x38')]=qs['sort'](_0x34f447[_0x898a('0x31')][_0x898a('0x39')]);_0xe3c983[_0x898a('0x3a')]=qs[_0x898a('0x3b')](_['pick'](_0x34f447['query'],_0xf74645[_0x898a('0x3b')]),_0x4287da);if(_0x34f447[_0x898a('0x31')]['filter']){_0xe3c983['where']=_[_0x898a('0x3c')](_0xe3c983[_0x898a('0x3a')],{'$or':_[_0x898a('0x2b')](_0x4287da,function(_0xa45405){if(_0xa45405['type']!==_0x898a('0x3d')){var _0x369c02={};_0x369c02[_0xa45405['name']]={'$like':'%'+_0x34f447['query']['filter']+'%'};return _0x369c02;}})});}_0xe3c983=_[_0x898a('0x3c')]({},_0xe3c983,_0x34f447[_0x898a('0x3e')]);var _0x35d767={'where':_0xe3c983[_0x898a('0x3a')]};return db[_0x898a('0x2c')][_0x898a('0x1d')](_0x35d767)[_0x898a('0x23')](function(_0x1432ec){_0x18773a[_0x898a('0x1d')]=_0x1432ec;if(_0x34f447[_0x898a('0x31')][_0x898a('0x3f')]){_0xe3c983[_0x898a('0x40')]=[{'all':!![]}];}return db[_0x898a('0x2c')][_0x898a('0x41')](_0xe3c983);})[_0x898a('0x23')](function(_0x4c8628){_0x18773a[_0x898a('0x42')]=_0x4c8628;return _0x18773a;})[_0x898a('0x23')](respondWithFilteredResult(_0x560000,_0xe3c983))[_0x898a('0x43')](handleError(_0x560000,null));};exports['show']=function(_0x34029e,_0x2e5451){var _0x3a8663={'raw':!![],'where':{'id':_0x34029e[_0x898a('0x44')]['id']}},_0x6ab441={};_0x6ab441[_0x898a('0x30')]=_[_0x898a('0x32')](db[_0x898a('0x2c')]['rawAttributes']);_0x6ab441[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34029e[_0x898a('0x31')]);_0x6ab441[_0x898a('0x3b')]=_['intersection'](_0x6ab441[_0x898a('0x30')],_0x6ab441[_0x898a('0x31')]);_0x3a8663['attributes']=_[_0x898a('0x33')](_0x6ab441['model'],qs[_0x898a('0x35')](_0x34029e['query']['fields']));_0x3a8663[_0x898a('0x34')]=_0x3a8663['attributes'][_0x898a('0x45')]?_0x3a8663[_0x898a('0x34')]:_0x6ab441['model'];if(_0x34029e[_0x898a('0x31')][_0x898a('0x3f')]){_0x3a8663['include']=[{'all':!![]}];}_0x3a8663=_[_0x898a('0x3c')]({},_0x3a8663,_0x34029e[_0x898a('0x3e')]);return db[_0x898a('0x2c')][_0x898a('0x46')](_0x3a8663)['then'](handleEntityNotFound(_0x2e5451,null))[_0x898a('0x23')](respondWithResult(_0x2e5451,null))[_0x898a('0x43')](handleError(_0x2e5451,null));};exports['create']=function(_0x25adcc,_0x1d8c16){return db['SquareOdbc'][_0x898a('0x47')](_0x25adcc['body'],{})[_0x898a('0x23')](function(_0x41f291){var _0x32ccb9=_0x25adcc['user'][_0x898a('0x25')]({'plain':!![]});if(!_0x32ccb9)throw new Error(_0x898a('0x48'));if(_0x32ccb9[_0x898a('0x49')]===_0x898a('0x4a')){var _0x5a8a2c=_0x41f291[_0x898a('0x25')]({'plain':!![]});var _0x529d7c=_0x898a('0x4b');return db[_0x898a('0x4c')][_0x898a('0x46')]({'where':{'name':_0x529d7c,'userProfileId':_0x32ccb9['userProfileId']},'raw':!![]})[_0x898a('0x23')](function(_0x3c4db0){if(_0x3c4db0&&_0x3c4db0[_0x898a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a8a2c[_0x898a('0x28')],'resourceId':_0x5a8a2c['id'],'type':_0x3c4db0[_0x898a('0x28')],'sectionId':_0x3c4db0['id']},{})[_0x898a('0x23')](function(){return _0x41f291;});}else{return _0x41f291;}})[_0x898a('0x43')](function(_0x28b8c9){logger[_0x898a('0x4e')](_0x898a('0x4f'),_0x28b8c9);throw _0x28b8c9;});}return _0x41f291;})[_0x898a('0x23')](respondWithResult(_0x1d8c16,0xc9))[_0x898a('0x43')](handleError(_0x1d8c16,null));};exports[_0x898a('0x22')]=function(_0x2382a9,_0x5e9329){if(_0x2382a9[_0x898a('0x50')]['id']){delete _0x2382a9[_0x898a('0x50')]['id'];}return db['SquareOdbc'][_0x898a('0x46')]({'where':{'id':_0x2382a9['params']['id']}})['then'](handleEntityNotFound(_0x5e9329,null))[_0x898a('0x23')](saveUpdates(_0x2382a9[_0x898a('0x50')],null))[_0x898a('0x23')](respondWithResult(_0x5e9329,null))['catch'](handleError(_0x5e9329,null));};exports['destroy']=function(_0x11a07a,_0x1f5e4b){return db['SquareOdbc'][_0x898a('0x46')]({'where':{'id':_0x11a07a[_0x898a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5e4b,null))[_0x898a('0x23')](removeEntity(_0x1f5e4b,null))[_0x898a('0x43')](handleError(_0x1f5e4b,null));};exports[_0x898a('0x51')]=function(_0x54bc75,_0xf29714,_0x2ef2f1){var _0x9c25ee;return db[_0x898a('0x2c')][_0x898a('0x46')]({'where':{'id':_0x54bc75[_0x898a('0x44')]['id']},'attributes':['id','dsn']})[_0x898a('0x23')](handleEntityNotFound(_0xf29714,null))['then'](function(_0x253f51){if(_0x253f51){var _0x1dc177=require(_0x898a('0x52'))();_0x1dc177[_0x898a('0x53')](_0x253f51[_0x898a('0x54')]);_0x1dc177[_0x898a('0x55')]();return _0x253f51;}})[_0x898a('0x23')](respondWithResult(_0xf29714,null))[_0x898a('0x43')](handleError(_0xf29714,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