Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 3c60d21..eb07812 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x90ed=['length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','body','savename','output','existsSync','root','Sequelize','ValidationError','exists','download','server/files/reports','format','%s.%s','basename','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','update','then','destroy','get','ExtractedReports','UserProfileResource','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0xe66090,_0x3a1cf0){var _0x510588=function(_0x56b419){while(--_0x56b419){_0xe66090['push'](_0xe66090['shift']());}};_0x510588(++_0x3a1cf0);}(_0x90ed,0xe1));var _0xd90e=function(_0x1a8627,_0x4d7f99){_0x1a8627=_0x1a8627-0x0;var _0xbab7bd=_0x90ed[_0x1a8627];return _0xbab7bd;};'use strict';var pdf=require(_0xd90e('0x0'));var emlformat=require(_0xd90e('0x1'));var rimraf=require(_0xd90e('0x2'));var zipdir=require(_0xd90e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd90e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd90e('0x5'));var path=require('path');var sox=require(_0xd90e('0x6'));var csv=require('to-csv');var ejs=require(_0xd90e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd90e('0x8'));var crypto=require(_0xd90e('0x9'));var jsforce=require(_0xd90e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd90e('0xb'));var querystring=require(_0xd90e('0xc'));var Papa=require(_0xd90e('0xd'));var Redis=require(_0xd90e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd90e('0xf'));var as=require(_0xd90e('0x10'));var hardwareService=require(_0xd90e('0x11'));var logger=require('../../config/logger')(_0xd90e('0x12'));var utils=require(_0xd90e('0x13'));var config=require(_0xd90e('0x14'));var licenseUtil=require(_0xd90e('0x15'));var db=require(_0xd90e('0x16'))['db'];function respondWithStatusCode(_0x46b730,_0x16d964){_0x16d964=_0x16d964||0xcc;return function(_0x21fa62){if(_0x21fa62){return _0x46b730[_0xd90e('0x17')](_0x16d964);}return _0x46b730[_0xd90e('0x18')](_0x16d964)['end']();};}function respondWithResult(_0x3e9d90,_0xef67d5){_0xef67d5=_0xef67d5||0xc8;return function(_0x48dac4){if(_0x48dac4){return _0x3e9d90[_0xd90e('0x18')](_0xef67d5)['json'](_0x48dac4);}};}function respondWithFilteredResult(_0x4c9feb,_0x9074ea){return function(_0x2fd649){if(_0x2fd649){var _0x51d120=_0x2fd649[_0xd90e('0x19')],_0x47432d=_0x9074ea[_0xd90e('0x1a')],_0x2bcdc5=_0x9074ea['offset']+_0x9074ea['limit'],_0x535bff;if(_0x2bcdc5>=_0x51d120){_0x2bcdc5=_0x51d120;_0x535bff=0xc8;}else{_0x535bff=0xce;}_0x4c9feb[_0xd90e('0x18')](_0x535bff);return _0x4c9feb[_0xd90e('0x1b')](_0xd90e('0x1c'),_0x47432d+'-'+_0x2bcdc5+'/'+_0x51d120)[_0xd90e('0x1d')](_0x2fd649);}return null;};}function patchUpdates(_0x3f3b02){return function(_0x4e2f5f){try{jsonpatch[_0xd90e('0x1e')](_0x4e2f5f,_0x3f3b02,!![]);}catch(_0x2f0114){return BPromise['reject'](_0x2f0114);}return _0x4e2f5f['save']();};}function saveUpdates(_0xd9c952,_0x2b83b6){return function(_0x4d060b){if(_0x4d060b){return _0x4d060b[_0xd90e('0x1f')](_0xd9c952)[_0xd90e('0x20')](function(_0x181019){return _0x181019;});}return null;};}function removeEntity(_0x46c84e,_0x1fbef2){return function(_0x7c9841){if(_0x7c9841){return _0x7c9841[_0xd90e('0x21')]()[_0xd90e('0x20')](function(){var _0x3c2f3b=_0x7c9841[_0xd90e('0x22')]({'plain':!![]});var _0x5cdd5d=_0xd90e('0x23');return db[_0xd90e('0x24')][_0xd90e('0x21')]({'where':{'type':_0x5cdd5d,'resourceId':_0x3c2f3b['id']}})[_0xd90e('0x20')](function(){return _0x7c9841;});})[_0xd90e('0x20')](function(){_0x46c84e[_0xd90e('0x18')](0xcc)[_0xd90e('0x25')]();});}};}function handleEntityNotFound(_0x1082d7,_0x17cd75){return function(_0xab4dc9){if(!_0xab4dc9){_0x1082d7['sendStatus'](0x194);}return _0xab4dc9;};}function handleError(_0x2b5f38,_0x1a3556){_0x1a3556=_0x1a3556||0x1f4;return function(_0x40e876){logger[_0xd90e('0x26')](_0x40e876[_0xd90e('0x27')]);if(_0x40e876[_0xd90e('0x28')]){delete _0x40e876[_0xd90e('0x28')];}_0x2b5f38[_0xd90e('0x18')](_0x1a3556)[_0xd90e('0x29')](_0x40e876);};}exports[_0xd90e('0x2a')]=function(_0x229c16,_0x2fe39d){var _0x977910={},_0x3d7689={},_0x59591c={'count':0x0,'rows':[]};var _0x533ea0=_[_0xd90e('0x2b')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x1d7b20){return{'name':_0x1d7b20[_0xd90e('0x2c')],'type':_0x1d7b20[_0xd90e('0x2d')][_0xd90e('0x2e')]};});_0x3d7689[_0xd90e('0x2f')]=_[_0xd90e('0x2b')](_0x533ea0,'name');_0x3d7689[_0xd90e('0x30')]=_[_0xd90e('0x31')](_0x229c16['query']);_0x3d7689[_0xd90e('0x32')]=_['intersection'](_0x3d7689[_0xd90e('0x2f')],_0x3d7689['query']);_0x977910[_0xd90e('0x33')]=_[_0xd90e('0x34')](_0x3d7689[_0xd90e('0x2f')],qs[_0xd90e('0x35')](_0x229c16[_0xd90e('0x30')]['fields']));_0x977910['attributes']=_0x977910[_0xd90e('0x33')][_0xd90e('0x36')]?_0x977910[_0xd90e('0x33')]:_0x3d7689[_0xd90e('0x2f')];if(!_0x229c16[_0xd90e('0x30')][_0xd90e('0x37')](_0xd90e('0x38'))){_0x977910['limit']=qs[_0xd90e('0x39')](_0x229c16[_0xd90e('0x30')][_0xd90e('0x39')]);_0x977910['offset']=qs['offset'](_0x229c16[_0xd90e('0x30')]['offset']);}_0x977910['order']=qs[_0xd90e('0x3a')](_0x229c16[_0xd90e('0x30')][_0xd90e('0x3a')]);_0x977910[_0xd90e('0x3b')]=qs['filters'](_['pick'](_0x229c16['query'],_0x3d7689[_0xd90e('0x32')]),_0x533ea0);if(_0x229c16[_0xd90e('0x30')][_0xd90e('0x3c')]){_0x977910[_0xd90e('0x3b')]=_[_0xd90e('0x3d')](_0x977910['where'],{'$or':_[_0xd90e('0x2b')](_0x533ea0,function(_0x539bc5){if(_0x539bc5[_0xd90e('0x2d')]!==_0xd90e('0x3e')){var _0x17edcb={};_0x17edcb[_0x539bc5['name']]={'$like':'%'+_0x229c16[_0xd90e('0x30')][_0xd90e('0x3c')]+'%'};return _0x17edcb;}})});}_0x977910=_['merge']({},_0x977910,_0x229c16[_0xd90e('0x3f')]);var _0x492e71={'where':_0x977910[_0xd90e('0x3b')]};return db[_0xd90e('0x40')][_0xd90e('0x19')](_0x492e71)[_0xd90e('0x20')](function(_0x5e1610){_0x59591c[_0xd90e('0x19')]=_0x5e1610;if(_0x229c16[_0xd90e('0x30')][_0xd90e('0x41')]){_0x977910[_0xd90e('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xd90e('0x43')](_0x977910);})[_0xd90e('0x20')](function(_0x204352){_0x59591c[_0xd90e('0x44')]=_0x204352;return _0x59591c;})[_0xd90e('0x20')](respondWithFilteredResult(_0x2fe39d,_0x977910))[_0xd90e('0x45')](handleError(_0x2fe39d,null));};exports[_0xd90e('0x46')]=function(_0x422765,_0x58c055){var _0x44e787={'raw':!![],'where':{'id':_0x422765[_0xd90e('0x47')]['id']}},_0xf324f5={};_0xf324f5[_0xd90e('0x2f')]=_[_0xd90e('0x31')](db[_0xd90e('0x40')][_0xd90e('0x48')]);_0xf324f5[_0xd90e('0x30')]=_[_0xd90e('0x31')](_0x422765[_0xd90e('0x30')]);_0xf324f5['filters']=_['intersection'](_0xf324f5['model'],_0xf324f5[_0xd90e('0x30')]);_0x44e787['attributes']=_[_0xd90e('0x34')](_0xf324f5[_0xd90e('0x2f')],qs[_0xd90e('0x35')](_0x422765[_0xd90e('0x30')][_0xd90e('0x35')]));_0x44e787['attributes']=_0x44e787[_0xd90e('0x33')][_0xd90e('0x36')]?_0x44e787[_0xd90e('0x33')]:_0xf324f5['model'];if(_0x422765[_0xd90e('0x30')]['includeAll']){_0x44e787[_0xd90e('0x42')]=[{'all':!![]}];}_0x44e787=_[_0xd90e('0x3d')]({},_0x44e787,_0x422765['options']);return db[_0xd90e('0x40')][_0xd90e('0x49')](_0x44e787)[_0xd90e('0x20')](handleEntityNotFound(_0x58c055,null))[_0xd90e('0x20')](respondWithResult(_0x58c055,null))['catch'](handleError(_0x58c055,null));};exports[_0xd90e('0x4a')]=function(_0x1a5fba,_0x271f75){return db['AnalyticExtractedReport'][_0xd90e('0x4a')](_0x1a5fba['body'],{})[_0xd90e('0x20')](function(_0x64f3c2){var _0x1745a6=_0x1a5fba['user']['get']({'plain':!![]});if(!_0x1745a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1745a6[_0xd90e('0x4b')]===_0xd90e('0x4c')){var _0x2fd1e3=_0x64f3c2['get']({'plain':!![]});var _0x29fd8e=_0xd90e('0x23');return db[_0xd90e('0x4d')][_0xd90e('0x49')]({'where':{'name':_0x29fd8e,'userProfileId':_0x1745a6[_0xd90e('0x4e')]},'raw':!![]})[_0xd90e('0x20')](function(_0x4fae78){if(_0x4fae78&&_0x4fae78[_0xd90e('0x4f')]===0x0){return db[_0xd90e('0x24')]['create']({'name':_0x2fd1e3[_0xd90e('0x28')],'resourceId':_0x2fd1e3['id'],'type':_0x4fae78[_0xd90e('0x28')],'sectionId':_0x4fae78['id']},{})[_0xd90e('0x20')](function(){return _0x64f3c2;});}else{return _0x64f3c2;}})[_0xd90e('0x45')](function(_0x5b1ec7){logger[_0xd90e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b1ec7);throw _0x5b1ec7;});}return _0x64f3c2;})[_0xd90e('0x20')](respondWithResult(_0x271f75,0xc9))['catch'](handleError(_0x271f75,null));};exports[_0xd90e('0x1f')]=function(_0x44dcdc,_0x351b5d){if(_0x44dcdc[_0xd90e('0x50')]['id']){delete _0x44dcdc[_0xd90e('0x50')]['id'];}return db[_0xd90e('0x40')][_0xd90e('0x49')]({'where':{'id':_0x44dcdc['params']['id']}})[_0xd90e('0x20')](handleEntityNotFound(_0x351b5d,null))[_0xd90e('0x20')](saveUpdates(_0x44dcdc[_0xd90e('0x50')],null))[_0xd90e('0x20')](respondWithResult(_0x351b5d,null))[_0xd90e('0x45')](handleError(_0x351b5d,null));};exports[_0xd90e('0x21')]=function(_0x37f74b,_0x2fc7dc){return db['AnalyticExtractedReport'][_0xd90e('0x49')]({'where':{'id':_0x37f74b[_0xd90e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fc7dc,null))[_0xd90e('0x20')](removeEntity(_0x2fc7dc,null))[_0xd90e('0x45')](handleError(_0x2fc7dc,null));};exports['download']=function(_0x3e0dad,_0x5c1d7e,_0x2c5374){return db[_0xd90e('0x40')]['find']({'where':{'id':_0x3e0dad['params']['id']},'attributes':[_0xd90e('0x28'),'basename',_0xd90e('0x51'),_0xd90e('0x52')],'raw':!![]})[_0xd90e('0x20')](handleEntityNotFound(_0x5c1d7e,null))[_0xd90e('0x20')](function(_0xbddd7d){if(_0xbddd7d){if(!fs[_0xd90e('0x53')](path['join'](config[_0xd90e('0x54')],'server/files/reports',_0xbddd7d[_0xd90e('0x51')]))){throw new db[(_0xd90e('0x55'))][(_0xd90e('0x56'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x3e0dad[_0xd90e('0x30')][_0xd90e('0x57')]){return _0x5c1d7e['sendStatus'](0xc8);}return _0x5c1d7e[_0xd90e('0x58')](path['join'](config[_0xd90e('0x54')],_0xd90e('0x59'),_0xbddd7d[_0xd90e('0x51')]),util[_0xd90e('0x5a')](_0xd90e('0x5b'),_0xbddd7d[_0xd90e('0x5c')]||_0xbddd7d[_0xd90e('0x28')],_0xbddd7d['output']['toLowerCase']()));}})[_0xd90e('0x45')](handleError(_0x5c1d7e,null));};
\ No newline at end of file
+var _0xc0a6=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','findAll','rows','catch','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','existsSync','join','server/files/reports','Sequelize','ValidationError','exists','root','format','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','ExtractedReports','UserProfileResource','stack','name','rawAttributes','fieldName','type','model','map','keys'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0xc0a6,0xfc));var _0x6c0a=function(_0x536609,_0x58d4bb){_0x536609=_0x536609-0x0;var _0x3d34fd=_0xc0a6[_0x536609];return _0x3d34fd;};'use strict';var emlformat=require(_0x6c0a('0x0'));var rimraf=require(_0x6c0a('0x1'));var zipdir=require(_0x6c0a('0x2'));var jsonpatch=require(_0x6c0a('0x3'));var rp=require(_0x6c0a('0x4'));var moment=require('moment');var BPromise=require(_0x6c0a('0x5'));var Mustache=require(_0x6c0a('0x6'));var util=require(_0x6c0a('0x7'));var path=require(_0x6c0a('0x8'));var sox=require(_0x6c0a('0x9'));var csv=require(_0x6c0a('0xa'));var ejs=require(_0x6c0a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c0a('0xc'));var squel=require(_0x6c0a('0xd'));var crypto=require(_0x6c0a('0xe'));var jsforce=require(_0x6c0a('0xf'));var deskjs=require(_0x6c0a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6c0a('0x11'));var Papa=require(_0x6c0a('0x12'));var Redis=require(_0x6c0a('0x13'));var authService=require(_0x6c0a('0x14'));var qs=require(_0x6c0a('0x15'));var as=require(_0x6c0a('0x16'));var hardwareService=require(_0x6c0a('0x17'));var logger=require(_0x6c0a('0x18'))(_0x6c0a('0x19'));var utils=require(_0x6c0a('0x1a'));var config=require(_0x6c0a('0x1b'));var licenseUtil=require(_0x6c0a('0x1c'));var db=require(_0x6c0a('0x1d'))['db'];function respondWithStatusCode(_0x23190e,_0x2372d9){_0x2372d9=_0x2372d9||0xcc;return function(_0x59cbf8){if(_0x59cbf8){return _0x23190e[_0x6c0a('0x1e')](_0x2372d9);}return _0x23190e[_0x6c0a('0x1f')](_0x2372d9)[_0x6c0a('0x20')]();};}function respondWithResult(_0x80cf07,_0x28f32d){_0x28f32d=_0x28f32d||0xc8;return function(_0x14b0bf){if(_0x14b0bf){return _0x80cf07[_0x6c0a('0x1f')](_0x28f32d)[_0x6c0a('0x21')](_0x14b0bf);}};}function respondWithFilteredResult(_0x560644,_0xdd320b){return function(_0x41b1c9){if(_0x41b1c9){var _0x56cb04=typeof _0xdd320b[_0x6c0a('0x22')]===_0x6c0a('0x23')&&typeof _0xdd320b[_0x6c0a('0x24')]===_0x6c0a('0x23');var _0x13cd36=_0x41b1c9[_0x6c0a('0x25')];var _0x7db190=_0x56cb04?0x0:_0xdd320b['offset'];var _0x490250=_0x56cb04?_0x41b1c9['count']:_0xdd320b['offset']+_0xdd320b['limit'];var _0x236c2b;if(_0x490250>=_0x13cd36){_0x490250=_0x13cd36;_0x236c2b=0xc8;}else{_0x236c2b=0xce;}_0x560644[_0x6c0a('0x1f')](_0x236c2b);return _0x560644[_0x6c0a('0x26')]('Content-Range',_0x7db190+'-'+_0x490250+'/'+_0x13cd36)['json'](_0x41b1c9);}return null;};}function patchUpdates(_0x5ec192){return function(_0x46e638){try{jsonpatch[_0x6c0a('0x27')](_0x46e638,_0x5ec192,!![]);}catch(_0xa09edb){return BPromise['reject'](_0xa09edb);}return _0x46e638[_0x6c0a('0x28')]();};}function saveUpdates(_0x1c7223,_0x4dd863){return function(_0x5d8154){if(_0x5d8154){return _0x5d8154[_0x6c0a('0x29')](_0x1c7223)[_0x6c0a('0x2a')](function(_0xc62b0b){return _0xc62b0b;});}return null;};}function removeEntity(_0x582511,_0x4ebe7e){return function(_0x41906b){if(_0x41906b){return _0x41906b[_0x6c0a('0x2b')]()[_0x6c0a('0x2a')](function(){var _0x88d2a2=_0x41906b['get']({'plain':!![]});var _0x4f94c0=_0x6c0a('0x2c');return db[_0x6c0a('0x2d')]['destroy']({'where':{'type':_0x4f94c0,'resourceId':_0x88d2a2['id']}})[_0x6c0a('0x2a')](function(){return _0x41906b;});})[_0x6c0a('0x2a')](function(){_0x582511[_0x6c0a('0x1f')](0xcc)[_0x6c0a('0x20')]();});}};}function handleEntityNotFound(_0x4df98e,_0x199342){return function(_0x4b1731){if(!_0x4b1731){_0x4df98e[_0x6c0a('0x1e')](0x194);}return _0x4b1731;};}function handleError(_0x4f079a,_0x30fc49){_0x30fc49=_0x30fc49||0x1f4;return function(_0x2c92ca){logger['error'](_0x2c92ca[_0x6c0a('0x2e')]);if(_0x2c92ca[_0x6c0a('0x2f')]){delete _0x2c92ca[_0x6c0a('0x2f')];}_0x4f079a['status'](_0x30fc49)['send'](_0x2c92ca);};}exports['index']=function(_0x566bfb,_0x4f3d76){var _0x7da94b={},_0x1e7a99={},_0xaabe4e={'count':0x0,'rows':[]};var _0x1e9422=_['map'](db['AnalyticExtractedReport'][_0x6c0a('0x30')],function(_0x415a24){return{'name':_0x415a24[_0x6c0a('0x31')],'type':_0x415a24[_0x6c0a('0x32')]['key']};});_0x1e7a99[_0x6c0a('0x33')]=_[_0x6c0a('0x34')](_0x1e9422,_0x6c0a('0x2f'));_0x1e7a99['query']=_[_0x6c0a('0x35')](_0x566bfb[_0x6c0a('0x36')]);_0x1e7a99[_0x6c0a('0x37')]=_['intersection'](_0x1e7a99['model'],_0x1e7a99[_0x6c0a('0x36')]);_0x7da94b['attributes']=_[_0x6c0a('0x38')](_0x1e7a99[_0x6c0a('0x33')],qs[_0x6c0a('0x39')](_0x566bfb[_0x6c0a('0x36')]['fields']));_0x7da94b[_0x6c0a('0x3a')]=_0x7da94b['attributes'][_0x6c0a('0x3b')]?_0x7da94b['attributes']:_0x1e7a99[_0x6c0a('0x33')];if(!_0x566bfb[_0x6c0a('0x36')][_0x6c0a('0x3c')](_0x6c0a('0x3d'))){_0x7da94b[_0x6c0a('0x24')]=qs[_0x6c0a('0x24')](_0x566bfb[_0x6c0a('0x36')][_0x6c0a('0x24')]);_0x7da94b[_0x6c0a('0x22')]=qs['offset'](_0x566bfb[_0x6c0a('0x36')][_0x6c0a('0x22')]);}_0x7da94b[_0x6c0a('0x3e')]=qs[_0x6c0a('0x3f')](_0x566bfb[_0x6c0a('0x36')]['sort']);_0x7da94b[_0x6c0a('0x40')]=qs[_0x6c0a('0x37')](_[_0x6c0a('0x41')](_0x566bfb[_0x6c0a('0x36')],_0x1e7a99[_0x6c0a('0x37')]),_0x1e9422);if(_0x566bfb[_0x6c0a('0x36')][_0x6c0a('0x42')]){_0x7da94b[_0x6c0a('0x40')]=_[_0x6c0a('0x43')](_0x7da94b[_0x6c0a('0x40')],{'$or':_['map'](_0x1e9422,function(_0x8d345f){if(_0x8d345f[_0x6c0a('0x32')]!==_0x6c0a('0x44')){var _0x303c98={};_0x303c98[_0x8d345f[_0x6c0a('0x2f')]]={'$like':'%'+_0x566bfb['query'][_0x6c0a('0x42')]+'%'};return _0x303c98;}})});}_0x7da94b=_[_0x6c0a('0x43')]({},_0x7da94b,_0x566bfb[_0x6c0a('0x45')]);var _0x4920b8={'where':_0x7da94b[_0x6c0a('0x40')]};return db[_0x6c0a('0x46')][_0x6c0a('0x25')](_0x4920b8)['then'](function(_0x7854ad){_0xaabe4e['count']=_0x7854ad;if(_0x566bfb[_0x6c0a('0x36')]['includeAll']){_0x7da94b['include']=[{'all':!![]}];}return db[_0x6c0a('0x46')][_0x6c0a('0x47')](_0x7da94b);})[_0x6c0a('0x2a')](function(_0x30f62a){_0xaabe4e[_0x6c0a('0x48')]=_0x30f62a;return _0xaabe4e;})[_0x6c0a('0x2a')](respondWithFilteredResult(_0x4f3d76,_0x7da94b))[_0x6c0a('0x49')](handleError(_0x4f3d76,null));};exports['show']=function(_0x5efc79,_0x54db74){var _0x1d5c93={'raw':!![],'where':{'id':_0x5efc79['params']['id']}},_0x1540d8={};_0x1540d8['model']=_[_0x6c0a('0x35')](db[_0x6c0a('0x46')][_0x6c0a('0x30')]);_0x1540d8[_0x6c0a('0x36')]=_[_0x6c0a('0x35')](_0x5efc79[_0x6c0a('0x36')]);_0x1540d8['filters']=_['intersection'](_0x1540d8['model'],_0x1540d8[_0x6c0a('0x36')]);_0x1d5c93['attributes']=_[_0x6c0a('0x38')](_0x1540d8[_0x6c0a('0x33')],qs[_0x6c0a('0x39')](_0x5efc79[_0x6c0a('0x36')]['fields']));_0x1d5c93[_0x6c0a('0x3a')]=_0x1d5c93['attributes'][_0x6c0a('0x3b')]?_0x1d5c93[_0x6c0a('0x3a')]:_0x1540d8[_0x6c0a('0x33')];if(_0x5efc79['query'][_0x6c0a('0x4a')]){_0x1d5c93[_0x6c0a('0x4b')]=[{'all':!![]}];}_0x1d5c93=_['merge']({},_0x1d5c93,_0x5efc79['options']);return db[_0x6c0a('0x46')][_0x6c0a('0x4c')](_0x1d5c93)['then'](handleEntityNotFound(_0x54db74,null))[_0x6c0a('0x2a')](respondWithResult(_0x54db74,null))[_0x6c0a('0x49')](handleError(_0x54db74,null));};exports[_0x6c0a('0x4d')]=function(_0x20a1b3,_0x4e1710){return db[_0x6c0a('0x46')][_0x6c0a('0x4d')](_0x20a1b3[_0x6c0a('0x4e')],{})['then'](function(_0x1b51bf){var _0x156f84=_0x20a1b3[_0x6c0a('0x4f')][_0x6c0a('0x50')]({'plain':!![]});if(!_0x156f84)throw new Error(_0x6c0a('0x51'));if(_0x156f84[_0x6c0a('0x52')]===_0x6c0a('0x4f')){var _0x3afc2c=_0x1b51bf[_0x6c0a('0x50')]({'plain':!![]});var _0x3e70da=_0x6c0a('0x2c');return db[_0x6c0a('0x53')][_0x6c0a('0x4c')]({'where':{'name':_0x3e70da,'userProfileId':_0x156f84[_0x6c0a('0x54')]},'raw':!![]})['then'](function(_0x5cfc3f){if(_0x5cfc3f&&_0x5cfc3f[_0x6c0a('0x55')]===0x0){return db[_0x6c0a('0x2d')]['create']({'name':_0x3afc2c[_0x6c0a('0x2f')],'resourceId':_0x3afc2c['id'],'type':_0x5cfc3f[_0x6c0a('0x2f')],'sectionId':_0x5cfc3f['id']},{})[_0x6c0a('0x2a')](function(){return _0x1b51bf;});}else{return _0x1b51bf;}})[_0x6c0a('0x49')](function(_0x59bd4c){logger[_0x6c0a('0x56')](_0x6c0a('0x57'),_0x59bd4c);throw _0x59bd4c;});}return _0x1b51bf;})[_0x6c0a('0x2a')](respondWithResult(_0x4e1710,0xc9))['catch'](handleError(_0x4e1710,null));};exports[_0x6c0a('0x29')]=function(_0x423333,_0xdca467){if(_0x423333[_0x6c0a('0x4e')]['id']){delete _0x423333[_0x6c0a('0x4e')]['id'];}return db[_0x6c0a('0x46')]['find']({'where':{'id':_0x423333[_0x6c0a('0x58')]['id']}})[_0x6c0a('0x2a')](handleEntityNotFound(_0xdca467,null))[_0x6c0a('0x2a')](saveUpdates(_0x423333['body'],null))[_0x6c0a('0x2a')](respondWithResult(_0xdca467,null))[_0x6c0a('0x49')](handleError(_0xdca467,null));};exports[_0x6c0a('0x2b')]=function(_0x5b09f4,_0x49efff){return db['AnalyticExtractedReport'][_0x6c0a('0x4c')]({'where':{'id':_0x5b09f4[_0x6c0a('0x58')]['id']}})[_0x6c0a('0x2a')](handleEntityNotFound(_0x49efff,null))['then'](removeEntity(_0x49efff,null))[_0x6c0a('0x49')](handleError(_0x49efff,null));};exports[_0x6c0a('0x59')]=function(_0x3e571d,_0x11c4e1,_0x570974){return db[_0x6c0a('0x46')][_0x6c0a('0x4c')]({'where':{'id':_0x3e571d['params']['id']},'attributes':['name',_0x6c0a('0x5a'),_0x6c0a('0x5b'),'output'],'raw':!![]})[_0x6c0a('0x2a')](handleEntityNotFound(_0x11c4e1,null))[_0x6c0a('0x2a')](function(_0x7812a6){if(_0x7812a6){if(!fs[_0x6c0a('0x5c')](path[_0x6c0a('0x5d')](config['root'],_0x6c0a('0x5e'),_0x7812a6[_0x6c0a('0x5b')]))){throw new db[(_0x6c0a('0x5f'))][(_0x6c0a('0x60'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x3e571d[_0x6c0a('0x36')][_0x6c0a('0x61')]){return _0x11c4e1['sendStatus'](0xc8);}return _0x11c4e1[_0x6c0a('0x59')](path['join'](config[_0x6c0a('0x62')],_0x6c0a('0x5e'),_0x7812a6[_0x6c0a('0x5b')]),util[_0x6c0a('0x63')]('%s.%s',_0x7812a6[_0x6c0a('0x5a')]||_0x7812a6[_0x6c0a('0x2f')],_0x7812a6[_0x6c0a('0x64')][_0x6c0a('0x65')]()));}})[_0x6c0a('0x49')](handleError(_0x11c4e1,null));};
\ No newline at end of file