Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 7dbc797..27ff276 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf039=['update','then','ExtractedReports','name','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','download','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','savename','format','basename','toLowerCase','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','offset','count','status','set','apply','reject','save'];(function(_0x3f9f0f,_0x531b30){var _0x2eb31d=function(_0x43feb1){while(--_0x43feb1){_0x3f9f0f['push'](_0x3f9f0f['shift']());}};_0x2eb31d(++_0x531b30);}(_0xf039,0x1b5));var _0x9f03=function(_0x5dd778,_0x5045e8){_0x5dd778=_0x5dd778-0x0;var _0x359c75=_0xf039[_0x5dd778];return _0x359c75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f03('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f03('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f03('0x2'));var util=require(_0x9f03('0x3'));var path=require(_0x9f03('0x4'));var sox=require(_0x9f03('0x5'));var csv=require(_0x9f03('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f03('0x7'));var _=require(_0x9f03('0x8'));var squel=require(_0x9f03('0x9'));var crypto=require(_0x9f03('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9f03('0xb'));var toCsv=require(_0x9f03('0x6'));var querystring=require(_0x9f03('0xc'));var Papa=require(_0x9f03('0xd'));var Redis=require(_0x9f03('0xe'));var authService=require(_0x9f03('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f03('0x10'));var logger=require('../../config/logger')(_0x9f03('0x11'));var utils=require(_0x9f03('0x12'));var config=require(_0x9f03('0x13'));var licenseUtil=require(_0x9f03('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48d7b5,_0x2c7b97){_0x2c7b97=_0x2c7b97||0xcc;return function(_0x324fa4){if(_0x324fa4){return _0x48d7b5[_0x9f03('0x15')](_0x2c7b97);}return _0x48d7b5['status'](_0x2c7b97)[_0x9f03('0x16')]();};}function respondWithResult(_0x54e557,_0x56f90b){_0x56f90b=_0x56f90b||0xc8;return function(_0x28379f){if(_0x28379f){return _0x54e557['status'](_0x56f90b)[_0x9f03('0x17')](_0x28379f);}};}function respondWithFilteredResult(_0x1f3101,_0x2f4937){return function(_0x4f2c80){if(_0x4f2c80){var _0x50b236=typeof _0x2f4937['offset']===_0x9f03('0x18')&&typeof _0x2f4937[_0x9f03('0x19')]==='undefined';var _0x56e5c8=_0x4f2c80['count'];var _0x47beca=_0x50b236?0x0:_0x2f4937[_0x9f03('0x1a')];var _0x342c2c=_0x50b236?_0x4f2c80[_0x9f03('0x1b')]:_0x2f4937[_0x9f03('0x1a')]+_0x2f4937[_0x9f03('0x19')];var _0x191788;if(_0x342c2c>=_0x56e5c8){_0x342c2c=_0x56e5c8;_0x191788=0xc8;}else{_0x191788=0xce;}_0x1f3101[_0x9f03('0x1c')](_0x191788);return _0x1f3101[_0x9f03('0x1d')]('Content-Range',_0x47beca+'-'+_0x342c2c+'/'+_0x56e5c8)[_0x9f03('0x17')](_0x4f2c80);}return null;};}function patchUpdates(_0x45003a){return function(_0x10b780){try{jsonpatch[_0x9f03('0x1e')](_0x10b780,_0x45003a,!![]);}catch(_0x4ef30a){return BPromise[_0x9f03('0x1f')](_0x4ef30a);}return _0x10b780[_0x9f03('0x20')]();};}function saveUpdates(_0x3fa7ce,_0x5aff90){return function(_0x525463){if(_0x525463){return _0x525463[_0x9f03('0x21')](_0x3fa7ce)[_0x9f03('0x22')](function(_0x18fefe){return _0x18fefe;});}return null;};}function removeEntity(_0xfb7a2e,_0x573e5b){return function(_0x4a6442){if(_0x4a6442){return _0x4a6442['destroy']()['then'](function(){var _0x467b98=_0x4a6442['get']({'plain':!![]});var _0x3f8e5e=_0x9f03('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x3f8e5e,'resourceId':_0x467b98['id']}})[_0x9f03('0x22')](function(){return _0x4a6442;});})['then'](function(){_0xfb7a2e['status'](0xcc)[_0x9f03('0x16')]();});}};}function handleEntityNotFound(_0x3399b1,_0x1b24da){return function(_0x273081){if(!_0x273081){_0x3399b1['sendStatus'](0x194);}return _0x273081;};}function handleError(_0x4911a2,_0x2b8443){_0x2b8443=_0x2b8443||0x1f4;return function(_0x472de6){logger['error'](_0x472de6['stack']);if(_0x472de6['name']){delete _0x472de6[_0x9f03('0x24')];}_0x4911a2[_0x9f03('0x1c')](_0x2b8443)['send'](_0x472de6);};}exports[_0x9f03('0x25')]=function(_0x2bc133,_0x1a185a){var _0x2965ea={},_0x26086f={},_0x1e4f57={'count':0x0,'rows':[]};var _0x2edd38=_['map'](db[_0x9f03('0x26')][_0x9f03('0x27')],function(_0x3d7601){return{'name':_0x3d7601[_0x9f03('0x28')],'type':_0x3d7601[_0x9f03('0x29')][_0x9f03('0x2a')]};});_0x26086f['model']=_[_0x9f03('0x2b')](_0x2edd38,_0x9f03('0x24'));_0x26086f[_0x9f03('0x2c')]=_[_0x9f03('0x2d')](_0x2bc133[_0x9f03('0x2c')]);_0x26086f[_0x9f03('0x2e')]=_[_0x9f03('0x2f')](_0x26086f[_0x9f03('0x30')],_0x26086f[_0x9f03('0x2c')]);_0x2965ea[_0x9f03('0x31')]=_[_0x9f03('0x2f')](_0x26086f[_0x9f03('0x30')],qs[_0x9f03('0x32')](_0x2bc133['query'][_0x9f03('0x32')]));_0x2965ea[_0x9f03('0x31')]=_0x2965ea[_0x9f03('0x31')][_0x9f03('0x33')]?_0x2965ea[_0x9f03('0x31')]:_0x26086f[_0x9f03('0x30')];if(!_0x2bc133[_0x9f03('0x2c')][_0x9f03('0x34')](_0x9f03('0x35'))){_0x2965ea[_0x9f03('0x19')]=qs[_0x9f03('0x19')](_0x2bc133[_0x9f03('0x2c')]['limit']);_0x2965ea[_0x9f03('0x1a')]=qs[_0x9f03('0x1a')](_0x2bc133[_0x9f03('0x2c')][_0x9f03('0x1a')]);}_0x2965ea[_0x9f03('0x36')]=qs[_0x9f03('0x37')](_0x2bc133[_0x9f03('0x2c')][_0x9f03('0x37')]);_0x2965ea[_0x9f03('0x38')]=qs[_0x9f03('0x2e')](_[_0x9f03('0x39')](_0x2bc133['query'],_0x26086f['filters']),_0x2edd38);if(_0x2bc133[_0x9f03('0x2c')][_0x9f03('0x3a')]){_0x2965ea['where']=_[_0x9f03('0x3b')](_0x2965ea['where'],{'$or':_[_0x9f03('0x2b')](_0x2edd38,function(_0x1f00c4){if(_0x1f00c4['type']!==_0x9f03('0x3c')){var _0x33b29b={};_0x33b29b[_0x1f00c4[_0x9f03('0x24')]]={'$like':'%'+_0x2bc133[_0x9f03('0x2c')]['filter']+'%'};return _0x33b29b;}})});}_0x2965ea=_[_0x9f03('0x3b')]({},_0x2965ea,_0x2bc133[_0x9f03('0x3d')]);var _0x4d26c8={'where':_0x2965ea['where']};return db[_0x9f03('0x26')][_0x9f03('0x1b')](_0x4d26c8)[_0x9f03('0x22')](function(_0x44effa){_0x1e4f57['count']=_0x44effa;if(_0x2bc133[_0x9f03('0x2c')]['includeAll']){_0x2965ea[_0x9f03('0x3e')]=[{'all':!![]}];}return db[_0x9f03('0x26')]['findAll'](_0x2965ea);})[_0x9f03('0x22')](function(_0x1211a5){_0x1e4f57[_0x9f03('0x3f')]=_0x1211a5;return _0x1e4f57;})[_0x9f03('0x22')](respondWithFilteredResult(_0x1a185a,_0x2965ea))[_0x9f03('0x40')](handleError(_0x1a185a,null));};exports[_0x9f03('0x41')]=function(_0x543935,_0x8e3d63){var _0x52a5dd={'raw':!![],'where':{'id':_0x543935[_0x9f03('0x42')]['id']}},_0x56063c={};_0x56063c[_0x9f03('0x30')]=_['keys'](db[_0x9f03('0x26')]['rawAttributes']);_0x56063c[_0x9f03('0x2c')]=_[_0x9f03('0x2d')](_0x543935[_0x9f03('0x2c')]);_0x56063c[_0x9f03('0x2e')]=_[_0x9f03('0x2f')](_0x56063c[_0x9f03('0x30')],_0x56063c[_0x9f03('0x2c')]);_0x52a5dd[_0x9f03('0x31')]=_[_0x9f03('0x2f')](_0x56063c['model'],qs[_0x9f03('0x32')](_0x543935['query'][_0x9f03('0x32')]));_0x52a5dd[_0x9f03('0x31')]=_0x52a5dd[_0x9f03('0x31')][_0x9f03('0x33')]?_0x52a5dd['attributes']:_0x56063c[_0x9f03('0x30')];if(_0x543935[_0x9f03('0x2c')]['includeAll']){_0x52a5dd[_0x9f03('0x3e')]=[{'all':!![]}];}_0x52a5dd=_[_0x9f03('0x3b')]({},_0x52a5dd,_0x543935[_0x9f03('0x3d')]);return db[_0x9f03('0x26')][_0x9f03('0x43')](_0x52a5dd)[_0x9f03('0x22')](handleEntityNotFound(_0x8e3d63,null))[_0x9f03('0x22')](respondWithResult(_0x8e3d63,null))[_0x9f03('0x40')](handleError(_0x8e3d63,null));};exports[_0x9f03('0x44')]=function(_0x3b6371,_0x27ecb7){return db['AnalyticExtractedReport']['create'](_0x3b6371['body'],{})[_0x9f03('0x22')](function(_0x3b81ec){var _0x52d149=_0x3b6371[_0x9f03('0x45')]['get']({'plain':!![]});if(!_0x52d149)throw new Error(_0x9f03('0x46'));if(_0x52d149[_0x9f03('0x47')]===_0x9f03('0x45')){var _0x5ea14f=_0x3b81ec['get']({'plain':!![]});var _0x541bd1=_0x9f03('0x23');return db[_0x9f03('0x48')][_0x9f03('0x43')]({'where':{'name':_0x541bd1,'userProfileId':_0x52d149[_0x9f03('0x49')]},'raw':!![]})[_0x9f03('0x22')](function(_0x5ad7dd){if(_0x5ad7dd&&_0x5ad7dd[_0x9f03('0x4a')]===0x0){return db[_0x9f03('0x4b')][_0x9f03('0x44')]({'name':_0x5ea14f[_0x9f03('0x24')],'resourceId':_0x5ea14f['id'],'type':_0x5ad7dd[_0x9f03('0x24')],'sectionId':_0x5ad7dd['id']},{})['then'](function(){return _0x3b81ec;});}else{return _0x3b81ec;}})[_0x9f03('0x40')](function(_0x2f8fdd){logger[_0x9f03('0x4c')](_0x9f03('0x4d'),_0x2f8fdd);throw _0x2f8fdd;});}return _0x3b81ec;})[_0x9f03('0x22')](respondWithResult(_0x27ecb7,0xc9))[_0x9f03('0x40')](handleError(_0x27ecb7,null));};exports['update']=function(_0x43283e,_0x5e6fd0){if(_0x43283e[_0x9f03('0x4e')]['id']){delete _0x43283e[_0x9f03('0x4e')]['id'];}return db[_0x9f03('0x26')][_0x9f03('0x43')]({'where':{'id':_0x43283e['params']['id']}})[_0x9f03('0x22')](handleEntityNotFound(_0x5e6fd0,null))['then'](saveUpdates(_0x43283e[_0x9f03('0x4e')],null))[_0x9f03('0x22')](respondWithResult(_0x5e6fd0,null))[_0x9f03('0x40')](handleError(_0x5e6fd0,null));};exports[_0x9f03('0x4f')]=function(_0x50b801,_0x31d0f2){return db[_0x9f03('0x26')][_0x9f03('0x43')]({'where':{'id':_0x50b801[_0x9f03('0x42')]['id']}})[_0x9f03('0x22')](handleEntityNotFound(_0x31d0f2,null))[_0x9f03('0x22')](removeEntity(_0x31d0f2,null))['catch'](handleError(_0x31d0f2,null));};exports[_0x9f03('0x50')]=function(_0x47d783,_0x182f28,_0x4027b0){return db['AnalyticExtractedReport'][_0x9f03('0x43')]({'where':{'id':_0x47d783[_0x9f03('0x42')]['id']},'attributes':[_0x9f03('0x24'),'basename','savename',_0x9f03('0x51')],'raw':!![]})[_0x9f03('0x22')](handleEntityNotFound(_0x182f28,null))['then'](function(_0x518149){if(_0x518149){if(!fs[_0x9f03('0x52')](path[_0x9f03('0x53')](config[_0x9f03('0x54')],'server/files/reports',_0x518149['savename']))){throw new db[(_0x9f03('0x55'))][(_0x9f03('0x56'))](_0x9f03('0x57'));}if(_0x47d783[_0x9f03('0x2c')][_0x9f03('0x58')]){return _0x182f28[_0x9f03('0x15')](0xc8);}return _0x182f28[_0x9f03('0x50')](path[_0x9f03('0x53')](config['root'],_0x9f03('0x59'),_0x518149[_0x9f03('0x5a')]),util[_0x9f03('0x5b')]('%s.%s',_0x518149[_0x9f03('0x5c')]||_0x518149['name'],_0x518149['output'][_0x9f03('0x5d')]()));}})[_0x9f03('0x40')](handleError(_0x182f28,null));};
\ No newline at end of file
+var _0xd227=['where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','download','%s.%s','toLowerCase','rimraf','moment','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3aa0f0,_0x14b9c6){var _0x3dc85d=function(_0x1ce464){while(--_0x1ce464){_0x3aa0f0['push'](_0x3aa0f0['shift']());}};_0x3dc85d(++_0x14b9c6);}(_0xd227,0x13a));var _0x7d22=function(_0x4ed6c7,_0x2e6803){_0x4ed6c7=_0x4ed6c7-0x0;var _0x112d0c=_0xd227[_0x4ed6c7];return _0x112d0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d22('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d22('0x1'));var BPromise=require(_0x7d22('0x2'));var Mustache=require('mustache');var util=require(_0x7d22('0x3'));var path=require(_0x7d22('0x4'));var sox=require(_0x7d22('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d22('0x6'));var squel=require(_0x7d22('0x7'));var crypto=require('crypto');var jsforce=require(_0x7d22('0x8'));var deskjs=require(_0x7d22('0x9'));var toCsv=require(_0x7d22('0xa'));var querystring=require(_0x7d22('0xb'));var Papa=require(_0x7d22('0xc'));var Redis=require('ioredis');var authService=require(_0x7d22('0xd'));var qs=require(_0x7d22('0xe'));var as=require(_0x7d22('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d22('0x10'))('api');var utils=require(_0x7d22('0x11'));var config=require(_0x7d22('0x12'));var licenseUtil=require(_0x7d22('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe99f1,_0x5b9388){_0x5b9388=_0x5b9388||0xcc;return function(_0xde93c0){if(_0xde93c0){return _0xfe99f1['sendStatus'](_0x5b9388);}return _0xfe99f1[_0x7d22('0x14')](_0x5b9388)[_0x7d22('0x15')]();};}function respondWithResult(_0x86d699,_0x2350d1){_0x2350d1=_0x2350d1||0xc8;return function(_0x47a7b5){if(_0x47a7b5){return _0x86d699[_0x7d22('0x14')](_0x2350d1)['json'](_0x47a7b5);}};}function respondWithFilteredResult(_0xe632d,_0x16637d){return function(_0x12bcbc){if(_0x12bcbc){var _0x499aea=typeof _0x16637d['offset']===_0x7d22('0x16')&&typeof _0x16637d[_0x7d22('0x17')]==='undefined';var _0x367709=_0x12bcbc[_0x7d22('0x18')];var _0x3f977a=_0x499aea?0x0:_0x16637d['offset'];var _0x5ec42b=_0x499aea?_0x12bcbc[_0x7d22('0x18')]:_0x16637d[_0x7d22('0x19')]+_0x16637d[_0x7d22('0x17')];var _0xdfdade;if(_0x5ec42b>=_0x367709){_0x5ec42b=_0x367709;_0xdfdade=0xc8;}else{_0xdfdade=0xce;}_0xe632d[_0x7d22('0x14')](_0xdfdade);return _0xe632d[_0x7d22('0x1a')](_0x7d22('0x1b'),_0x3f977a+'-'+_0x5ec42b+'/'+_0x367709)['json'](_0x12bcbc);}return null;};}function patchUpdates(_0x30c6c9){return function(_0x1c8027){try{jsonpatch['apply'](_0x1c8027,_0x30c6c9,!![]);}catch(_0x106a9a){return BPromise[_0x7d22('0x1c')](_0x106a9a);}return _0x1c8027[_0x7d22('0x1d')]();};}function saveUpdates(_0x2dbf55,_0xe0364e){return function(_0x4a4a55){if(_0x4a4a55){return _0x4a4a55[_0x7d22('0x1e')](_0x2dbf55)[_0x7d22('0x1f')](function(_0x4a4b5f){return _0x4a4b5f;});}return null;};}function removeEntity(_0x24b5d7,_0x540841){return function(_0x7040c7){if(_0x7040c7){return _0x7040c7[_0x7d22('0x20')]()[_0x7d22('0x1f')](function(){var _0x298b65=_0x7040c7['get']({'plain':!![]});var _0x25d724=_0x7d22('0x21');return db[_0x7d22('0x22')]['destroy']({'where':{'type':_0x25d724,'resourceId':_0x298b65['id']}})['then'](function(){return _0x7040c7;});})[_0x7d22('0x1f')](function(){_0x24b5d7[_0x7d22('0x14')](0xcc)[_0x7d22('0x15')]();});}};}function handleEntityNotFound(_0x501c12,_0x380963){return function(_0x1924cc){if(!_0x1924cc){_0x501c12['sendStatus'](0x194);}return _0x1924cc;};}function handleError(_0x1bfff5,_0x4ced06){_0x4ced06=_0x4ced06||0x1f4;return function(_0x5827fc){logger[_0x7d22('0x23')](_0x5827fc[_0x7d22('0x24')]);if(_0x5827fc[_0x7d22('0x25')]){delete _0x5827fc[_0x7d22('0x25')];}_0x1bfff5[_0x7d22('0x14')](_0x4ced06)[_0x7d22('0x26')](_0x5827fc);};}exports[_0x7d22('0x27')]=function(_0x43fa8d,_0x512746){var _0x293b3c={},_0x1c5ef3={},_0x528e4b={'count':0x0,'rows':[]};var _0x5be8b8=_[_0x7d22('0x28')](db[_0x7d22('0x29')][_0x7d22('0x2a')],function(_0x5a78e2){return{'name':_0x5a78e2[_0x7d22('0x2b')],'type':_0x5a78e2[_0x7d22('0x2c')][_0x7d22('0x2d')]};});_0x1c5ef3[_0x7d22('0x2e')]=_[_0x7d22('0x28')](_0x5be8b8,'name');_0x1c5ef3[_0x7d22('0x2f')]=_[_0x7d22('0x30')](_0x43fa8d[_0x7d22('0x2f')]);_0x1c5ef3[_0x7d22('0x31')]=_[_0x7d22('0x32')](_0x1c5ef3['model'],_0x1c5ef3['query']);_0x293b3c['attributes']=_[_0x7d22('0x32')](_0x1c5ef3['model'],qs[_0x7d22('0x33')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x33')]));_0x293b3c[_0x7d22('0x34')]=_0x293b3c[_0x7d22('0x34')][_0x7d22('0x35')]?_0x293b3c[_0x7d22('0x34')]:_0x1c5ef3[_0x7d22('0x2e')];if(!_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x36')](_0x7d22('0x37'))){_0x293b3c[_0x7d22('0x17')]=qs[_0x7d22('0x17')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x17')]);_0x293b3c['offset']=qs['offset'](_0x43fa8d['query'][_0x7d22('0x19')]);}_0x293b3c[_0x7d22('0x38')]=qs[_0x7d22('0x39')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x39')]);_0x293b3c[_0x7d22('0x3a')]=qs[_0x7d22('0x31')](_['pick'](_0x43fa8d[_0x7d22('0x2f')],_0x1c5ef3[_0x7d22('0x31')]),_0x5be8b8);if(_0x43fa8d['query'][_0x7d22('0x3b')]){_0x293b3c[_0x7d22('0x3a')]=_[_0x7d22('0x3c')](_0x293b3c[_0x7d22('0x3a')],{'$or':_['map'](_0x5be8b8,function(_0x163c48){if(_0x163c48['type']!==_0x7d22('0x3d')){var _0x49abac={};_0x49abac[_0x163c48[_0x7d22('0x25')]]={'$like':'%'+_0x43fa8d['query'][_0x7d22('0x3b')]+'%'};return _0x49abac;}})});}_0x293b3c=_[_0x7d22('0x3c')]({},_0x293b3c,_0x43fa8d['options']);var _0x19379b={'where':_0x293b3c[_0x7d22('0x3a')]};return db[_0x7d22('0x29')][_0x7d22('0x18')](_0x19379b)[_0x7d22('0x1f')](function(_0x101560){_0x528e4b[_0x7d22('0x18')]=_0x101560;if(_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x3e')]){_0x293b3c[_0x7d22('0x3f')]=[{'all':!![]}];}return db[_0x7d22('0x29')][_0x7d22('0x40')](_0x293b3c);})[_0x7d22('0x1f')](function(_0xde943e){_0x528e4b[_0x7d22('0x41')]=_0xde943e;return _0x528e4b;})['then'](respondWithFilteredResult(_0x512746,_0x293b3c))[_0x7d22('0x42')](handleError(_0x512746,null));};exports[_0x7d22('0x43')]=function(_0x1838b6,_0x49694c){var _0x4f13e7={'raw':!![],'where':{'id':_0x1838b6[_0x7d22('0x44')]['id']}},_0x41ab39={};_0x41ab39[_0x7d22('0x2e')]=_['keys'](db['AnalyticExtractedReport'][_0x7d22('0x2a')]);_0x41ab39['query']=_[_0x7d22('0x30')](_0x1838b6[_0x7d22('0x2f')]);_0x41ab39[_0x7d22('0x31')]=_[_0x7d22('0x32')](_0x41ab39[_0x7d22('0x2e')],_0x41ab39['query']);_0x4f13e7['attributes']=_[_0x7d22('0x32')](_0x41ab39['model'],qs[_0x7d22('0x33')](_0x1838b6['query'][_0x7d22('0x33')]));_0x4f13e7[_0x7d22('0x34')]=_0x4f13e7[_0x7d22('0x34')][_0x7d22('0x35')]?_0x4f13e7[_0x7d22('0x34')]:_0x41ab39[_0x7d22('0x2e')];if(_0x1838b6[_0x7d22('0x2f')][_0x7d22('0x3e')]){_0x4f13e7[_0x7d22('0x3f')]=[{'all':!![]}];}_0x4f13e7=_['merge']({},_0x4f13e7,_0x1838b6[_0x7d22('0x45')]);return db[_0x7d22('0x29')][_0x7d22('0x46')](_0x4f13e7)['then'](handleEntityNotFound(_0x49694c,null))[_0x7d22('0x1f')](respondWithResult(_0x49694c,null))[_0x7d22('0x42')](handleError(_0x49694c,null));};exports['create']=function(_0x1615f2,_0x48881e){return db['AnalyticExtractedReport'][_0x7d22('0x47')](_0x1615f2[_0x7d22('0x48')],{})[_0x7d22('0x1f')](function(_0xb3ce2){var _0x410c8b=_0x1615f2[_0x7d22('0x49')]['get']({'plain':!![]});if(!_0x410c8b)throw new Error(_0x7d22('0x4a'));if(_0x410c8b[_0x7d22('0x4b')]===_0x7d22('0x49')){var _0x290ade=_0xb3ce2[_0x7d22('0x4c')]({'plain':!![]});var _0xbacc67=_0x7d22('0x21');return db[_0x7d22('0x4d')][_0x7d22('0x46')]({'where':{'name':_0xbacc67,'userProfileId':_0x410c8b['userProfileId']},'raw':!![]})[_0x7d22('0x1f')](function(_0x4efc90){if(_0x4efc90&&_0x4efc90['autoAssociation']===0x0){return db[_0x7d22('0x22')][_0x7d22('0x47')]({'name':_0x290ade[_0x7d22('0x25')],'resourceId':_0x290ade['id'],'type':_0x4efc90['name'],'sectionId':_0x4efc90['id']},{})['then'](function(){return _0xb3ce2;});}else{return _0xb3ce2;}})[_0x7d22('0x42')](function(_0x347540){logger[_0x7d22('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x347540);throw _0x347540;});}return _0xb3ce2;})[_0x7d22('0x1f')](respondWithResult(_0x48881e,0xc9))['catch'](handleError(_0x48881e,null));};exports[_0x7d22('0x1e')]=function(_0x4736ef,_0x3824a1){if(_0x4736ef['body']['id']){delete _0x4736ef[_0x7d22('0x48')]['id'];}return db[_0x7d22('0x29')][_0x7d22('0x46')]({'where':{'id':_0x4736ef['params']['id']}})['then'](handleEntityNotFound(_0x3824a1,null))[_0x7d22('0x1f')](saveUpdates(_0x4736ef['body'],null))[_0x7d22('0x1f')](respondWithResult(_0x3824a1,null))[_0x7d22('0x42')](handleError(_0x3824a1,null));};exports[_0x7d22('0x20')]=function(_0x1c982d,_0x176ce5){return db[_0x7d22('0x29')][_0x7d22('0x46')]({'where':{'id':_0x1c982d['params']['id']}})[_0x7d22('0x1f')](handleEntityNotFound(_0x176ce5,null))[_0x7d22('0x1f')](removeEntity(_0x176ce5,null))[_0x7d22('0x42')](handleError(_0x176ce5,null));};exports['download']=function(_0x4acfcd,_0x16c9f2,_0x5b5295){return db[_0x7d22('0x29')]['find']({'where':{'id':_0x4acfcd[_0x7d22('0x44')]['id']},'attributes':[_0x7d22('0x25'),_0x7d22('0x4e'),_0x7d22('0x4f'),_0x7d22('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x16c9f2,null))[_0x7d22('0x1f')](function(_0xdd9a74){if(_0xdd9a74){if(!fs[_0x7d22('0x51')](path[_0x7d22('0x52')](config[_0x7d22('0x53')],_0x7d22('0x54'),_0xdd9a74[_0x7d22('0x4f')]))){throw new db[(_0x7d22('0x55'))][(_0x7d22('0x56'))](_0x7d22('0x57'));}if(_0x4acfcd[_0x7d22('0x2f')][_0x7d22('0x58')]){return _0x16c9f2[_0x7d22('0x59')](0xc8);}return _0x16c9f2[_0x7d22('0x5a')](path[_0x7d22('0x52')](config['root'],_0x7d22('0x54'),_0xdd9a74[_0x7d22('0x4f')]),util['format'](_0x7d22('0x5b'),_0xdd9a74[_0x7d22('0x4e')]||_0xdd9a74[_0x7d22('0x25')],_0xdd9a74['output'][_0x7d22('0x5c')]()));}})['catch'](handleError(_0x16c9f2,null));};
\ No newline at end of file