Built motion from commit (unavailable).|2.5.3
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 58f06b9..000f8fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f7b=['pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','intersection','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','nolimit','offset','order','sort','where'];(function(_0x2229de,_0x596a5b){var _0x25d05e=function(_0x2c8bda){while(--_0x2c8bda){_0x2229de['push'](_0x2229de['shift']());}};_0x25d05e(++_0x596a5b);}(_0x1f7b,0x81));var _0xb1f7=function(_0x5a91a5,_0x1eb099){_0x5a91a5=_0x5a91a5-0x0;var _0x8f99de=_0x1f7b[_0x5a91a5];return _0x8f99de;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb1f7('0x0'));var jsonpatch=require(_0xb1f7('0x1'));var rp=require(_0xb1f7('0x2'));var moment=require(_0xb1f7('0x3'));var BPromise=require(_0xb1f7('0x4'));var Mustache=require(_0xb1f7('0x5'));var util=require(_0xb1f7('0x6'));var path=require('path');var sox=require(_0xb1f7('0x7'));var csv=require(_0xb1f7('0x8'));var ejs=require(_0xb1f7('0x9'));var fs=require('fs');var _=require(_0xb1f7('0xa'));var squel=require(_0xb1f7('0xb'));var crypto=require(_0xb1f7('0xc'));var jsforce=require(_0xb1f7('0xd'));var deskjs=require(_0xb1f7('0xe'));var toCsv=require(_0xb1f7('0x8'));var querystring=require(_0xb1f7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb1f7('0x10'));var as=require(_0xb1f7('0x11'));var hardwareService=require(_0xb1f7('0x12'));var logger=require(_0xb1f7('0x13'))(_0xb1f7('0x14'));var utils=require('../../config/utils');var config=require(_0xb1f7('0x15'));var db=require(_0xb1f7('0x16'))['db'];function respondWithStatusCode(_0x111f64,_0x4f25b3){_0x4f25b3=_0x4f25b3||0xcc;return function(_0x236e63){if(_0x236e63){return _0x111f64[_0xb1f7('0x17')](_0x4f25b3);}return _0x111f64[_0xb1f7('0x18')](_0x4f25b3)[_0xb1f7('0x19')]();};}function respondWithResult(_0x3c5227,_0x985ac5){_0x985ac5=_0x985ac5||0xc8;return function(_0x1658ed){if(_0x1658ed){return _0x3c5227['status'](_0x985ac5)[_0xb1f7('0x1a')](_0x1658ed);}};}function respondWithFilteredResult(_0x25b1c3,_0x48e78d){return function(_0x2d9112){if(_0x2d9112){var _0x2716b6=_0x2d9112[_0xb1f7('0x1b')],_0x5cd37f=_0x48e78d['offset'],_0x3589de=_0x48e78d['offset']+_0x48e78d[_0xb1f7('0x1c')],_0x27e301;if(_0x3589de>=_0x2716b6){_0x3589de=_0x2716b6;_0x27e301=0xc8;}else{_0x27e301=0xce;}_0x25b1c3[_0xb1f7('0x18')](_0x27e301);return _0x25b1c3[_0xb1f7('0x1d')](_0xb1f7('0x1e'),_0x5cd37f+'-'+_0x3589de+'/'+_0x2716b6)[_0xb1f7('0x1a')](_0x2d9112);}return null;};}function patchUpdates(_0x151e6a){return function(_0x228580){try{jsonpatch[_0xb1f7('0x1f')](_0x228580,_0x151e6a,!![]);}catch(_0x48581c){return BPromise[_0xb1f7('0x20')](_0x48581c);}return _0x228580[_0xb1f7('0x21')]();};}function saveUpdates(_0x2041c0,_0x2a1b1e){return function(_0x289006){if(_0x289006){return _0x289006[_0xb1f7('0x22')](_0x2041c0)['then'](function(_0x496d0e){return _0x496d0e;});}return null;};}function removeEntity(_0x244ef5,_0x41fe58){return function(_0x534c11){if(_0x534c11){return _0x534c11[_0xb1f7('0x23')]()[_0xb1f7('0x24')](function(){var _0x4c3db3=_0x534c11[_0xb1f7('0x25')]({'plain':!![]});var _0x1e79c5=_0xb1f7('0x26');return db[_0xb1f7('0x27')][_0xb1f7('0x23')]({'where':{'type':_0x1e79c5,'resourceId':_0x4c3db3['id']}})[_0xb1f7('0x24')](function(){return _0x534c11;});})[_0xb1f7('0x24')](function(){_0x244ef5[_0xb1f7('0x18')](0xcc)[_0xb1f7('0x19')]();});}};}function handleEntityNotFound(_0x2c8bbb,_0x538676){return function(_0x44093b){if(!_0x44093b){_0x2c8bbb[_0xb1f7('0x17')](0x194);}return _0x44093b;};}function handleError(_0x10f4bc,_0x37aa4c){_0x37aa4c=_0x37aa4c||0x1f4;return function(_0x245b66){logger[_0xb1f7('0x28')](_0x245b66[_0xb1f7('0x29')]);if(_0x245b66[_0xb1f7('0x2a')]){delete _0x245b66[_0xb1f7('0x2a')];}_0x10f4bc[_0xb1f7('0x18')](_0x37aa4c)[_0xb1f7('0x2b')](_0x245b66);};}exports[_0xb1f7('0x2c')]=function(_0x41b942,_0x5c9120){var _0x36b1cd={},_0x175e42={},_0x2ed355={'count':0x0,'rows':[]};var _0x184ae6=_[_0xb1f7('0x2d')](db[_0xb1f7('0x2e')][_0xb1f7('0x2f')],function(_0x57983f){return{'name':_0x57983f[_0xb1f7('0x30')],'type':_0x57983f[_0xb1f7('0x31')][_0xb1f7('0x32')]};});_0x175e42['model']=_[_0xb1f7('0x2d')](_0x184ae6,_0xb1f7('0x2a'));_0x175e42[_0xb1f7('0x33')]=_['keys'](_0x41b942['query']);_0x175e42[_0xb1f7('0x34')]=_['intersection'](_0x175e42[_0xb1f7('0x35')],_0x175e42[_0xb1f7('0x33')]);_0x36b1cd['attributes']=_['intersection'](_0x175e42['model'],qs[_0xb1f7('0x36')](_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x36')]));_0x36b1cd[_0xb1f7('0x37')]=_0x36b1cd[_0xb1f7('0x37')]['length']?_0x36b1cd[_0xb1f7('0x37')]:_0x175e42[_0xb1f7('0x35')];if(!_0x41b942['query']['hasOwnProperty'](_0xb1f7('0x38'))){_0x36b1cd[_0xb1f7('0x1c')]=qs[_0xb1f7('0x1c')](_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x1c')]);_0x36b1cd[_0xb1f7('0x39')]=qs[_0xb1f7('0x39')](_0x41b942[_0xb1f7('0x33')]['offset']);}_0x36b1cd[_0xb1f7('0x3a')]=qs[_0xb1f7('0x3b')](_0x41b942['query']['sort']);_0x36b1cd[_0xb1f7('0x3c')]=qs[_0xb1f7('0x34')](_[_0xb1f7('0x3d')](_0x41b942[_0xb1f7('0x33')],_0x175e42[_0xb1f7('0x34')]),_0x184ae6);if(_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x3e')]){_0x36b1cd[_0xb1f7('0x3c')]=_['merge'](_0x36b1cd['where'],{'$or':_[_0xb1f7('0x2d')](_0x184ae6,function(_0x49ece7){if(_0x49ece7['type']!==_0xb1f7('0x3f')){var _0x573681={};_0x573681[_0x49ece7[_0xb1f7('0x2a')]]={'$like':'%'+_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x3e')]+'%'};return _0x573681;}})});}_0x36b1cd=_[_0xb1f7('0x40')]({},_0x36b1cd,_0x41b942[_0xb1f7('0x41')]);var _0x5dbc14={'where':_0x36b1cd[_0xb1f7('0x3c')]};return db[_0xb1f7('0x2e')][_0xb1f7('0x1b')](_0x5dbc14)['then'](function(_0x2911d1){_0x2ed355[_0xb1f7('0x1b')]=_0x2911d1;if(_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x42')]){_0x36b1cd['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xb1f7('0x43')](_0x36b1cd);})['then'](function(_0x5c0479){_0x2ed355['rows']=_0x5c0479;return _0x2ed355;})[_0xb1f7('0x24')](respondWithFilteredResult(_0x5c9120,_0x36b1cd))[_0xb1f7('0x44')](handleError(_0x5c9120,null));};exports[_0xb1f7('0x45')]=function(_0x1604d6,_0x1f32b8){var _0x4938b3={'raw':!![],'where':{'id':_0x1604d6[_0xb1f7('0x46')]['id']}},_0x48d248={};_0x48d248[_0xb1f7('0x35')]=_['keys'](db['AnalyticExtractedReport'][_0xb1f7('0x2f')]);_0x48d248['query']=_[_0xb1f7('0x47')](_0x1604d6['query']);_0x48d248[_0xb1f7('0x34')]=_[_0xb1f7('0x48')](_0x48d248['model'],_0x48d248[_0xb1f7('0x33')]);_0x4938b3[_0xb1f7('0x37')]=_[_0xb1f7('0x48')](_0x48d248[_0xb1f7('0x35')],qs['fields'](_0x1604d6['query'][_0xb1f7('0x36')]));_0x4938b3[_0xb1f7('0x37')]=_0x4938b3['attributes'][_0xb1f7('0x49')]?_0x4938b3[_0xb1f7('0x37')]:_0x48d248[_0xb1f7('0x35')];if(_0x1604d6[_0xb1f7('0x33')][_0xb1f7('0x42')]){_0x4938b3['include']=[{'all':!![]}];}_0x4938b3=_[_0xb1f7('0x40')]({},_0x4938b3,_0x1604d6[_0xb1f7('0x41')]);return db['AnalyticExtractedReport']['find'](_0x4938b3)[_0xb1f7('0x24')](handleEntityNotFound(_0x1f32b8,null))[_0xb1f7('0x24')](respondWithResult(_0x1f32b8,null))['catch'](handleError(_0x1f32b8,null));};exports[_0xb1f7('0x4a')]=function(_0x37bc9a,_0x1ab427){return db[_0xb1f7('0x2e')][_0xb1f7('0x4a')](_0x37bc9a['body'],{})[_0xb1f7('0x24')](function(_0x12ece4){var _0xed0ef=_0x37bc9a[_0xb1f7('0x4b')][_0xb1f7('0x25')]({'plain':!![]});if(!_0xed0ef)throw new Error(_0xb1f7('0x4c'));if(_0xed0ef[_0xb1f7('0x4d')]===_0xb1f7('0x4b')){var _0x18dab9=_0x12ece4['get']({'plain':!![]});var _0xf096ea=_0xb1f7('0x26');return db['UserProfileSection'][_0xb1f7('0x4e')]({'where':{'name':_0xf096ea,'userProfileId':_0xed0ef[_0xb1f7('0x4f')]},'raw':!![]})[_0xb1f7('0x24')](function(_0x22bc57){if(_0x22bc57&&_0x22bc57[_0xb1f7('0x50')]===0x0){return db[_0xb1f7('0x27')][_0xb1f7('0x4a')]({'name':_0x18dab9['name'],'resourceId':_0x18dab9['id'],'type':_0x22bc57[_0xb1f7('0x2a')],'sectionId':_0x22bc57['id']},{})[_0xb1f7('0x24')](function(){return _0x12ece4;});}else{return _0x12ece4;}})[_0xb1f7('0x44')](function(_0x3b8679){logger[_0xb1f7('0x28')](_0xb1f7('0x51'),_0x3b8679);throw _0x3b8679;});}return _0x12ece4;})[_0xb1f7('0x24')](respondWithResult(_0x1ab427,0xc9))[_0xb1f7('0x44')](handleError(_0x1ab427,null));};exports[_0xb1f7('0x22')]=function(_0x2bcaf0,_0x284bc7){if(_0x2bcaf0[_0xb1f7('0x52')]['id']){delete _0x2bcaf0[_0xb1f7('0x52')]['id'];}return db['AnalyticExtractedReport'][_0xb1f7('0x4e')]({'where':{'id':_0x2bcaf0[_0xb1f7('0x46')]['id']}})[_0xb1f7('0x24')](handleEntityNotFound(_0x284bc7,null))[_0xb1f7('0x24')](saveUpdates(_0x2bcaf0[_0xb1f7('0x52')],null))[_0xb1f7('0x24')](respondWithResult(_0x284bc7,null))[_0xb1f7('0x44')](handleError(_0x284bc7,null));};exports['destroy']=function(_0x1ae7f2,_0x16bc1b){return db[_0xb1f7('0x2e')]['find']({'where':{'id':_0x1ae7f2['params']['id']}})[_0xb1f7('0x24')](handleEntityNotFound(_0x16bc1b,null))[_0xb1f7('0x24')](removeEntity(_0x16bc1b,null))[_0xb1f7('0x44')](handleError(_0x16bc1b,null));};exports[_0xb1f7('0x53')]=function(_0x5033d8,_0x368008,_0x1f1c7f){return db[_0xb1f7('0x2e')]['find']({'where':{'id':_0x5033d8[_0xb1f7('0x46')]['id']},'attributes':[_0xb1f7('0x2a'),'basename',_0xb1f7('0x54'),_0xb1f7('0x55')],'raw':!![]})[_0xb1f7('0x24')](handleEntityNotFound(_0x368008,null))[_0xb1f7('0x24')](function(_0x299783){if(_0x299783){if(!fs['existsSync'](path[_0xb1f7('0x56')](config[_0xb1f7('0x57')],_0xb1f7('0x58'),_0x299783['savename']))){throw new db[(_0xb1f7('0x59'))][(_0xb1f7('0x5a'))](_0xb1f7('0x5b'));}if(_0x5033d8[_0xb1f7('0x33')]['exists']){return _0x368008[_0xb1f7('0x17')](0xc8);}return _0x368008['download'](path['join'](config[_0xb1f7('0x57')],_0xb1f7('0x58'),_0x299783['savename']),util[_0xb1f7('0x5c')](_0xb1f7('0x5d'),_0x299783['basename']||_0x299783['name'],_0x299783[_0xb1f7('0x55')][_0xb1f7('0x5e')]()));}})['catch'](handleError(_0x368008,null));};
\ No newline at end of file
+var _0x759f=['catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','json','count','offset','Content-Range','apply','reject','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x1c1420,_0x725c67){var _0x135494=function(_0x59f14c){while(--_0x59f14c){_0x1c1420['push'](_0x1c1420['shift']());}};_0x135494(++_0x725c67);}(_0x759f,0xc9));var _0xf759=function(_0x5c3b45,_0x1ab73e){_0x5c3b45=_0x5c3b45-0x0;var _0x4fbd0b=_0x759f[_0x5c3b45];return _0x4fbd0b;};'use strict';var pdf=require(_0xf759('0x0'));var emlformat=require(_0xf759('0x1'));var rimraf=require(_0xf759('0x2'));var zipdir=require(_0xf759('0x3'));var jsonpatch=require(_0xf759('0x4'));var rp=require(_0xf759('0x5'));var moment=require(_0xf759('0x6'));var BPromise=require(_0xf759('0x7'));var Mustache=require(_0xf759('0x8'));var util=require(_0xf759('0x9'));var path=require(_0xf759('0xa'));var sox=require(_0xf759('0xb'));var csv=require(_0xf759('0xc'));var ejs=require(_0xf759('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf759('0xe'));var jsforce=require(_0xf759('0xf'));var deskjs=require(_0xf759('0x10'));var toCsv=require(_0xf759('0xc'));var querystring=require(_0xf759('0x11'));var Papa=require(_0xf759('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf759('0x13'));var as=require(_0xf759('0x14'));var hardwareService=require(_0xf759('0x15'));var logger=require('../../config/logger')(_0xf759('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf759('0x17'))['db'];function respondWithStatusCode(_0x1197ed,_0x5e5a35){_0x5e5a35=_0x5e5a35||0xcc;return function(_0x554eca){if(_0x554eca){return _0x1197ed['sendStatus'](_0x5e5a35);}return _0x1197ed[_0xf759('0x18')](_0x5e5a35)['end']();};}function respondWithResult(_0x1bb4ef,_0x42573b){_0x42573b=_0x42573b||0xc8;return function(_0x5efa8d){if(_0x5efa8d){return _0x1bb4ef['status'](_0x42573b)[_0xf759('0x19')](_0x5efa8d);}};}function respondWithFilteredResult(_0x17249a,_0x65a392){return function(_0x33fb44){if(_0x33fb44){var _0x13da01=_0x33fb44[_0xf759('0x1a')],_0x4d9cf0=_0x65a392[_0xf759('0x1b')],_0x52a22f=_0x65a392[_0xf759('0x1b')]+_0x65a392['limit'],_0x43f80c;if(_0x52a22f>=_0x13da01){_0x52a22f=_0x13da01;_0x43f80c=0xc8;}else{_0x43f80c=0xce;}_0x17249a['status'](_0x43f80c);return _0x17249a['set'](_0xf759('0x1c'),_0x4d9cf0+'-'+_0x52a22f+'/'+_0x13da01)[_0xf759('0x19')](_0x33fb44);}return null;};}function patchUpdates(_0x2d0e01){return function(_0x544cad){try{jsonpatch[_0xf759('0x1d')](_0x544cad,_0x2d0e01,!![]);}catch(_0x579dc2){return BPromise[_0xf759('0x1e')](_0x579dc2);}return _0x544cad['save']();};}function saveUpdates(_0x1d8f11,_0x4950ac){return function(_0x2814be){if(_0x2814be){return _0x2814be['update'](_0x1d8f11)[_0xf759('0x1f')](function(_0x59932e){return _0x59932e;});}return null;};}function removeEntity(_0x495e89,_0x52af87){return function(_0x2fff0d){if(_0x2fff0d){return _0x2fff0d[_0xf759('0x20')]()[_0xf759('0x1f')](function(){var _0x269f40=_0x2fff0d[_0xf759('0x21')]({'plain':!![]});var _0x331f13=_0xf759('0x22');return db[_0xf759('0x23')][_0xf759('0x20')]({'where':{'type':_0x331f13,'resourceId':_0x269f40['id']}})[_0xf759('0x1f')](function(){return _0x2fff0d;});})['then'](function(){_0x495e89['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x666f36,_0xccb116){return function(_0x1a6d83){if(!_0x1a6d83){_0x666f36[_0xf759('0x24')](0x194);}return _0x1a6d83;};}function handleError(_0x1e7f87,_0x56e470){_0x56e470=_0x56e470||0x1f4;return function(_0x1cb09e){logger[_0xf759('0x25')](_0x1cb09e[_0xf759('0x26')]);if(_0x1cb09e[_0xf759('0x27')]){delete _0x1cb09e[_0xf759('0x27')];}_0x1e7f87[_0xf759('0x18')](_0x56e470)[_0xf759('0x28')](_0x1cb09e);};}exports[_0xf759('0x29')]=function(_0x42b289,_0xe0a49){var _0x2bf70b={},_0x13a65f={},_0x22c92e={'count':0x0,'rows':[]};var _0x1a8385=_[_0xf759('0x2a')](db[_0xf759('0x2b')][_0xf759('0x2c')],function(_0x2f3094){return{'name':_0x2f3094[_0xf759('0x2d')],'type':_0x2f3094[_0xf759('0x2e')]['key']};});_0x13a65f[_0xf759('0x2f')]=_[_0xf759('0x2a')](_0x1a8385,_0xf759('0x27'));_0x13a65f[_0xf759('0x30')]=_[_0xf759('0x31')](_0x42b289[_0xf759('0x30')]);_0x13a65f[_0xf759('0x32')]=_[_0xf759('0x33')](_0x13a65f[_0xf759('0x2f')],_0x13a65f[_0xf759('0x30')]);_0x2bf70b[_0xf759('0x34')]=_['intersection'](_0x13a65f['model'],qs[_0xf759('0x35')](_0x42b289[_0xf759('0x30')][_0xf759('0x35')]));_0x2bf70b['attributes']=_0x2bf70b[_0xf759('0x34')]['length']?_0x2bf70b['attributes']:_0x13a65f[_0xf759('0x2f')];if(!_0x42b289[_0xf759('0x30')]['hasOwnProperty'](_0xf759('0x36'))){_0x2bf70b[_0xf759('0x37')]=qs[_0xf759('0x37')](_0x42b289[_0xf759('0x30')][_0xf759('0x37')]);_0x2bf70b[_0xf759('0x1b')]=qs[_0xf759('0x1b')](_0x42b289[_0xf759('0x30')][_0xf759('0x1b')]);}_0x2bf70b[_0xf759('0x38')]=qs['sort'](_0x42b289[_0xf759('0x30')]['sort']);_0x2bf70b[_0xf759('0x39')]=qs[_0xf759('0x32')](_[_0xf759('0x3a')](_0x42b289[_0xf759('0x30')],_0x13a65f['filters']),_0x1a8385);if(_0x42b289[_0xf759('0x30')]['filter']){_0x2bf70b[_0xf759('0x39')]=_[_0xf759('0x3b')](_0x2bf70b['where'],{'$or':_[_0xf759('0x2a')](_0x1a8385,function(_0x1fa190){if(_0x1fa190['type']!==_0xf759('0x3c')){var _0x540d1e={};_0x540d1e[_0x1fa190[_0xf759('0x27')]]={'$like':'%'+_0x42b289[_0xf759('0x30')][_0xf759('0x3d')]+'%'};return _0x540d1e;}})});}_0x2bf70b=_[_0xf759('0x3b')]({},_0x2bf70b,_0x42b289[_0xf759('0x3e')]);var _0x3fe491={'where':_0x2bf70b[_0xf759('0x39')]};return db['AnalyticExtractedReport']['count'](_0x3fe491)[_0xf759('0x1f')](function(_0x39af8c){_0x22c92e[_0xf759('0x1a')]=_0x39af8c;if(_0x42b289['query'][_0xf759('0x3f')]){_0x2bf70b[_0xf759('0x40')]=[{'all':!![]}];}return db[_0xf759('0x2b')][_0xf759('0x41')](_0x2bf70b);})[_0xf759('0x1f')](function(_0x5c67cc){_0x22c92e[_0xf759('0x42')]=_0x5c67cc;return _0x22c92e;})[_0xf759('0x1f')](respondWithFilteredResult(_0xe0a49,_0x2bf70b))['catch'](handleError(_0xe0a49,null));};exports['show']=function(_0xad3bf7,_0xebe103){var _0x22044d={'raw':!![],'where':{'id':_0xad3bf7[_0xf759('0x43')]['id']}},_0x50372a={};_0x50372a[_0xf759('0x2f')]=_[_0xf759('0x31')](db[_0xf759('0x2b')][_0xf759('0x2c')]);_0x50372a[_0xf759('0x30')]=_[_0xf759('0x31')](_0xad3bf7[_0xf759('0x30')]);_0x50372a[_0xf759('0x32')]=_[_0xf759('0x33')](_0x50372a[_0xf759('0x2f')],_0x50372a[_0xf759('0x30')]);_0x22044d[_0xf759('0x34')]=_[_0xf759('0x33')](_0x50372a[_0xf759('0x2f')],qs[_0xf759('0x35')](_0xad3bf7[_0xf759('0x30')][_0xf759('0x35')]));_0x22044d[_0xf759('0x34')]=_0x22044d[_0xf759('0x34')][_0xf759('0x44')]?_0x22044d[_0xf759('0x34')]:_0x50372a[_0xf759('0x2f')];if(_0xad3bf7[_0xf759('0x30')][_0xf759('0x3f')]){_0x22044d['include']=[{'all':!![]}];}_0x22044d=_[_0xf759('0x3b')]({},_0x22044d,_0xad3bf7[_0xf759('0x3e')]);return db[_0xf759('0x2b')]['find'](_0x22044d)[_0xf759('0x1f')](handleEntityNotFound(_0xebe103,null))[_0xf759('0x1f')](respondWithResult(_0xebe103,null))['catch'](handleError(_0xebe103,null));};exports[_0xf759('0x45')]=function(_0x541455,_0x2f1d25){return db[_0xf759('0x2b')][_0xf759('0x45')](_0x541455[_0xf759('0x46')],{})[_0xf759('0x1f')](function(_0x3f4fe0){var _0x128a48=_0x541455[_0xf759('0x47')][_0xf759('0x21')]({'plain':!![]});if(!_0x128a48)throw new Error(_0xf759('0x48'));if(_0x128a48[_0xf759('0x49')]===_0xf759('0x47')){var _0x354edb=_0x3f4fe0[_0xf759('0x21')]({'plain':!![]});var _0x32f470='ExtractedReports';return db[_0xf759('0x4a')]['find']({'where':{'name':_0x32f470,'userProfileId':_0x128a48['userProfileId']},'raw':!![]})[_0xf759('0x1f')](function(_0x3c75b8){if(_0x3c75b8&&_0x3c75b8['autoAssociation']===0x0){return db[_0xf759('0x23')]['create']({'name':_0x354edb[_0xf759('0x27')],'resourceId':_0x354edb['id'],'type':_0x3c75b8[_0xf759('0x27')],'sectionId':_0x3c75b8['id']},{})[_0xf759('0x1f')](function(){return _0x3f4fe0;});}else{return _0x3f4fe0;}})[_0xf759('0x4b')](function(_0x522ede){logger[_0xf759('0x25')](_0xf759('0x4c'),_0x522ede);throw _0x522ede;});}return _0x3f4fe0;})[_0xf759('0x1f')](respondWithResult(_0x2f1d25,0xc9))['catch'](handleError(_0x2f1d25,null));};exports[_0xf759('0x4d')]=function(_0x5d5c44,_0x193063){if(_0x5d5c44[_0xf759('0x46')]['id']){delete _0x5d5c44[_0xf759('0x46')]['id'];}return db[_0xf759('0x2b')][_0xf759('0x4e')]({'where':{'id':_0x5d5c44[_0xf759('0x43')]['id']}})[_0xf759('0x1f')](handleEntityNotFound(_0x193063,null))[_0xf759('0x1f')](saveUpdates(_0x5d5c44[_0xf759('0x46')],null))[_0xf759('0x1f')](respondWithResult(_0x193063,null))[_0xf759('0x4b')](handleError(_0x193063,null));};exports[_0xf759('0x20')]=function(_0x537e7d,_0x3e40d1){return db[_0xf759('0x2b')][_0xf759('0x4e')]({'where':{'id':_0x537e7d['params']['id']}})[_0xf759('0x1f')](handleEntityNotFound(_0x3e40d1,null))['then'](removeEntity(_0x3e40d1,null))[_0xf759('0x4b')](handleError(_0x3e40d1,null));};exports[_0xf759('0x4f')]=function(_0x2fc8c6,_0x4135d8,_0x1afb10){return db[_0xf759('0x2b')]['find']({'where':{'id':_0x2fc8c6['params']['id']},'attributes':[_0xf759('0x27'),_0xf759('0x50'),_0xf759('0x51'),_0xf759('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x4135d8,null))[_0xf759('0x1f')](function(_0x18e209){if(_0x18e209){if(!fs[_0xf759('0x53')](path['join'](config[_0xf759('0x54')],_0xf759('0x55'),_0x18e209[_0xf759('0x51')]))){throw new db[(_0xf759('0x56'))]['ValidationError'](_0xf759('0x57'));}if(_0x2fc8c6[_0xf759('0x30')]['exists']){return _0x4135d8[_0xf759('0x24')](0xc8);}return _0x4135d8['download'](path[_0xf759('0x58')](config[_0xf759('0x54')],_0xf759('0x55'),_0x18e209['savename']),util[_0xf759('0x59')](_0xf759('0x5a'),_0x18e209[_0xf759('0x50')]||_0x18e209[_0xf759('0x27')],_0x18e209[_0xf759('0x52')][_0xf759('0x5b')]()));}})['catch'](handleError(_0x4135d8,null));};
\ No newline at end of file