Built motion from commit 9d7072cc.|2.5.39
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 4b62399..a0861e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf323=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','SquareOdbc','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x576170,_0x3ed831){var _0x487d98=function(_0x1674a3){while(--_0x1674a3){_0x576170['push'](_0x576170['shift']());}};_0x487d98(++_0x3ed831);}(_0xf323,0x9f));var _0x3f32=function(_0x5d50b2,_0x34cc1b){_0x5d50b2=_0x5d50b2-0x0;var _0x40c9ba=_0xf323[_0x5d50b2];return _0x40c9ba;};'use strict';var pdf=require(_0x3f32('0x0'));var emlformat=require(_0x3f32('0x1'));var rimraf=require(_0x3f32('0x2'));var zipdir=require(_0x3f32('0x3'));var jsonpatch=require(_0x3f32('0x4'));var rp=require(_0x3f32('0x5'));var moment=require(_0x3f32('0x6'));var BPromise=require(_0x3f32('0x7'));var Mustache=require(_0x3f32('0x8'));var util=require(_0x3f32('0x9'));var path=require(_0x3f32('0xa'));var sox=require(_0x3f32('0xb'));var csv=require(_0x3f32('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f32('0xd'));var squel=require(_0x3f32('0xe'));var crypto=require(_0x3f32('0xf'));var jsforce=require(_0x3f32('0x10'));var deskjs=require(_0x3f32('0x11'));var toCsv=require(_0x3f32('0xc'));var querystring=require(_0x3f32('0x12'));var Papa=require('papaparse');var Redis=require(_0x3f32('0x13'));var authService=require(_0x3f32('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3f32('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f32('0x16'))(_0x3f32('0x17'));var utils=require(_0x3f32('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3f32('0x19'));var db=require(_0x3f32('0x1a'))['db'];function respondWithStatusCode(_0x16e2cd,_0x109ad2){_0x109ad2=_0x109ad2||0xcc;return function(_0x28ea0b){if(_0x28ea0b){return _0x16e2cd['sendStatus'](_0x109ad2);}return _0x16e2cd[_0x3f32('0x1b')](_0x109ad2)['end']();};}function respondWithResult(_0x10e99c,_0x1e796b){_0x1e796b=_0x1e796b||0xc8;return function(_0x2cff1f){if(_0x2cff1f){return _0x10e99c[_0x3f32('0x1b')](_0x1e796b)[_0x3f32('0x1c')](_0x2cff1f);}};}function respondWithFilteredResult(_0x414c63,_0x4915af){return function(_0x6768c){if(_0x6768c){var _0x3446fa=_0x6768c[_0x3f32('0x1d')],_0x3ca6d0=_0x4915af[_0x3f32('0x1e')],_0x35b196=_0x4915af[_0x3f32('0x1e')]+_0x4915af[_0x3f32('0x1f')],_0x385103;if(_0x35b196>=_0x3446fa){_0x35b196=_0x3446fa;_0x385103=0xc8;}else{_0x385103=0xce;}_0x414c63['status'](_0x385103);return _0x414c63[_0x3f32('0x20')](_0x3f32('0x21'),_0x3ca6d0+'-'+_0x35b196+'/'+_0x3446fa)['json'](_0x6768c);}return null;};}function patchUpdates(_0x3948fe){return function(_0x5003fa){try{jsonpatch[_0x3f32('0x22')](_0x5003fa,_0x3948fe,!![]);}catch(_0x4d87f3){return BPromise[_0x3f32('0x23')](_0x4d87f3);}return _0x5003fa[_0x3f32('0x24')]();};}function saveUpdates(_0x45c69f,_0x1ccef8){return function(_0x2c4184){if(_0x2c4184){return _0x2c4184[_0x3f32('0x25')](_0x45c69f)[_0x3f32('0x26')](function(_0x60a149){return _0x60a149;});}return null;};}function removeEntity(_0x24bfc2,_0x526b27){return function(_0x27ad75){if(_0x27ad75){return _0x27ad75['destroy']()[_0x3f32('0x26')](function(){var _0x3a7f23=_0x27ad75[_0x3f32('0x27')]({'plain':!![]});var _0x4b263='ODBC';return db[_0x3f32('0x28')]['destroy']({'where':{'type':_0x4b263,'resourceId':_0x3a7f23['id']}})[_0x3f32('0x26')](function(){return _0x27ad75;});})['then'](function(){_0x24bfc2[_0x3f32('0x1b')](0xcc)[_0x3f32('0x29')]();});}};}function handleEntityNotFound(_0x253a43,_0x23c035){return function(_0x3da563){if(!_0x3da563){_0x253a43[_0x3f32('0x2a')](0x194);}return _0x3da563;};}function handleError(_0x348717,_0x45acb3){_0x45acb3=_0x45acb3||0x1f4;return function(_0x5bcc2a){logger[_0x3f32('0x2b')](_0x5bcc2a[_0x3f32('0x2c')]);if(_0x5bcc2a[_0x3f32('0x2d')]){delete _0x5bcc2a[_0x3f32('0x2d')];}_0x348717[_0x3f32('0x1b')](_0x45acb3)[_0x3f32('0x2e')](_0x5bcc2a);};}exports[_0x3f32('0x2f')]=function(_0x488375,_0xaf1be9){var _0xb88888={},_0xd401a1={},_0x59b11b={'count':0x0,'rows':[]};var _0x6721df=_['map'](db[_0x3f32('0x30')]['rawAttributes'],function(_0x128a77){return{'name':_0x128a77[_0x3f32('0x31')],'type':_0x128a77[_0x3f32('0x32')]['key']};});_0xd401a1[_0x3f32('0x33')]=_['map'](_0x6721df,_0x3f32('0x2d'));_0xd401a1[_0x3f32('0x34')]=_[_0x3f32('0x35')](_0x488375[_0x3f32('0x34')]);_0xd401a1[_0x3f32('0x36')]=_['intersection'](_0xd401a1[_0x3f32('0x33')],_0xd401a1['query']);_0xb88888[_0x3f32('0x37')]=_[_0x3f32('0x38')](_0xd401a1[_0x3f32('0x33')],qs[_0x3f32('0x39')](_0x488375['query'][_0x3f32('0x39')]));_0xb88888[_0x3f32('0x37')]=_0xb88888[_0x3f32('0x37')]['length']?_0xb88888['attributes']:_0xd401a1[_0x3f32('0x33')];if(!_0x488375[_0x3f32('0x34')][_0x3f32('0x3a')]('nolimit')){_0xb88888[_0x3f32('0x1f')]=qs[_0x3f32('0x1f')](_0x488375[_0x3f32('0x34')][_0x3f32('0x1f')]);_0xb88888[_0x3f32('0x1e')]=qs[_0x3f32('0x1e')](_0x488375[_0x3f32('0x34')][_0x3f32('0x1e')]);}_0xb88888[_0x3f32('0x3b')]=qs[_0x3f32('0x3c')](_0x488375[_0x3f32('0x34')][_0x3f32('0x3c')]);_0xb88888[_0x3f32('0x3d')]=qs[_0x3f32('0x36')](_['pick'](_0x488375['query'],_0xd401a1[_0x3f32('0x36')]),_0x6721df);if(_0x488375[_0x3f32('0x34')]['filter']){_0xb88888[_0x3f32('0x3d')]=_['merge'](_0xb88888[_0x3f32('0x3d')],{'$or':_['map'](_0x6721df,function(_0x4eb083){if(_0x4eb083[_0x3f32('0x32')]!==_0x3f32('0x3e')){var _0xd9622a={};_0xd9622a[_0x4eb083['name']]={'$like':'%'+_0x488375[_0x3f32('0x34')][_0x3f32('0x3f')]+'%'};return _0xd9622a;}})});}_0xb88888=_[_0x3f32('0x40')]({},_0xb88888,_0x488375[_0x3f32('0x41')]);var _0x2429be={'where':_0xb88888[_0x3f32('0x3d')]};return db[_0x3f32('0x30')][_0x3f32('0x1d')](_0x2429be)['then'](function(_0x28aa6c){_0x59b11b['count']=_0x28aa6c;if(_0x488375[_0x3f32('0x34')][_0x3f32('0x42')]){_0xb88888[_0x3f32('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0x3f32('0x44')](_0xb88888);})[_0x3f32('0x26')](function(_0x2e7ac6){_0x59b11b[_0x3f32('0x45')]=_0x2e7ac6;return _0x59b11b;})['then'](respondWithFilteredResult(_0xaf1be9,_0xb88888))[_0x3f32('0x46')](handleError(_0xaf1be9,null));};exports[_0x3f32('0x47')]=function(_0x3c1165,_0x57cf32){var _0x28a7b1={'raw':!![],'where':{'id':_0x3c1165[_0x3f32('0x48')]['id']}},_0x5c4592={};_0x5c4592[_0x3f32('0x33')]=_['keys'](db[_0x3f32('0x30')][_0x3f32('0x49')]);_0x5c4592[_0x3f32('0x34')]=_[_0x3f32('0x35')](_0x3c1165['query']);_0x5c4592[_0x3f32('0x36')]=_[_0x3f32('0x38')](_0x5c4592['model'],_0x5c4592['query']);_0x28a7b1['attributes']=_['intersection'](_0x5c4592['model'],qs['fields'](_0x3c1165[_0x3f32('0x34')][_0x3f32('0x39')]));_0x28a7b1[_0x3f32('0x37')]=_0x28a7b1['attributes'][_0x3f32('0x4a')]?_0x28a7b1['attributes']:_0x5c4592[_0x3f32('0x33')];if(_0x3c1165['query']['includeAll']){_0x28a7b1['include']=[{'all':!![]}];}_0x28a7b1=_[_0x3f32('0x40')]({},_0x28a7b1,_0x3c1165['options']);return db['SquareOdbc'][_0x3f32('0x4b')](_0x28a7b1)[_0x3f32('0x26')](handleEntityNotFound(_0x57cf32,null))['then'](respondWithResult(_0x57cf32,null))['catch'](handleError(_0x57cf32,null));};exports['create']=function(_0x1b5a08,_0x4bda1b){return db['SquareOdbc']['create'](_0x1b5a08[_0x3f32('0x4c')],{})[_0x3f32('0x26')](function(_0x528dfe){var _0x2a5cbe=_0x1b5a08[_0x3f32('0x4d')][_0x3f32('0x27')]({'plain':!![]});if(!_0x2a5cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a5cbe[_0x3f32('0x4e')]===_0x3f32('0x4d')){var _0x700087=_0x528dfe[_0x3f32('0x27')]({'plain':!![]});var _0x513287='ODBC';return db[_0x3f32('0x4f')][_0x3f32('0x4b')]({'where':{'name':_0x513287,'userProfileId':_0x2a5cbe[_0x3f32('0x50')]},'raw':!![]})[_0x3f32('0x26')](function(_0x9be0a8){if(_0x9be0a8&&_0x9be0a8[_0x3f32('0x51')]===0x0){return db[_0x3f32('0x28')]['create']({'name':_0x700087['name'],'resourceId':_0x700087['id'],'type':_0x9be0a8['name'],'sectionId':_0x9be0a8['id']},{})[_0x3f32('0x26')](function(){return _0x528dfe;});}else{return _0x528dfe;}})[_0x3f32('0x46')](function(_0x5511ba){logger[_0x3f32('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5511ba);throw _0x5511ba;});}return _0x528dfe;})[_0x3f32('0x26')](respondWithResult(_0x4bda1b,0xc9))[_0x3f32('0x46')](handleError(_0x4bda1b,null));};exports['update']=function(_0x51239f,_0x140561){if(_0x51239f[_0x3f32('0x4c')]['id']){delete _0x51239f['body']['id'];}return db[_0x3f32('0x30')][_0x3f32('0x4b')]({'where':{'id':_0x51239f[_0x3f32('0x48')]['id']}})['then'](handleEntityNotFound(_0x140561,null))[_0x3f32('0x26')](saveUpdates(_0x51239f[_0x3f32('0x4c')],null))[_0x3f32('0x26')](respondWithResult(_0x140561,null))[_0x3f32('0x46')](handleError(_0x140561,null));};exports['destroy']=function(_0x3ee20a,_0x4a52a0){return db[_0x3f32('0x30')][_0x3f32('0x4b')]({'where':{'id':_0x3ee20a[_0x3f32('0x48')]['id']}})[_0x3f32('0x26')](handleEntityNotFound(_0x4a52a0,null))['then'](removeEntity(_0x4a52a0,null))[_0x3f32('0x46')](handleError(_0x4a52a0,null));};exports['test']=function(_0x4d9d5f,_0x31d6fa,_0x5216f9){var _0x15b730;return db[_0x3f32('0x30')][_0x3f32('0x4b')]({'where':{'id':_0x4d9d5f[_0x3f32('0x48')]['id']},'attributes':['id',_0x3f32('0x52')]})['then'](handleEntityNotFound(_0x31d6fa,null))[_0x3f32('0x26')](function(_0x3e3544){if(_0x3e3544){var _0x51e8ab=require('odbc')();_0x51e8ab[_0x3f32('0x53')](_0x3e3544[_0x3f32('0x52')]);_0x51e8ab[_0x3f32('0x54')]();return _0x3e3544;}})['then'](respondWithResult(_0x31d6fa,null))[_0x3f32('0x46')](handleError(_0x31d6fa,null));};
\ No newline at end of file
+var _0x3e6f=['offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ODBC','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','openSync','closeSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count'];(function(_0x55735e,_0x3a505b){var _0x412aa6=function(_0xbd6fe9){while(--_0xbd6fe9){_0x55735e['push'](_0x55735e['shift']());}};_0x412aa6(++_0x3a505b);}(_0x3e6f,0x198));var _0xf3e6=function(_0x1cd85e,_0x5675ab){_0x1cd85e=_0x1cd85e-0x0;var _0x7b7873=_0x3e6f[_0x1cd85e];return _0x7b7873;};'use strict';var emlformat=require(_0xf3e6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf3e6('0x1'));var rp=require(_0xf3e6('0x2'));var moment=require(_0xf3e6('0x3'));var BPromise=require(_0xf3e6('0x4'));var Mustache=require(_0xf3e6('0x5'));var util=require(_0xf3e6('0x6'));var path=require(_0xf3e6('0x7'));var sox=require('sox');var csv=require(_0xf3e6('0x8'));var ejs=require(_0xf3e6('0x9'));var fs=require('fs');var fs_extra=require(_0xf3e6('0xa'));var _=require(_0xf3e6('0xb'));var squel=require(_0xf3e6('0xc'));var crypto=require(_0xf3e6('0xd'));var jsforce=require(_0xf3e6('0xe'));var deskjs=require(_0xf3e6('0xf'));var toCsv=require(_0xf3e6('0x8'));var querystring=require(_0xf3e6('0x10'));var Papa=require(_0xf3e6('0x11'));var Redis=require(_0xf3e6('0x12'));var authService=require(_0xf3e6('0x13'));var qs=require(_0xf3e6('0x14'));var as=require(_0xf3e6('0x15'));var hardwareService=require(_0xf3e6('0x16'));var logger=require(_0xf3e6('0x17'))(_0xf3e6('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf3e6('0x19'));var db=require(_0xf3e6('0x1a'))['db'];function respondWithStatusCode(_0x79daa4,_0xc210f0){_0xc210f0=_0xc210f0||0xcc;return function(_0x449cab){if(_0x449cab){return _0x79daa4[_0xf3e6('0x1b')](_0xc210f0);}return _0x79daa4[_0xf3e6('0x1c')](_0xc210f0)['end']();};}function respondWithResult(_0x2ca9c1,_0x4bc5bb){_0x4bc5bb=_0x4bc5bb||0xc8;return function(_0x388de0){if(_0x388de0){return _0x2ca9c1[_0xf3e6('0x1c')](_0x4bc5bb)[_0xf3e6('0x1d')](_0x388de0);}};}function respondWithFilteredResult(_0x314151,_0x420f23){return function(_0x4842b9){if(_0x4842b9){var _0x417aab=typeof _0x420f23['offset']===_0xf3e6('0x1e')&&typeof _0x420f23['limit']===_0xf3e6('0x1e');var _0x445bec=_0x4842b9[_0xf3e6('0x1f')];var _0x2c01b3=_0x417aab?0x0:_0x420f23['offset'];var _0x169998=_0x417aab?_0x4842b9[_0xf3e6('0x1f')]:_0x420f23[_0xf3e6('0x20')]+_0x420f23[_0xf3e6('0x21')];var _0x5ebb82;if(_0x169998>=_0x445bec){_0x169998=_0x445bec;_0x5ebb82=0xc8;}else{_0x5ebb82=0xce;}_0x314151[_0xf3e6('0x1c')](_0x5ebb82);return _0x314151[_0xf3e6('0x22')]('Content-Range',_0x2c01b3+'-'+_0x169998+'/'+_0x445bec)[_0xf3e6('0x1d')](_0x4842b9);}return null;};}function patchUpdates(_0x174049){return function(_0x314edf){try{jsonpatch[_0xf3e6('0x23')](_0x314edf,_0x174049,!![]);}catch(_0x1b8105){return BPromise[_0xf3e6('0x24')](_0x1b8105);}return _0x314edf[_0xf3e6('0x25')]();};}function saveUpdates(_0x124f07,_0x452d64){return function(_0x47dc4b){if(_0x47dc4b){return _0x47dc4b[_0xf3e6('0x26')](_0x124f07)[_0xf3e6('0x27')](function(_0x3b7aec){return _0x3b7aec;});}return null;};}function removeEntity(_0x5ad496,_0x25ed25){return function(_0x1ef744){if(_0x1ef744){return _0x1ef744[_0xf3e6('0x28')]()['then'](function(){var _0x355b32=_0x1ef744[_0xf3e6('0x29')]({'plain':!![]});var _0x5b1e91='ODBC';return db[_0xf3e6('0x2a')][_0xf3e6('0x28')]({'where':{'type':_0x5b1e91,'resourceId':_0x355b32['id']}})[_0xf3e6('0x27')](function(){return _0x1ef744;});})[_0xf3e6('0x27')](function(){_0x5ad496[_0xf3e6('0x1c')](0xcc)[_0xf3e6('0x2b')]();});}};}function handleEntityNotFound(_0x480d68,_0x25af0a){return function(_0x402a45){if(!_0x402a45){_0x480d68[_0xf3e6('0x1b')](0x194);}return _0x402a45;};}function handleError(_0xdcfdf3,_0x3d6c4d){_0x3d6c4d=_0x3d6c4d||0x1f4;return function(_0x5b9f80){logger[_0xf3e6('0x2c')](_0x5b9f80['stack']);if(_0x5b9f80[_0xf3e6('0x2d')]){delete _0x5b9f80[_0xf3e6('0x2d')];}_0xdcfdf3[_0xf3e6('0x1c')](_0x3d6c4d)['send'](_0x5b9f80);};}exports[_0xf3e6('0x2e')]=function(_0x30ffe9,_0x54a7bc){var _0x35fd36={},_0x2afc4={},_0x5b0673={'count':0x0,'rows':[]};var _0x2beb9e=_[_0xf3e6('0x2f')](db[_0xf3e6('0x30')][_0xf3e6('0x31')],function(_0x310d20){return{'name':_0x310d20[_0xf3e6('0x32')],'type':_0x310d20[_0xf3e6('0x33')]['key']};});_0x2afc4[_0xf3e6('0x34')]=_[_0xf3e6('0x2f')](_0x2beb9e,_0xf3e6('0x2d'));_0x2afc4[_0xf3e6('0x35')]=_[_0xf3e6('0x36')](_0x30ffe9[_0xf3e6('0x35')]);_0x2afc4[_0xf3e6('0x37')]=_['intersection'](_0x2afc4[_0xf3e6('0x34')],_0x2afc4[_0xf3e6('0x35')]);_0x35fd36[_0xf3e6('0x38')]=_[_0xf3e6('0x39')](_0x2afc4['model'],qs[_0xf3e6('0x3a')](_0x30ffe9['query'][_0xf3e6('0x3a')]));_0x35fd36[_0xf3e6('0x38')]=_0x35fd36['attributes']['length']?_0x35fd36[_0xf3e6('0x38')]:_0x2afc4[_0xf3e6('0x34')];if(!_0x30ffe9[_0xf3e6('0x35')][_0xf3e6('0x3b')](_0xf3e6('0x3c'))){_0x35fd36[_0xf3e6('0x21')]=qs['limit'](_0x30ffe9[_0xf3e6('0x35')]['limit']);_0x35fd36[_0xf3e6('0x20')]=qs['offset'](_0x30ffe9['query'][_0xf3e6('0x20')]);}_0x35fd36[_0xf3e6('0x3d')]=qs['sort'](_0x30ffe9[_0xf3e6('0x35')][_0xf3e6('0x3e')]);_0x35fd36['where']=qs[_0xf3e6('0x37')](_[_0xf3e6('0x3f')](_0x30ffe9['query'],_0x2afc4['filters']),_0x2beb9e);if(_0x30ffe9[_0xf3e6('0x35')][_0xf3e6('0x40')]){_0x35fd36[_0xf3e6('0x41')]=_['merge'](_0x35fd36[_0xf3e6('0x41')],{'$or':_[_0xf3e6('0x2f')](_0x2beb9e,function(_0x43ddaa){if(_0x43ddaa[_0xf3e6('0x33')]!==_0xf3e6('0x42')){var _0x596922={};_0x596922[_0x43ddaa[_0xf3e6('0x2d')]]={'$like':'%'+_0x30ffe9[_0xf3e6('0x35')][_0xf3e6('0x40')]+'%'};return _0x596922;}})});}_0x35fd36=_[_0xf3e6('0x43')]({},_0x35fd36,_0x30ffe9[_0xf3e6('0x44')]);var _0x1e6a15={'where':_0x35fd36['where']};return db[_0xf3e6('0x30')][_0xf3e6('0x1f')](_0x1e6a15)[_0xf3e6('0x27')](function(_0x2c796b){_0x5b0673['count']=_0x2c796b;if(_0x30ffe9[_0xf3e6('0x35')]['includeAll']){_0x35fd36[_0xf3e6('0x45')]=[{'all':!![]}];}return db[_0xf3e6('0x30')][_0xf3e6('0x46')](_0x35fd36);})[_0xf3e6('0x27')](function(_0x3c910b){_0x5b0673[_0xf3e6('0x47')]=_0x3c910b;return _0x5b0673;})['then'](respondWithFilteredResult(_0x54a7bc,_0x35fd36))[_0xf3e6('0x48')](handleError(_0x54a7bc,null));};exports[_0xf3e6('0x49')]=function(_0x31539f,_0x216154){var _0x518722={'raw':!![],'where':{'id':_0x31539f['params']['id']}},_0x310926={};_0x310926[_0xf3e6('0x34')]=_[_0xf3e6('0x36')](db[_0xf3e6('0x30')][_0xf3e6('0x31')]);_0x310926[_0xf3e6('0x35')]=_[_0xf3e6('0x36')](_0x31539f[_0xf3e6('0x35')]);_0x310926[_0xf3e6('0x37')]=_[_0xf3e6('0x39')](_0x310926[_0xf3e6('0x34')],_0x310926[_0xf3e6('0x35')]);_0x518722[_0xf3e6('0x38')]=_['intersection'](_0x310926['model'],qs['fields'](_0x31539f['query'][_0xf3e6('0x3a')]));_0x518722[_0xf3e6('0x38')]=_0x518722[_0xf3e6('0x38')]['length']?_0x518722['attributes']:_0x310926[_0xf3e6('0x34')];if(_0x31539f['query'][_0xf3e6('0x4a')]){_0x518722[_0xf3e6('0x45')]=[{'all':!![]}];}_0x518722=_[_0xf3e6('0x43')]({},_0x518722,_0x31539f[_0xf3e6('0x44')]);return db[_0xf3e6('0x30')]['find'](_0x518722)[_0xf3e6('0x27')](handleEntityNotFound(_0x216154,null))[_0xf3e6('0x27')](respondWithResult(_0x216154,null))[_0xf3e6('0x48')](handleError(_0x216154,null));};exports[_0xf3e6('0x4b')]=function(_0x2a8bcf,_0x48a532){return db[_0xf3e6('0x30')][_0xf3e6('0x4b')](_0x2a8bcf['body'],{})[_0xf3e6('0x27')](function(_0x246da4){var _0x56c3e7=_0x2a8bcf['user'][_0xf3e6('0x29')]({'plain':!![]});if(!_0x56c3e7)throw new Error(_0xf3e6('0x4c'));if(_0x56c3e7[_0xf3e6('0x4d')]===_0xf3e6('0x4e')){var _0xb8f3fa=_0x246da4[_0xf3e6('0x29')]({'plain':!![]});var _0x436695=_0xf3e6('0x4f');return db[_0xf3e6('0x50')][_0xf3e6('0x51')]({'where':{'name':_0x436695,'userProfileId':_0x56c3e7[_0xf3e6('0x52')]},'raw':!![]})['then'](function(_0x38caca){if(_0x38caca&&_0x38caca[_0xf3e6('0x53')]===0x0){return db[_0xf3e6('0x2a')][_0xf3e6('0x4b')]({'name':_0xb8f3fa[_0xf3e6('0x2d')],'resourceId':_0xb8f3fa['id'],'type':_0x38caca[_0xf3e6('0x2d')],'sectionId':_0x38caca['id']},{})['then'](function(){return _0x246da4;});}else{return _0x246da4;}})['catch'](function(_0x49736d){logger['error'](_0xf3e6('0x54'),_0x49736d);throw _0x49736d;});}return _0x246da4;})[_0xf3e6('0x27')](respondWithResult(_0x48a532,0xc9))['catch'](handleError(_0x48a532,null));};exports[_0xf3e6('0x26')]=function(_0x1422e5,_0x575e5e){if(_0x1422e5['body']['id']){delete _0x1422e5['body']['id'];}return db[_0xf3e6('0x30')][_0xf3e6('0x51')]({'where':{'id':_0x1422e5[_0xf3e6('0x55')]['id']}})[_0xf3e6('0x27')](handleEntityNotFound(_0x575e5e,null))[_0xf3e6('0x27')](saveUpdates(_0x1422e5['body'],null))[_0xf3e6('0x27')](respondWithResult(_0x575e5e,null))[_0xf3e6('0x48')](handleError(_0x575e5e,null));};exports[_0xf3e6('0x28')]=function(_0x4b5995,_0x163c7e){return db[_0xf3e6('0x30')][_0xf3e6('0x51')]({'where':{'id':_0x4b5995[_0xf3e6('0x55')]['id']}})[_0xf3e6('0x27')](handleEntityNotFound(_0x163c7e,null))[_0xf3e6('0x27')](removeEntity(_0x163c7e,null))[_0xf3e6('0x48')](handleError(_0x163c7e,null));};exports['test']=function(_0x33014f,_0x4f0271,_0x59f323){var _0x20b424;return db[_0xf3e6('0x30')][_0xf3e6('0x51')]({'where':{'id':_0x33014f[_0xf3e6('0x55')]['id']},'attributes':['id','dsn']})[_0xf3e6('0x27')](handleEntityNotFound(_0x4f0271,null))[_0xf3e6('0x27')](function(_0x3888a0){if(_0x3888a0){var _0x1cc82b=require('odbc')();_0x1cc82b[_0xf3e6('0x56')](_0x3888a0['dsn']);_0x1cc82b[_0xf3e6('0x57')]();return _0x3888a0;}})[_0xf3e6('0x27')](respondWithResult(_0x4f0271,null))['catch'](handleError(_0x4f0271,null));};
\ No newline at end of file