Built motion from commit 0d14f64c.|2.6.34
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 51097ad..6d1e658 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf062=['merge','where','VIRTUAL','options','findAll','rows','params','keys','rawAttributes','includeAll','include','find','catch','create','body','user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','end','error','stack','name','send','index','map','SquareOdbc','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter'];(function(_0x38d825,_0x357fd6){var _0xc39a03=function(_0x10e2de){while(--_0x10e2de){_0x38d825['push'](_0x38d825['shift']());}};_0xc39a03(++_0x357fd6);}(_0xf062,0x1ca));var _0x2f06=function(_0x4e35ce,_0x30ca51){_0x4e35ce=_0x4e35ce-0x0;var _0x5aa975=_0xf062[_0x4e35ce];return _0x5aa975;};'use strict';var emlformat=require(_0x2f06('0x0'));var rimraf=require(_0x2f06('0x1'));var zipdir=require(_0x2f06('0x2'));var jsonpatch=require(_0x2f06('0x3'));var rp=require(_0x2f06('0x4'));var moment=require(_0x2f06('0x5'));var BPromise=require(_0x2f06('0x6'));var Mustache=require(_0x2f06('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2f06('0x8'));var csv=require(_0x2f06('0x9'));var ejs=require(_0x2f06('0xa'));var fs=require('fs');var fs_extra=require(_0x2f06('0xb'));var _=require(_0x2f06('0xc'));var squel=require(_0x2f06('0xd'));var crypto=require(_0x2f06('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f06('0x9'));var querystring=require('querystring');var Papa=require(_0x2f06('0xf'));var Redis=require(_0x2f06('0x10'));var authService=require(_0x2f06('0x11'));var qs=require(_0x2f06('0x12'));var as=require(_0x2f06('0x13'));var hardwareService=require(_0x2f06('0x14'));var logger=require('../../config/logger')(_0x2f06('0x15'));var utils=require('../../config/utils');var config=require(_0x2f06('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f06('0x17'))['db'];function respondWithStatusCode(_0x19d2d5,_0x4233a2){_0x4233a2=_0x4233a2||0xcc;return function(_0x3ea398){if(_0x3ea398){return _0x19d2d5[_0x2f06('0x18')](_0x4233a2);}return _0x19d2d5['status'](_0x4233a2)['end']();};}function respondWithResult(_0x1cf15a,_0xfbeefc){_0xfbeefc=_0xfbeefc||0xc8;return function(_0x5f32cd){if(_0x5f32cd){return _0x1cf15a[_0x2f06('0x19')](_0xfbeefc)[_0x2f06('0x1a')](_0x5f32cd);}};}function respondWithFilteredResult(_0x1d7730,_0x511cf8){return function(_0x5cf7cc){if(_0x5cf7cc){var _0x250eae=typeof _0x511cf8['offset']===_0x2f06('0x1b')&&typeof _0x511cf8[_0x2f06('0x1c')]===_0x2f06('0x1b');var _0xd0cd19=_0x5cf7cc[_0x2f06('0x1d')];var _0x30fc09=_0x250eae?0x0:_0x511cf8['offset'];var _0xf587f5=_0x250eae?_0x5cf7cc[_0x2f06('0x1d')]:_0x511cf8[_0x2f06('0x1e')]+_0x511cf8[_0x2f06('0x1c')];var _0x3e5c0c;if(_0xf587f5>=_0xd0cd19){_0xf587f5=_0xd0cd19;_0x3e5c0c=0xc8;}else{_0x3e5c0c=0xce;}_0x1d7730[_0x2f06('0x19')](_0x3e5c0c);return _0x1d7730[_0x2f06('0x1f')](_0x2f06('0x20'),_0x30fc09+'-'+_0xf587f5+'/'+_0xd0cd19)[_0x2f06('0x1a')](_0x5cf7cc);}return null;};}function patchUpdates(_0x31c536){return function(_0xb232e3){try{jsonpatch[_0x2f06('0x21')](_0xb232e3,_0x31c536,!![]);}catch(_0x9ac7f5){return BPromise[_0x2f06('0x22')](_0x9ac7f5);}return _0xb232e3[_0x2f06('0x23')]();};}function saveUpdates(_0x40e8db,_0x2dc460){return function(_0x3927e1){if(_0x3927e1){return _0x3927e1[_0x2f06('0x24')](_0x40e8db)['then'](function(_0x24ec2e){return _0x24ec2e;});}return null;};}function removeEntity(_0x23eb66,_0x10831d){return function(_0x2ef34f){if(_0x2ef34f){return _0x2ef34f[_0x2f06('0x25')]()[_0x2f06('0x26')](function(){var _0x164229=_0x2ef34f[_0x2f06('0x27')]({'plain':!![]});var _0x1cdd3f=_0x2f06('0x28');return db['UserProfileResource'][_0x2f06('0x25')]({'where':{'type':_0x1cdd3f,'resourceId':_0x164229['id']}})[_0x2f06('0x26')](function(){return _0x2ef34f;});})[_0x2f06('0x26')](function(){_0x23eb66[_0x2f06('0x19')](0xcc)[_0x2f06('0x29')]();});}};}function handleEntityNotFound(_0x463f54,_0x12fca4){return function(_0x2129ca){if(!_0x2129ca){_0x463f54['sendStatus'](0x194);}return _0x2129ca;};}function handleError(_0x2ed7a3,_0x220a4f){_0x220a4f=_0x220a4f||0x1f4;return function(_0x26ff93){logger[_0x2f06('0x2a')](_0x26ff93[_0x2f06('0x2b')]);if(_0x26ff93[_0x2f06('0x2c')]){delete _0x26ff93['name'];}_0x2ed7a3[_0x2f06('0x19')](_0x220a4f)[_0x2f06('0x2d')](_0x26ff93);};}exports[_0x2f06('0x2e')]=function(_0xb3ca2e,_0x26aa93){var _0x3f0ac1={},_0x32ad8c={},_0x37009c={'count':0x0,'rows':[]};var _0x5dbac3=_[_0x2f06('0x2f')](db[_0x2f06('0x30')]['rawAttributes'],function(_0x435f4d){return{'name':_0x435f4d['fieldName'],'type':_0x435f4d[_0x2f06('0x31')][_0x2f06('0x32')]};});_0x32ad8c['model']=_[_0x2f06('0x2f')](_0x5dbac3,_0x2f06('0x2c'));_0x32ad8c[_0x2f06('0x33')]=_['keys'](_0xb3ca2e[_0x2f06('0x33')]);_0x32ad8c['filters']=_[_0x2f06('0x34')](_0x32ad8c['model'],_0x32ad8c[_0x2f06('0x33')]);_0x3f0ac1['attributes']=_['intersection'](_0x32ad8c[_0x2f06('0x35')],qs['fields'](_0xb3ca2e[_0x2f06('0x33')][_0x2f06('0x36')]));_0x3f0ac1[_0x2f06('0x37')]=_0x3f0ac1[_0x2f06('0x37')][_0x2f06('0x38')]?_0x3f0ac1['attributes']:_0x32ad8c[_0x2f06('0x35')];if(!_0xb3ca2e[_0x2f06('0x33')][_0x2f06('0x39')](_0x2f06('0x3a'))){_0x3f0ac1[_0x2f06('0x1c')]=qs[_0x2f06('0x1c')](_0xb3ca2e[_0x2f06('0x33')]['limit']);_0x3f0ac1['offset']=qs[_0x2f06('0x1e')](_0xb3ca2e[_0x2f06('0x33')][_0x2f06('0x1e')]);}_0x3f0ac1[_0x2f06('0x3b')]=qs[_0x2f06('0x3c')](_0xb3ca2e['query'][_0x2f06('0x3c')]);_0x3f0ac1['where']=qs['filters'](_[_0x2f06('0x3d')](_0xb3ca2e[_0x2f06('0x33')],_0x32ad8c[_0x2f06('0x3e')]),_0x5dbac3);if(_0xb3ca2e[_0x2f06('0x33')][_0x2f06('0x3f')]){_0x3f0ac1['where']=_[_0x2f06('0x40')](_0x3f0ac1[_0x2f06('0x41')],{'$or':_['map'](_0x5dbac3,function(_0x272842){if(_0x272842[_0x2f06('0x31')]!==_0x2f06('0x42')){var _0x5d9a9b={};_0x5d9a9b[_0x272842['name']]={'$like':'%'+_0xb3ca2e['query'][_0x2f06('0x3f')]+'%'};return _0x5d9a9b;}})});}_0x3f0ac1=_[_0x2f06('0x40')]({},_0x3f0ac1,_0xb3ca2e[_0x2f06('0x43')]);var _0x520e76={'where':_0x3f0ac1[_0x2f06('0x41')]};return db['SquareOdbc']['count'](_0x520e76)[_0x2f06('0x26')](function(_0x2332b1){_0x37009c[_0x2f06('0x1d')]=_0x2332b1;if(_0xb3ca2e['query']['includeAll']){_0x3f0ac1['include']=[{'all':!![]}];}return db[_0x2f06('0x30')][_0x2f06('0x44')](_0x3f0ac1);})[_0x2f06('0x26')](function(_0x50f0e9){_0x37009c[_0x2f06('0x45')]=_0x50f0e9;return _0x37009c;})[_0x2f06('0x26')](respondWithFilteredResult(_0x26aa93,_0x3f0ac1))['catch'](handleError(_0x26aa93,null));};exports['show']=function(_0x31ba77,_0x496981){var _0x25a06c={'raw':!![],'where':{'id':_0x31ba77[_0x2f06('0x46')]['id']}},_0x44a809={};_0x44a809[_0x2f06('0x35')]=_[_0x2f06('0x47')](db['SquareOdbc'][_0x2f06('0x48')]);_0x44a809['query']=_[_0x2f06('0x47')](_0x31ba77[_0x2f06('0x33')]);_0x44a809[_0x2f06('0x3e')]=_[_0x2f06('0x34')](_0x44a809['model'],_0x44a809[_0x2f06('0x33')]);_0x25a06c[_0x2f06('0x37')]=_[_0x2f06('0x34')](_0x44a809['model'],qs[_0x2f06('0x36')](_0x31ba77[_0x2f06('0x33')][_0x2f06('0x36')]));_0x25a06c[_0x2f06('0x37')]=_0x25a06c[_0x2f06('0x37')][_0x2f06('0x38')]?_0x25a06c[_0x2f06('0x37')]:_0x44a809[_0x2f06('0x35')];if(_0x31ba77['query'][_0x2f06('0x49')]){_0x25a06c[_0x2f06('0x4a')]=[{'all':!![]}];}_0x25a06c=_[_0x2f06('0x40')]({},_0x25a06c,_0x31ba77['options']);return db['SquareOdbc'][_0x2f06('0x4b')](_0x25a06c)['then'](handleEntityNotFound(_0x496981,null))[_0x2f06('0x26')](respondWithResult(_0x496981,null))[_0x2f06('0x4c')](handleError(_0x496981,null));};exports[_0x2f06('0x4d')]=function(_0x73d315,_0x9806b1){return db[_0x2f06('0x30')][_0x2f06('0x4d')](_0x73d315[_0x2f06('0x4e')],{})['then'](function(_0x4b0448){var _0x2885fe=_0x73d315[_0x2f06('0x4f')][_0x2f06('0x27')]({'plain':!![]});if(!_0x2885fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2885fe[_0x2f06('0x50')]==='user'){var _0x5893ab=_0x4b0448['get']({'plain':!![]});var _0x525b36=_0x2f06('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x525b36,'userProfileId':_0x2885fe['userProfileId']},'raw':!![]})[_0x2f06('0x26')](function(_0x2dde88){if(_0x2dde88&&_0x2dde88['autoAssociation']===0x0){return db[_0x2f06('0x51')][_0x2f06('0x4d')]({'name':_0x5893ab['name'],'resourceId':_0x5893ab['id'],'type':_0x2dde88[_0x2f06('0x2c')],'sectionId':_0x2dde88['id']},{})['then'](function(){return _0x4b0448;});}else{return _0x4b0448;}})[_0x2f06('0x4c')](function(_0x1c3e74){logger[_0x2f06('0x2a')](_0x2f06('0x52'),_0x1c3e74);throw _0x1c3e74;});}return _0x4b0448;})[_0x2f06('0x26')](respondWithResult(_0x9806b1,0xc9))[_0x2f06('0x4c')](handleError(_0x9806b1,null));};exports[_0x2f06('0x24')]=function(_0x3fe8b4,_0x4dc864){if(_0x3fe8b4[_0x2f06('0x4e')]['id']){delete _0x3fe8b4[_0x2f06('0x4e')]['id'];}return db[_0x2f06('0x30')][_0x2f06('0x4b')]({'where':{'id':_0x3fe8b4[_0x2f06('0x46')]['id']}})[_0x2f06('0x26')](handleEntityNotFound(_0x4dc864,null))['then'](saveUpdates(_0x3fe8b4[_0x2f06('0x4e')],null))[_0x2f06('0x26')](respondWithResult(_0x4dc864,null))[_0x2f06('0x4c')](handleError(_0x4dc864,null));};exports[_0x2f06('0x25')]=function(_0x4fe77a,_0x11a57c){return db['SquareOdbc'][_0x2f06('0x4b')]({'where':{'id':_0x4fe77a[_0x2f06('0x46')]['id']}})[_0x2f06('0x26')](handleEntityNotFound(_0x11a57c,null))[_0x2f06('0x26')](removeEntity(_0x11a57c,null))['catch'](handleError(_0x11a57c,null));};exports['test']=function(_0x4f6ded,_0x72fe92,_0xfb8565){var _0x2b16a5;return db[_0x2f06('0x30')][_0x2f06('0x4b')]({'where':{'id':_0x4f6ded[_0x2f06('0x46')]['id']},'attributes':['id',_0x2f06('0x53')]})[_0x2f06('0x26')](handleEntityNotFound(_0x72fe92,null))[_0x2f06('0x26')](function(_0x45b17c){if(_0x45b17c){var _0x585cfb=require(_0x2f06('0x54'))();_0x585cfb[_0x2f06('0x55')](_0x45b17c['dsn']);_0x585cfb[_0x2f06('0x56')]();return _0x45b17c;}})['then'](respondWithResult(_0x72fe92,null))['catch'](handleError(_0x72fe92,null));};
\ No newline at end of file
+var _0xc10c=['hasOwnProperty','nolimit','order','sort','where','filter','options','SquareOdbc','includeAll','include','rows','catch','show','length','merge','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0xc10c,0x1bb));var _0xcc10=function(_0xdd57d2,_0x437799){_0xdd57d2=_0xdd57d2-0x0;var _0x426d85=_0xc10c[_0xdd57d2];return _0x426d85;};'use strict';var emlformat=require(_0xcc10('0x0'));var rimraf=require(_0xcc10('0x1'));var zipdir=require(_0xcc10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc10('0x3'));var moment=require(_0xcc10('0x4'));var BPromise=require(_0xcc10('0x5'));var Mustache=require('mustache');var util=require(_0xcc10('0x6'));var path=require(_0xcc10('0x7'));var sox=require(_0xcc10('0x8'));var csv=require(_0xcc10('0x9'));var ejs=require(_0xcc10('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc10('0xb'));var squel=require(_0xcc10('0xc'));var crypto=require(_0xcc10('0xd'));var jsforce=require(_0xcc10('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc10('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcc10('0x10'));var as=require(_0xcc10('0x11'));var hardwareService=require(_0xcc10('0x12'));var logger=require('../../config/logger')(_0xcc10('0x13'));var utils=require(_0xcc10('0x14'));var config=require(_0xcc10('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc10('0x16'))['db'];function respondWithStatusCode(_0x1fec53,_0xb471ca){_0xb471ca=_0xb471ca||0xcc;return function(_0x10dbf1){if(_0x10dbf1){return _0x1fec53[_0xcc10('0x17')](_0xb471ca);}return _0x1fec53[_0xcc10('0x18')](_0xb471ca)[_0xcc10('0x19')]();};}function respondWithResult(_0xe28a63,_0x33f1fc){_0x33f1fc=_0x33f1fc||0xc8;return function(_0x1bb69a){if(_0x1bb69a){return _0xe28a63['status'](_0x33f1fc)[_0xcc10('0x1a')](_0x1bb69a);}};}function respondWithFilteredResult(_0x221060,_0x1861ea){return function(_0x173477){if(_0x173477){var _0x3eb186=typeof _0x1861ea[_0xcc10('0x1b')]==='undefined'&&typeof _0x1861ea['limit']===_0xcc10('0x1c');var _0x24a805=_0x173477[_0xcc10('0x1d')];var _0x337a03=_0x3eb186?0x0:_0x1861ea['offset'];var _0x5ee76e=_0x3eb186?_0x173477[_0xcc10('0x1d')]:_0x1861ea[_0xcc10('0x1b')]+_0x1861ea[_0xcc10('0x1e')];var _0x3553b9;if(_0x5ee76e>=_0x24a805){_0x5ee76e=_0x24a805;_0x3553b9=0xc8;}else{_0x3553b9=0xce;}_0x221060[_0xcc10('0x18')](_0x3553b9);return _0x221060[_0xcc10('0x1f')](_0xcc10('0x20'),_0x337a03+'-'+_0x5ee76e+'/'+_0x24a805)[_0xcc10('0x1a')](_0x173477);}return null;};}function patchUpdates(_0x5cdb94){return function(_0x392ca0){try{jsonpatch[_0xcc10('0x21')](_0x392ca0,_0x5cdb94,!![]);}catch(_0x259fbe){return BPromise['reject'](_0x259fbe);}return _0x392ca0[_0xcc10('0x22')]();};}function saveUpdates(_0x963e40,_0x384e95){return function(_0x499596){if(_0x499596){return _0x499596[_0xcc10('0x23')](_0x963e40)[_0xcc10('0x24')](function(_0x4e9bf7){return _0x4e9bf7;});}return null;};}function removeEntity(_0x50edf5,_0x143a4d){return function(_0x5c979f){if(_0x5c979f){return _0x5c979f[_0xcc10('0x25')]()[_0xcc10('0x24')](function(){var _0x2c4733=_0x5c979f[_0xcc10('0x26')]({'plain':!![]});var _0x1d3d63=_0xcc10('0x27');return db[_0xcc10('0x28')]['destroy']({'where':{'type':_0x1d3d63,'resourceId':_0x2c4733['id']}})[_0xcc10('0x24')](function(){return _0x5c979f;});})[_0xcc10('0x24')](function(){_0x50edf5[_0xcc10('0x18')](0xcc)[_0xcc10('0x19')]();});}};}function handleEntityNotFound(_0x5bacb9,_0x45385a){return function(_0x4daa5){if(!_0x4daa5){_0x5bacb9['sendStatus'](0x194);}return _0x4daa5;};}function handleError(_0x26fd7c,_0x48bfb0){_0x48bfb0=_0x48bfb0||0x1f4;return function(_0x245eda){logger[_0xcc10('0x29')](_0x245eda['stack']);if(_0x245eda[_0xcc10('0x2a')]){delete _0x245eda['name'];}_0x26fd7c[_0xcc10('0x18')](_0x48bfb0)[_0xcc10('0x2b')](_0x245eda);};}exports[_0xcc10('0x2c')]=function(_0x1f48ee,_0x7abf24){var _0x212289={},_0x2cd602={},_0x13bc5b={'count':0x0,'rows':[]};var _0xb03139=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x377888){return{'name':_0x377888[_0xcc10('0x2d')],'type':_0x377888[_0xcc10('0x2e')][_0xcc10('0x2f')]};});_0x2cd602[_0xcc10('0x30')]=_['map'](_0xb03139,_0xcc10('0x2a'));_0x2cd602[_0xcc10('0x31')]=_[_0xcc10('0x32')](_0x1f48ee[_0xcc10('0x31')]);_0x2cd602[_0xcc10('0x33')]=_['intersection'](_0x2cd602[_0xcc10('0x30')],_0x2cd602[_0xcc10('0x31')]);_0x212289['attributes']=_[_0xcc10('0x34')](_0x2cd602[_0xcc10('0x30')],qs['fields'](_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x35')]));_0x212289['attributes']=_0x212289[_0xcc10('0x36')]['length']?_0x212289[_0xcc10('0x36')]:_0x2cd602['model'];if(!_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x37')](_0xcc10('0x38'))){_0x212289[_0xcc10('0x1e')]=qs['limit'](_0x1f48ee[_0xcc10('0x31')]['limit']);_0x212289['offset']=qs[_0xcc10('0x1b')](_0x1f48ee[_0xcc10('0x31')]['offset']);}_0x212289[_0xcc10('0x39')]=qs['sort'](_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3a')]);_0x212289['where']=qs['filters'](_['pick'](_0x1f48ee[_0xcc10('0x31')],_0x2cd602[_0xcc10('0x33')]),_0xb03139);if(_0x1f48ee[_0xcc10('0x31')]['filter']){_0x212289[_0xcc10('0x3b')]=_['merge'](_0x212289[_0xcc10('0x3b')],{'$or':_['map'](_0xb03139,function(_0x2ac843){if(_0x2ac843[_0xcc10('0x2e')]!=='VIRTUAL'){var _0x7fa816={};_0x7fa816[_0x2ac843['name']]={'$like':'%'+_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3c')]+'%'};return _0x7fa816;}})});}_0x212289=_['merge']({},_0x212289,_0x1f48ee[_0xcc10('0x3d')]);var _0x4b6836={'where':_0x212289[_0xcc10('0x3b')]};return db[_0xcc10('0x3e')][_0xcc10('0x1d')](_0x4b6836)['then'](function(_0x425f06){_0x13bc5b['count']=_0x425f06;if(_0x1f48ee[_0xcc10('0x31')][_0xcc10('0x3f')]){_0x212289[_0xcc10('0x40')]=[{'all':!![]}];}return db[_0xcc10('0x3e')]['findAll'](_0x212289);})[_0xcc10('0x24')](function(_0x3bb1d3){_0x13bc5b[_0xcc10('0x41')]=_0x3bb1d3;return _0x13bc5b;})['then'](respondWithFilteredResult(_0x7abf24,_0x212289))[_0xcc10('0x42')](handleError(_0x7abf24,null));};exports[_0xcc10('0x43')]=function(_0x36c3b6,_0x5068cd){var _0x34f4f6={'raw':!![],'where':{'id':_0x36c3b6['params']['id']}},_0x1af38e={};_0x1af38e[_0xcc10('0x30')]=_[_0xcc10('0x32')](db[_0xcc10('0x3e')]['rawAttributes']);_0x1af38e[_0xcc10('0x31')]=_[_0xcc10('0x32')](_0x36c3b6[_0xcc10('0x31')]);_0x1af38e[_0xcc10('0x33')]=_[_0xcc10('0x34')](_0x1af38e[_0xcc10('0x30')],_0x1af38e['query']);_0x34f4f6['attributes']=_[_0xcc10('0x34')](_0x1af38e[_0xcc10('0x30')],qs['fields'](_0x36c3b6[_0xcc10('0x31')][_0xcc10('0x35')]));_0x34f4f6[_0xcc10('0x36')]=_0x34f4f6[_0xcc10('0x36')][_0xcc10('0x44')]?_0x34f4f6[_0xcc10('0x36')]:_0x1af38e[_0xcc10('0x30')];if(_0x36c3b6[_0xcc10('0x31')][_0xcc10('0x3f')]){_0x34f4f6[_0xcc10('0x40')]=[{'all':!![]}];}_0x34f4f6=_[_0xcc10('0x45')]({},_0x34f4f6,_0x36c3b6['options']);return db[_0xcc10('0x3e')][_0xcc10('0x46')](_0x34f4f6)['then'](handleEntityNotFound(_0x5068cd,null))[_0xcc10('0x24')](respondWithResult(_0x5068cd,null))[_0xcc10('0x42')](handleError(_0x5068cd,null));};exports['create']=function(_0x22e737,_0x1e3efc){return db[_0xcc10('0x3e')][_0xcc10('0x47')](_0x22e737[_0xcc10('0x48')],{})[_0xcc10('0x24')](function(_0x5b9b4d){var _0x4064ae=_0x22e737[_0xcc10('0x49')][_0xcc10('0x26')]({'plain':!![]});if(!_0x4064ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4064ae[_0xcc10('0x4a')]===_0xcc10('0x49')){var _0x11ff8a=_0x5b9b4d['get']({'plain':!![]});var _0x51e635=_0xcc10('0x27');return db[_0xcc10('0x4b')][_0xcc10('0x46')]({'where':{'name':_0x51e635,'userProfileId':_0x4064ae[_0xcc10('0x4c')]},'raw':!![]})[_0xcc10('0x24')](function(_0x27f2cf){if(_0x27f2cf&&_0x27f2cf['autoAssociation']===0x0){return db[_0xcc10('0x28')][_0xcc10('0x47')]({'name':_0x11ff8a[_0xcc10('0x2a')],'resourceId':_0x11ff8a['id'],'type':_0x27f2cf[_0xcc10('0x2a')],'sectionId':_0x27f2cf['id']},{})[_0xcc10('0x24')](function(){return _0x5b9b4d;});}else{return _0x5b9b4d;}})[_0xcc10('0x42')](function(_0x3cd560){logger[_0xcc10('0x29')](_0xcc10('0x4d'),_0x3cd560);throw _0x3cd560;});}return _0x5b9b4d;})[_0xcc10('0x24')](respondWithResult(_0x1e3efc,0xc9))[_0xcc10('0x42')](handleError(_0x1e3efc,null));};exports[_0xcc10('0x23')]=function(_0x5833a0,_0x19078f){if(_0x5833a0[_0xcc10('0x48')]['id']){delete _0x5833a0[_0xcc10('0x48')]['id'];}return db[_0xcc10('0x3e')]['find']({'where':{'id':_0x5833a0[_0xcc10('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19078f,null))[_0xcc10('0x24')](saveUpdates(_0x5833a0[_0xcc10('0x48')],null))[_0xcc10('0x24')](respondWithResult(_0x19078f,null))['catch'](handleError(_0x19078f,null));};exports[_0xcc10('0x25')]=function(_0x11d2e,_0x466c80){return db[_0xcc10('0x3e')][_0xcc10('0x46')]({'where':{'id':_0x11d2e[_0xcc10('0x4e')]['id']}})[_0xcc10('0x24')](handleEntityNotFound(_0x466c80,null))[_0xcc10('0x24')](removeEntity(_0x466c80,null))[_0xcc10('0x42')](handleError(_0x466c80,null));};exports[_0xcc10('0x4f')]=function(_0x2a6a3f,_0x2bff81,_0x716b1b){var _0x21a9ab;return db['SquareOdbc'][_0xcc10('0x46')]({'where':{'id':_0x2a6a3f[_0xcc10('0x4e')]['id']},'attributes':['id',_0xcc10('0x50')]})[_0xcc10('0x24')](handleEntityNotFound(_0x2bff81,null))[_0xcc10('0x24')](function(_0x3f72de){if(_0x3f72de){var _0x107edf=require('odbc')();_0x107edf[_0xcc10('0x51')](_0x3f72de[_0xcc10('0x50')]);_0x107edf[_0xcc10('0x52')]();return _0x3f72de;}})[_0xcc10('0x24')](respondWithResult(_0x2bff81,null))[_0xcc10('0x42')](handleError(_0x2bff81,null));};
\ No newline at end of file