Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index ec5bf27..032e943 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x61f0=['Content-Range','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x61f0,0x19b));var _0x061f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x61f0[_0x3b380d];return _0x54502b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x061f('0x0'));var rimraf=require(_0x061f('0x1'));var zipdir=require(_0x061f('0x2'));var jsonpatch=require(_0x061f('0x3'));var rp=require(_0x061f('0x4'));var moment=require(_0x061f('0x5'));var BPromise=require(_0x061f('0x6'));var Mustache=require('mustache');var util=require(_0x061f('0x7'));var path=require(_0x061f('0x8'));var sox=require(_0x061f('0x9'));var csv=require(_0x061f('0xa'));var ejs=require(_0x061f('0xb'));var fs=require('fs');var _=require(_0x061f('0xc'));var squel=require(_0x061f('0xd'));var crypto=require(_0x061f('0xe'));var jsforce=require(_0x061f('0xf'));var deskjs=require(_0x061f('0x10'));var toCsv=require(_0x061f('0xa'));var querystring=require(_0x061f('0x11'));var Papa=require('papaparse');var Redis=require(_0x061f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x061f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x061f('0x14'));var logger=require(_0x061f('0x15'))(_0x061f('0x16'));var utils=require(_0x061f('0x17'));var config=require('../../config/environment');var db=require(_0x061f('0x18'))['db'];function respondWithStatusCode(_0x5ab34e,_0x521922){_0x521922=_0x521922||0xcc;return function(_0x26cf9b){if(_0x26cf9b){return _0x5ab34e['sendStatus'](_0x521922);}return _0x5ab34e[_0x061f('0x19')](_0x521922)[_0x061f('0x1a')]();};}function respondWithResult(_0x43db6b,_0x53fd03){_0x53fd03=_0x53fd03||0xc8;return function(_0x57ab57){if(_0x57ab57){return _0x43db6b['status'](_0x53fd03)[_0x061f('0x1b')](_0x57ab57);}};}function respondWithFilteredResult(_0x36174a,_0x1dc669){return function(_0x56a385){if(_0x56a385){var _0x2c60f6=_0x56a385['count'],_0x1876d7=_0x1dc669[_0x061f('0x1c')],_0x9beb26=_0x1dc669[_0x061f('0x1c')]+_0x1dc669['limit'],_0x49d7cb;if(_0x9beb26>=_0x2c60f6){_0x9beb26=_0x2c60f6;_0x49d7cb=0xc8;}else{_0x49d7cb=0xce;}_0x36174a[_0x061f('0x19')](_0x49d7cb);return _0x36174a['set'](_0x061f('0x1d'),_0x1876d7+'-'+_0x9beb26+'/'+_0x2c60f6)[_0x061f('0x1b')](_0x56a385);}return null;};}function patchUpdates(_0x76bfa0){return function(_0x5e9e41){try{jsonpatch[_0x061f('0x1e')](_0x5e9e41,_0x76bfa0,!![]);}catch(_0x5a2b09){return BPromise[_0x061f('0x1f')](_0x5a2b09);}return _0x5e9e41[_0x061f('0x20')]();};}function saveUpdates(_0x1e81ac,_0x1bb63f){return function(_0x416534){if(_0x416534){return _0x416534[_0x061f('0x21')](_0x1e81ac)['then'](function(_0x49cae3){return _0x49cae3;});}return null;};}function removeEntity(_0x470559,_0x171cd7){return function(_0x1c3190){if(_0x1c3190){return _0x1c3190[_0x061f('0x22')]()[_0x061f('0x23')](function(){var _0x1d9fba=_0x1c3190[_0x061f('0x24')]({'plain':!![]});var _0x7865cf=_0x061f('0x25');return db[_0x061f('0x26')][_0x061f('0x22')]({'where':{'type':_0x7865cf,'resourceId':_0x1d9fba['id']}})[_0x061f('0x23')](function(){return _0x1c3190;});})['then'](function(){_0x470559[_0x061f('0x19')](0xcc)[_0x061f('0x1a')]();});}};}function handleEntityNotFound(_0x305d61,_0x54e426){return function(_0x4ae9b5){if(!_0x4ae9b5){_0x305d61['sendStatus'](0x194);}return _0x4ae9b5;};}function handleError(_0x13ad55,_0x185367){_0x185367=_0x185367||0x1f4;return function(_0x436ead){logger[_0x061f('0x27')](_0x436ead[_0x061f('0x28')]);if(_0x436ead[_0x061f('0x29')]){delete _0x436ead[_0x061f('0x29')];}_0x13ad55[_0x061f('0x19')](_0x185367)[_0x061f('0x2a')](_0x436ead);};}exports[_0x061f('0x2b')]=function(_0x13b9d5,_0x36a889){var _0x1b25b2={},_0x29e6a7={},_0x3b3a82={'count':0x0,'rows':[]};var _0xa926d4=_[_0x061f('0x2c')](db[_0x061f('0x2d')][_0x061f('0x2e')],function(_0x509078){return{'name':_0x509078[_0x061f('0x2f')],'type':_0x509078[_0x061f('0x30')][_0x061f('0x31')]};});_0x29e6a7[_0x061f('0x32')]=_[_0x061f('0x2c')](_0xa926d4,_0x061f('0x29'));_0x29e6a7[_0x061f('0x33')]=_[_0x061f('0x34')](_0x13b9d5[_0x061f('0x33')]);_0x29e6a7[_0x061f('0x35')]=_[_0x061f('0x36')](_0x29e6a7[_0x061f('0x32')],_0x29e6a7[_0x061f('0x33')]);_0x1b25b2[_0x061f('0x37')]=_['intersection'](_0x29e6a7[_0x061f('0x32')],qs[_0x061f('0x38')](_0x13b9d5[_0x061f('0x33')][_0x061f('0x38')]));_0x1b25b2[_0x061f('0x37')]=_0x1b25b2[_0x061f('0x37')][_0x061f('0x39')]?_0x1b25b2[_0x061f('0x37')]:_0x29e6a7[_0x061f('0x32')];if(!_0x13b9d5[_0x061f('0x33')][_0x061f('0x3a')](_0x061f('0x3b'))){_0x1b25b2['limit']=qs['limit'](_0x13b9d5[_0x061f('0x33')][_0x061f('0x3c')]);_0x1b25b2[_0x061f('0x1c')]=qs['offset'](_0x13b9d5['query'][_0x061f('0x1c')]);}_0x1b25b2['order']=qs[_0x061f('0x3d')](_0x13b9d5[_0x061f('0x33')]['sort']);_0x1b25b2[_0x061f('0x3e')]=qs[_0x061f('0x35')](_['pick'](_0x13b9d5[_0x061f('0x33')],_0x29e6a7['filters']),_0xa926d4);if(_0x13b9d5['query'][_0x061f('0x3f')]){_0x1b25b2[_0x061f('0x3e')]=_[_0x061f('0x40')](_0x1b25b2['where'],{'$or':_[_0x061f('0x2c')](_0xa926d4,function(_0x569eac){if(_0x569eac[_0x061f('0x30')]!==_0x061f('0x41')){var _0x56d7d9={};_0x56d7d9[_0x569eac[_0x061f('0x29')]]={'$like':'%'+_0x13b9d5[_0x061f('0x33')]['filter']+'%'};return _0x56d7d9;}})});}_0x1b25b2=_[_0x061f('0x40')]({},_0x1b25b2,_0x13b9d5[_0x061f('0x42')]);var _0x37669e={'where':_0x1b25b2[_0x061f('0x3e')]};return db['SquareOdbc'][_0x061f('0x43')](_0x37669e)['then'](function(_0x1c0aab){_0x3b3a82[_0x061f('0x43')]=_0x1c0aab;if(_0x13b9d5['query'][_0x061f('0x44')]){_0x1b25b2[_0x061f('0x45')]=[{'all':!![]}];}return db[_0x061f('0x2d')][_0x061f('0x46')](_0x1b25b2);})[_0x061f('0x23')](function(_0x564b0a){_0x3b3a82[_0x061f('0x47')]=_0x564b0a;return _0x3b3a82;})[_0x061f('0x23')](respondWithFilteredResult(_0x36a889,_0x1b25b2))[_0x061f('0x48')](handleError(_0x36a889,null));};exports[_0x061f('0x49')]=function(_0x3197db,_0x408856){var _0x289fae={'raw':!![],'where':{'id':_0x3197db[_0x061f('0x4a')]['id']}},_0x3ad718={};_0x3ad718[_0x061f('0x32')]=_[_0x061f('0x34')](db[_0x061f('0x2d')][_0x061f('0x2e')]);_0x3ad718[_0x061f('0x33')]=_['keys'](_0x3197db[_0x061f('0x33')]);_0x3ad718['filters']=_[_0x061f('0x36')](_0x3ad718[_0x061f('0x32')],_0x3ad718['query']);_0x289fae[_0x061f('0x37')]=_[_0x061f('0x36')](_0x3ad718[_0x061f('0x32')],qs['fields'](_0x3197db['query']['fields']));_0x289fae[_0x061f('0x37')]=_0x289fae[_0x061f('0x37')][_0x061f('0x39')]?_0x289fae['attributes']:_0x3ad718['model'];if(_0x3197db[_0x061f('0x33')][_0x061f('0x44')]){_0x289fae[_0x061f('0x45')]=[{'all':!![]}];}_0x289fae=_[_0x061f('0x40')]({},_0x289fae,_0x3197db[_0x061f('0x42')]);return db[_0x061f('0x2d')][_0x061f('0x4b')](_0x289fae)['then'](handleEntityNotFound(_0x408856,null))[_0x061f('0x23')](respondWithResult(_0x408856,null))['catch'](handleError(_0x408856,null));};exports[_0x061f('0x4c')]=function(_0x488871,_0x1615f9){return db[_0x061f('0x2d')][_0x061f('0x4c')](_0x488871[_0x061f('0x4d')],{})[_0x061f('0x23')](function(_0x260c50){var _0x15ac6d=_0x488871[_0x061f('0x4e')]['get']({'plain':!![]});if(!_0x15ac6d)throw new Error(_0x061f('0x4f'));if(_0x15ac6d[_0x061f('0x50')]==='user'){var _0x31457f=_0x260c50[_0x061f('0x24')]({'plain':!![]});var _0xf0653a=_0x061f('0x25');return db[_0x061f('0x51')][_0x061f('0x4b')]({'where':{'name':_0xf0653a,'userProfileId':_0x15ac6d[_0x061f('0x52')]},'raw':!![]})['then'](function(_0x5593f5){if(_0x5593f5&&_0x5593f5['autoAssociation']===0x0){return db[_0x061f('0x26')][_0x061f('0x4c')]({'name':_0x31457f[_0x061f('0x29')],'resourceId':_0x31457f['id'],'type':_0x5593f5['name'],'sectionId':_0x5593f5['id']},{})[_0x061f('0x23')](function(){return _0x260c50;});}else{return _0x260c50;}})['catch'](function(_0x38c967){logger[_0x061f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c967);throw _0x38c967;});}return _0x260c50;})[_0x061f('0x23')](respondWithResult(_0x1615f9,0xc9))[_0x061f('0x48')](handleError(_0x1615f9,null));};exports[_0x061f('0x21')]=function(_0x3c2f92,_0x37937a){if(_0x3c2f92[_0x061f('0x4d')]['id']){delete _0x3c2f92[_0x061f('0x4d')]['id'];}return db['SquareOdbc'][_0x061f('0x4b')]({'where':{'id':_0x3c2f92[_0x061f('0x4a')]['id']}})[_0x061f('0x23')](handleEntityNotFound(_0x37937a,null))[_0x061f('0x23')](saveUpdates(_0x3c2f92['body'],null))['then'](respondWithResult(_0x37937a,null))['catch'](handleError(_0x37937a,null));};exports['destroy']=function(_0x4297a8,_0x109dd2){return db['SquareOdbc'][_0x061f('0x4b')]({'where':{'id':_0x4297a8[_0x061f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x109dd2,null))['then'](removeEntity(_0x109dd2,null))[_0x061f('0x48')](handleError(_0x109dd2,null));};exports[_0x061f('0x53')]=function(_0x2c4f0d,_0x54f91e,_0x562155){var _0xa11a5e;return db[_0x061f('0x2d')][_0x061f('0x4b')]({'where':{'id':_0x2c4f0d[_0x061f('0x4a')]['id']},'attributes':['id',_0x061f('0x54')]})['then'](handleEntityNotFound(_0x54f91e,null))[_0x061f('0x23')](function(_0x4a2c62){if(_0x4a2c62){var _0x3bf309=require(_0x061f('0x55'))();_0x3bf309[_0x061f('0x56')](_0x4a2c62[_0x061f('0x54')]);_0x3bf309[_0x061f('0x57')]();return _0x4a2c62;}})[_0x061f('0x23')](respondWithResult(_0x54f91e,null))['catch'](handleError(_0x54f91e,null));};
\ No newline at end of file
+var _0x2323=['destroy','sendStatus','stack','name','map','SquareOdbc','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','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','params','test','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','end','status','json','count','offset','set','Content-Range','apply','save','update','then','get','ODBC','UserProfileResource'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x2323,0xcd));var _0x3232=function(_0x119f7b,_0x204cc4){_0x119f7b=_0x119f7b-0x0;var _0x247400=_0x2323[_0x119f7b];return _0x247400;};'use strict';var pdf=require(_0x3232('0x0'));var emlformat=require(_0x3232('0x1'));var rimraf=require(_0x3232('0x2'));var zipdir=require(_0x3232('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3232('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3232('0x5'));var util=require('util');var path=require(_0x3232('0x6'));var sox=require(_0x3232('0x7'));var csv=require(_0x3232('0x8'));var ejs=require(_0x3232('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3232('0xa'));var crypto=require(_0x3232('0xb'));var jsforce=require(_0x3232('0xc'));var deskjs=require(_0x3232('0xd'));var toCsv=require(_0x3232('0x8'));var querystring=require(_0x3232('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3232('0xf'));var qs=require(_0x3232('0x10'));var as=require(_0x3232('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3232('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3232('0x13'));var licenseUtil=require(_0x3232('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4603ab,_0x497a8d){_0x497a8d=_0x497a8d||0xcc;return function(_0x1628ed){if(_0x1628ed){return _0x4603ab['sendStatus'](_0x497a8d);}return _0x4603ab['status'](_0x497a8d)[_0x3232('0x15')]();};}function respondWithResult(_0x2d3ca3,_0x25551a){_0x25551a=_0x25551a||0xc8;return function(_0x39790d){if(_0x39790d){return _0x2d3ca3[_0x3232('0x16')](_0x25551a)[_0x3232('0x17')](_0x39790d);}};}function respondWithFilteredResult(_0x202a8d,_0x1db426){return function(_0x7eefdb){if(_0x7eefdb){var _0x4ba333=_0x7eefdb[_0x3232('0x18')],_0x1ad92d=_0x1db426[_0x3232('0x19')],_0x3b8839=_0x1db426[_0x3232('0x19')]+_0x1db426['limit'],_0x153929;if(_0x3b8839>=_0x4ba333){_0x3b8839=_0x4ba333;_0x153929=0xc8;}else{_0x153929=0xce;}_0x202a8d[_0x3232('0x16')](_0x153929);return _0x202a8d[_0x3232('0x1a')](_0x3232('0x1b'),_0x1ad92d+'-'+_0x3b8839+'/'+_0x4ba333)[_0x3232('0x17')](_0x7eefdb);}return null;};}function patchUpdates(_0x5ec93d){return function(_0x4bc5b7){try{jsonpatch[_0x3232('0x1c')](_0x4bc5b7,_0x5ec93d,!![]);}catch(_0x36e03e){return BPromise['reject'](_0x36e03e);}return _0x4bc5b7[_0x3232('0x1d')]();};}function saveUpdates(_0x978bbc,_0x350d23){return function(_0x4a20c5){if(_0x4a20c5){return _0x4a20c5[_0x3232('0x1e')](_0x978bbc)[_0x3232('0x1f')](function(_0x3ef230){return _0x3ef230;});}return null;};}function removeEntity(_0x1a2209,_0x279ec3){return function(_0x12f271){if(_0x12f271){return _0x12f271['destroy']()[_0x3232('0x1f')](function(){var _0xec8479=_0x12f271[_0x3232('0x20')]({'plain':!![]});var _0x53ec37=_0x3232('0x21');return db[_0x3232('0x22')][_0x3232('0x23')]({'where':{'type':_0x53ec37,'resourceId':_0xec8479['id']}})[_0x3232('0x1f')](function(){return _0x12f271;});})[_0x3232('0x1f')](function(){_0x1a2209['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2af6d7,_0x5e9182){return function(_0x359f57){if(!_0x359f57){_0x2af6d7[_0x3232('0x24')](0x194);}return _0x359f57;};}function handleError(_0x57180a,_0x313207){_0x313207=_0x313207||0x1f4;return function(_0x56d8b3){logger['error'](_0x56d8b3[_0x3232('0x25')]);if(_0x56d8b3[_0x3232('0x26')]){delete _0x56d8b3[_0x3232('0x26')];}_0x57180a[_0x3232('0x16')](_0x313207)['send'](_0x56d8b3);};}exports['index']=function(_0x340d56,_0x2362d2){var _0x55f67f={},_0x554d7b={},_0x3cbc42={'count':0x0,'rows':[]};var _0x20753d=_[_0x3232('0x27')](db[_0x3232('0x28')]['rawAttributes'],function(_0x312590){return{'name':_0x312590['fieldName'],'type':_0x312590['type']['key']};});_0x554d7b[_0x3232('0x29')]=_['map'](_0x20753d,_0x3232('0x26'));_0x554d7b['query']=_['keys'](_0x340d56[_0x3232('0x2a')]);_0x554d7b['filters']=_[_0x3232('0x2b')](_0x554d7b[_0x3232('0x29')],_0x554d7b[_0x3232('0x2a')]);_0x55f67f['attributes']=_[_0x3232('0x2b')](_0x554d7b[_0x3232('0x29')],qs['fields'](_0x340d56[_0x3232('0x2a')][_0x3232('0x2c')]));_0x55f67f[_0x3232('0x2d')]=_0x55f67f[_0x3232('0x2d')][_0x3232('0x2e')]?_0x55f67f[_0x3232('0x2d')]:_0x554d7b[_0x3232('0x29')];if(!_0x340d56[_0x3232('0x2a')][_0x3232('0x2f')](_0x3232('0x30'))){_0x55f67f[_0x3232('0x31')]=qs[_0x3232('0x31')](_0x340d56[_0x3232('0x2a')][_0x3232('0x31')]);_0x55f67f[_0x3232('0x19')]=qs['offset'](_0x340d56[_0x3232('0x2a')][_0x3232('0x19')]);}_0x55f67f['order']=qs[_0x3232('0x32')](_0x340d56[_0x3232('0x2a')][_0x3232('0x32')]);_0x55f67f[_0x3232('0x33')]=qs['filters'](_[_0x3232('0x34')](_0x340d56['query'],_0x554d7b[_0x3232('0x35')]),_0x20753d);if(_0x340d56[_0x3232('0x2a')][_0x3232('0x36')]){_0x55f67f[_0x3232('0x33')]=_[_0x3232('0x37')](_0x55f67f[_0x3232('0x33')],{'$or':_[_0x3232('0x27')](_0x20753d,function(_0x1309a1){if(_0x1309a1[_0x3232('0x38')]!=='VIRTUAL'){var _0x268335={};_0x268335[_0x1309a1[_0x3232('0x26')]]={'$like':'%'+_0x340d56[_0x3232('0x2a')][_0x3232('0x36')]+'%'};return _0x268335;}})});}_0x55f67f=_[_0x3232('0x37')]({},_0x55f67f,_0x340d56[_0x3232('0x39')]);var _0x1aa7a3={'where':_0x55f67f[_0x3232('0x33')]};return db[_0x3232('0x28')][_0x3232('0x18')](_0x1aa7a3)[_0x3232('0x1f')](function(_0x449748){_0x3cbc42[_0x3232('0x18')]=_0x449748;if(_0x340d56['query'][_0x3232('0x3a')]){_0x55f67f[_0x3232('0x3b')]=[{'all':!![]}];}return db[_0x3232('0x28')][_0x3232('0x3c')](_0x55f67f);})[_0x3232('0x1f')](function(_0x119b82){_0x3cbc42[_0x3232('0x3d')]=_0x119b82;return _0x3cbc42;})[_0x3232('0x1f')](respondWithFilteredResult(_0x2362d2,_0x55f67f))[_0x3232('0x3e')](handleError(_0x2362d2,null));};exports[_0x3232('0x3f')]=function(_0x13f7e6,_0x3e4011){var _0x18360f={'raw':!![],'where':{'id':_0x13f7e6['params']['id']}},_0x3830d6={};_0x3830d6['model']=_['keys'](db[_0x3232('0x28')][_0x3232('0x40')]);_0x3830d6[_0x3232('0x2a')]=_[_0x3232('0x41')](_0x13f7e6['query']);_0x3830d6[_0x3232('0x35')]=_[_0x3232('0x2b')](_0x3830d6['model'],_0x3830d6[_0x3232('0x2a')]);_0x18360f[_0x3232('0x2d')]=_[_0x3232('0x2b')](_0x3830d6[_0x3232('0x29')],qs['fields'](_0x13f7e6['query'][_0x3232('0x2c')]));_0x18360f['attributes']=_0x18360f['attributes'][_0x3232('0x2e')]?_0x18360f['attributes']:_0x3830d6[_0x3232('0x29')];if(_0x13f7e6[_0x3232('0x2a')]['includeAll']){_0x18360f[_0x3232('0x3b')]=[{'all':!![]}];}_0x18360f=_[_0x3232('0x37')]({},_0x18360f,_0x13f7e6[_0x3232('0x39')]);return db[_0x3232('0x28')][_0x3232('0x42')](_0x18360f)[_0x3232('0x1f')](handleEntityNotFound(_0x3e4011,null))['then'](respondWithResult(_0x3e4011,null))[_0x3232('0x3e')](handleError(_0x3e4011,null));};exports[_0x3232('0x43')]=function(_0x260e8c,_0x3c61ee){return db['SquareOdbc'][_0x3232('0x43')](_0x260e8c[_0x3232('0x44')],{})[_0x3232('0x1f')](function(_0xe4a0fb){var _0x44f8bd=_0x260e8c[_0x3232('0x45')][_0x3232('0x20')]({'plain':!![]});if(!_0x44f8bd)throw new Error(_0x3232('0x46'));if(_0x44f8bd[_0x3232('0x47')]===_0x3232('0x45')){var _0x2771cb=_0xe4a0fb[_0x3232('0x20')]({'plain':!![]});var _0x42b7a8=_0x3232('0x21');return db[_0x3232('0x48')]['find']({'where':{'name':_0x42b7a8,'userProfileId':_0x44f8bd[_0x3232('0x49')]},'raw':!![]})['then'](function(_0x50269c){if(_0x50269c&&_0x50269c[_0x3232('0x4a')]===0x0){return db[_0x3232('0x22')][_0x3232('0x43')]({'name':_0x2771cb[_0x3232('0x26')],'resourceId':_0x2771cb['id'],'type':_0x50269c[_0x3232('0x26')],'sectionId':_0x50269c['id']},{})[_0x3232('0x1f')](function(){return _0xe4a0fb;});}else{return _0xe4a0fb;}})[_0x3232('0x3e')](function(_0x33dbc3){logger['error'](_0x3232('0x4b'),_0x33dbc3);throw _0x33dbc3;});}return _0xe4a0fb;})[_0x3232('0x1f')](respondWithResult(_0x3c61ee,0xc9))[_0x3232('0x3e')](handleError(_0x3c61ee,null));};exports[_0x3232('0x1e')]=function(_0x1211ca,_0x462965){if(_0x1211ca[_0x3232('0x44')]['id']){delete _0x1211ca[_0x3232('0x44')]['id'];}return db[_0x3232('0x28')]['find']({'where':{'id':_0x1211ca[_0x3232('0x4c')]['id']}})[_0x3232('0x1f')](handleEntityNotFound(_0x462965,null))[_0x3232('0x1f')](saveUpdates(_0x1211ca['body'],null))['then'](respondWithResult(_0x462965,null))[_0x3232('0x3e')](handleError(_0x462965,null));};exports['destroy']=function(_0x5b9e03,_0x280cee){return db[_0x3232('0x28')][_0x3232('0x42')]({'where':{'id':_0x5b9e03[_0x3232('0x4c')]['id']}})['then'](handleEntityNotFound(_0x280cee,null))[_0x3232('0x1f')](removeEntity(_0x280cee,null))[_0x3232('0x3e')](handleError(_0x280cee,null));};exports[_0x3232('0x4d')]=function(_0x4cc1aa,_0x10b3e8,_0x29825c){var _0x215180;return db['SquareOdbc'][_0x3232('0x42')]({'where':{'id':_0x4cc1aa['params']['id']},'attributes':['id',_0x3232('0x4e')]})[_0x3232('0x1f')](handleEntityNotFound(_0x10b3e8,null))[_0x3232('0x1f')](function(_0x41929e){if(_0x41929e){var _0xca3937=require('odbc')();_0xca3937['openSync'](_0x41929e[_0x3232('0x4e')]);_0xca3937[_0x3232('0x4f')]();return _0x41929e;}})[_0x3232('0x1f')](respondWithResult(_0x10b3e8,null))[_0x3232('0x3e')](handleError(_0x10b3e8,null));};
\ No newline at end of file