Built motion from commit e6806ed6.|2.6.0
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index b7be1e9..bd1ba97 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x450f=['AnalyticExtractedReport','includeAll','findAll','rows','catch','show','keys','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','get','ExtractedReports','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x2ec2c6,_0x4087a2){var _0x52d5a3=function(_0x2341a6){while(--_0x2341a6){_0x2ec2c6['push'](_0x2ec2c6['shift']());}};_0x52d5a3(++_0x4087a2);}(_0x450f,0x1b1));var _0xf450=function(_0x48b329,_0xa9c97f){_0x48b329=_0x48b329-0x0;var _0x2ac307=_0x450f[_0x48b329];return _0x2ac307;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf450('0x0'));var zipdir=require(_0xf450('0x1'));var jsonpatch=require(_0xf450('0x2'));var rp=require(_0xf450('0x3'));var moment=require(_0xf450('0x4'));var BPromise=require(_0xf450('0x5'));var Mustache=require(_0xf450('0x6'));var util=require(_0xf450('0x7'));var path=require(_0xf450('0x8'));var sox=require(_0xf450('0x9'));var csv=require(_0xf450('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf450('0xb'));var _=require('lodash');var squel=require(_0xf450('0xc'));var crypto=require(_0xf450('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf450('0xe'));var toCsv=require(_0xf450('0xa'));var querystring=require('querystring');var Papa=require(_0xf450('0xf'));var Redis=require(_0xf450('0x10'));var authService=require(_0xf450('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf450('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf450('0x13'))(_0xf450('0x14'));var utils=require(_0xf450('0x15'));var config=require(_0xf450('0x16'));var licenseUtil=require(_0xf450('0x17'));var db=require(_0xf450('0x18'))['db'];function respondWithStatusCode(_0x1fd279,_0x4a26a8){_0x4a26a8=_0x4a26a8||0xcc;return function(_0x5cfc22){if(_0x5cfc22){return _0x1fd279[_0xf450('0x19')](_0x4a26a8);}return _0x1fd279[_0xf450('0x1a')](_0x4a26a8)['end']();};}function respondWithResult(_0x5740d1,_0x5e981a){_0x5e981a=_0x5e981a||0xc8;return function(_0x41173c){if(_0x41173c){return _0x5740d1[_0xf450('0x1a')](_0x5e981a)['json'](_0x41173c);}};}function respondWithFilteredResult(_0x53fa4c,_0x5cd454){return function(_0x38ec4b){if(_0x38ec4b){var _0x53adc4=typeof _0x5cd454[_0xf450('0x1b')]===_0xf450('0x1c')&&typeof _0x5cd454[_0xf450('0x1d')]===_0xf450('0x1c');var _0x1528cb=_0x38ec4b[_0xf450('0x1e')];var _0x4a1109=_0x53adc4?0x0:_0x5cd454['offset'];var _0x15198=_0x53adc4?_0x38ec4b[_0xf450('0x1e')]:_0x5cd454['offset']+_0x5cd454[_0xf450('0x1d')];var _0x1eb68b;if(_0x15198>=_0x1528cb){_0x15198=_0x1528cb;_0x1eb68b=0xc8;}else{_0x1eb68b=0xce;}_0x53fa4c[_0xf450('0x1a')](_0x1eb68b);return _0x53fa4c[_0xf450('0x1f')](_0xf450('0x20'),_0x4a1109+'-'+_0x15198+'/'+_0x1528cb)[_0xf450('0x21')](_0x38ec4b);}return null;};}function patchUpdates(_0x27407c){return function(_0x33a716){try{jsonpatch[_0xf450('0x22')](_0x33a716,_0x27407c,!![]);}catch(_0xbf2c3c){return BPromise[_0xf450('0x23')](_0xbf2c3c);}return _0x33a716['save']();};}function saveUpdates(_0x5245bf,_0x12c386){return function(_0x1e058f){if(_0x1e058f){return _0x1e058f[_0xf450('0x24')](_0x5245bf)['then'](function(_0x322ce5){return _0x322ce5;});}return null;};}function removeEntity(_0x4e547f,_0x5323f9){return function(_0x1af8eb){if(_0x1af8eb){return _0x1af8eb[_0xf450('0x25')]()[_0xf450('0x26')](function(){var _0x1c9b3b=_0x1af8eb[_0xf450('0x27')]({'plain':!![]});var _0x43387f=_0xf450('0x28');return db[_0xf450('0x29')][_0xf450('0x25')]({'where':{'type':_0x43387f,'resourceId':_0x1c9b3b['id']}})[_0xf450('0x26')](function(){return _0x1af8eb;});})['then'](function(){_0x4e547f[_0xf450('0x1a')](0xcc)[_0xf450('0x2a')]();});}};}function handleEntityNotFound(_0x53b37b,_0x55b5dd){return function(_0x531ab6){if(!_0x531ab6){_0x53b37b[_0xf450('0x19')](0x194);}return _0x531ab6;};}function handleError(_0xf7b51,_0x55c456){_0x55c456=_0x55c456||0x1f4;return function(_0x1600ed){logger[_0xf450('0x2b')](_0x1600ed['stack']);if(_0x1600ed[_0xf450('0x2c')]){delete _0x1600ed[_0xf450('0x2c')];}_0xf7b51[_0xf450('0x1a')](_0x55c456)[_0xf450('0x2d')](_0x1600ed);};}exports[_0xf450('0x2e')]=function(_0x84978e,_0x5b2131){var _0x358ab8={},_0x2c37c8={},_0x6b1fd5={'count':0x0,'rows':[]};var _0x30d24e=_[_0xf450('0x2f')](db['AnalyticExtractedReport'][_0xf450('0x30')],function(_0x535164){return{'name':_0x535164[_0xf450('0x31')],'type':_0x535164[_0xf450('0x32')][_0xf450('0x33')]};});_0x2c37c8[_0xf450('0x34')]=_[_0xf450('0x2f')](_0x30d24e,_0xf450('0x2c'));_0x2c37c8[_0xf450('0x35')]=_['keys'](_0x84978e[_0xf450('0x35')]);_0x2c37c8[_0xf450('0x36')]=_[_0xf450('0x37')](_0x2c37c8[_0xf450('0x34')],_0x2c37c8[_0xf450('0x35')]);_0x358ab8[_0xf450('0x38')]=_[_0xf450('0x37')](_0x2c37c8[_0xf450('0x34')],qs[_0xf450('0x39')](_0x84978e[_0xf450('0x35')][_0xf450('0x39')]));_0x358ab8[_0xf450('0x38')]=_0x358ab8['attributes']['length']?_0x358ab8[_0xf450('0x38')]:_0x2c37c8['model'];if(!_0x84978e[_0xf450('0x35')][_0xf450('0x3a')](_0xf450('0x3b'))){_0x358ab8[_0xf450('0x1d')]=qs[_0xf450('0x1d')](_0x84978e[_0xf450('0x35')]['limit']);_0x358ab8[_0xf450('0x1b')]=qs[_0xf450('0x1b')](_0x84978e[_0xf450('0x35')]['offset']);}_0x358ab8['order']=qs[_0xf450('0x3c')](_0x84978e[_0xf450('0x35')][_0xf450('0x3c')]);_0x358ab8[_0xf450('0x3d')]=qs[_0xf450('0x36')](_[_0xf450('0x3e')](_0x84978e[_0xf450('0x35')],_0x2c37c8[_0xf450('0x36')]),_0x30d24e);if(_0x84978e['query'][_0xf450('0x3f')]){_0x358ab8[_0xf450('0x3d')]=_[_0xf450('0x40')](_0x358ab8[_0xf450('0x3d')],{'$or':_[_0xf450('0x2f')](_0x30d24e,function(_0xfd0887){if(_0xfd0887[_0xf450('0x32')]!==_0xf450('0x41')){var _0x579caa={};_0x579caa[_0xfd0887['name']]={'$like':'%'+_0x84978e[_0xf450('0x35')]['filter']+'%'};return _0x579caa;}})});}_0x358ab8=_['merge']({},_0x358ab8,_0x84978e[_0xf450('0x42')]);var _0x39a5be={'where':_0x358ab8['where']};return db[_0xf450('0x43')][_0xf450('0x1e')](_0x39a5be)[_0xf450('0x26')](function(_0xb78186){_0x6b1fd5['count']=_0xb78186;if(_0x84978e[_0xf450('0x35')][_0xf450('0x44')]){_0x358ab8['include']=[{'all':!![]}];}return db[_0xf450('0x43')][_0xf450('0x45')](_0x358ab8);})['then'](function(_0x288bb5){_0x6b1fd5[_0xf450('0x46')]=_0x288bb5;return _0x6b1fd5;})[_0xf450('0x26')](respondWithFilteredResult(_0x5b2131,_0x358ab8))[_0xf450('0x47')](handleError(_0x5b2131,null));};exports[_0xf450('0x48')]=function(_0x47d6b8,_0x4f8cf4){var _0x150f7b={'raw':!![],'where':{'id':_0x47d6b8['params']['id']}},_0x396732={};_0x396732[_0xf450('0x34')]=_[_0xf450('0x49')](db[_0xf450('0x43')]['rawAttributes']);_0x396732[_0xf450('0x35')]=_[_0xf450('0x49')](_0x47d6b8[_0xf450('0x35')]);_0x396732[_0xf450('0x36')]=_[_0xf450('0x37')](_0x396732[_0xf450('0x34')],_0x396732[_0xf450('0x35')]);_0x150f7b[_0xf450('0x38')]=_[_0xf450('0x37')](_0x396732[_0xf450('0x34')],qs[_0xf450('0x39')](_0x47d6b8['query']['fields']));_0x150f7b[_0xf450('0x38')]=_0x150f7b[_0xf450('0x38')][_0xf450('0x4a')]?_0x150f7b[_0xf450('0x38')]:_0x396732[_0xf450('0x34')];if(_0x47d6b8['query'][_0xf450('0x44')]){_0x150f7b[_0xf450('0x4b')]=[{'all':!![]}];}_0x150f7b=_[_0xf450('0x40')]({},_0x150f7b,_0x47d6b8['options']);return db[_0xf450('0x43')][_0xf450('0x4c')](_0x150f7b)[_0xf450('0x26')](handleEntityNotFound(_0x4f8cf4,null))[_0xf450('0x26')](respondWithResult(_0x4f8cf4,null))[_0xf450('0x47')](handleError(_0x4f8cf4,null));};exports[_0xf450('0x4d')]=function(_0x1a8ef5,_0x51a570){return db[_0xf450('0x43')][_0xf450('0x4d')](_0x1a8ef5[_0xf450('0x4e')],{})[_0xf450('0x26')](function(_0x576123){var _0xb4b11=_0x1a8ef5['user'][_0xf450('0x27')]({'plain':!![]});if(!_0xb4b11)throw new Error(_0xf450('0x4f'));if(_0xb4b11[_0xf450('0x50')]==='user'){var _0x3fc1e1=_0x576123[_0xf450('0x27')]({'plain':!![]});var _0x45c95c=_0xf450('0x28');return db[_0xf450('0x51')][_0xf450('0x4c')]({'where':{'name':_0x45c95c,'userProfileId':_0xb4b11[_0xf450('0x52')]},'raw':!![]})[_0xf450('0x26')](function(_0x315751){if(_0x315751&&_0x315751[_0xf450('0x53')]===0x0){return db[_0xf450('0x29')][_0xf450('0x4d')]({'name':_0x3fc1e1[_0xf450('0x2c')],'resourceId':_0x3fc1e1['id'],'type':_0x315751['name'],'sectionId':_0x315751['id']},{})[_0xf450('0x26')](function(){return _0x576123;});}else{return _0x576123;}})[_0xf450('0x47')](function(_0x4c9055){logger[_0xf450('0x2b')](_0xf450('0x54'),_0x4c9055);throw _0x4c9055;});}return _0x576123;})[_0xf450('0x26')](respondWithResult(_0x51a570,0xc9))[_0xf450('0x47')](handleError(_0x51a570,null));};exports['update']=function(_0x2f2281,_0x4fcdba){if(_0x2f2281[_0xf450('0x4e')]['id']){delete _0x2f2281[_0xf450('0x4e')]['id'];}return db[_0xf450('0x43')][_0xf450('0x4c')]({'where':{'id':_0x2f2281['params']['id']}})[_0xf450('0x26')](handleEntityNotFound(_0x4fcdba,null))[_0xf450('0x26')](saveUpdates(_0x2f2281[_0xf450('0x4e')],null))[_0xf450('0x26')](respondWithResult(_0x4fcdba,null))[_0xf450('0x47')](handleError(_0x4fcdba,null));};exports['destroy']=function(_0x423396,_0x393d99){return db[_0xf450('0x43')]['find']({'where':{'id':_0x423396[_0xf450('0x55')]['id']}})['then'](handleEntityNotFound(_0x393d99,null))['then'](removeEntity(_0x393d99,null))[_0xf450('0x47')](handleError(_0x393d99,null));};exports[_0xf450('0x56')]=function(_0x4ec5ec,_0x17ed40,_0x18d9b7){return db['AnalyticExtractedReport'][_0xf450('0x4c')]({'where':{'id':_0x4ec5ec[_0xf450('0x55')]['id']},'attributes':[_0xf450('0x2c'),_0xf450('0x57'),_0xf450('0x58'),_0xf450('0x59')],'raw':!![]})[_0xf450('0x26')](handleEntityNotFound(_0x17ed40,null))[_0xf450('0x26')](function(_0x553ac1){if(_0x553ac1){if(!fs['existsSync'](path[_0xf450('0x5a')](config[_0xf450('0x5b')],'server/files/reports',_0x553ac1['savename']))){throw new db[(_0xf450('0x5c'))][(_0xf450('0x5d'))](_0xf450('0x5e'));}if(_0x4ec5ec[_0xf450('0x35')][_0xf450('0x5f')]){return _0x17ed40['sendStatus'](0xc8);}return _0x17ed40['download'](path[_0xf450('0x5a')](config['root'],_0xf450('0x60'),_0x553ac1[_0xf450('0x58')]),util[_0xf450('0x61')](_0xf450('0x62'),_0x553ac1['basename']||_0x553ac1[_0xf450('0x2c')],_0x553ac1[_0xf450('0x59')][_0xf450('0x63')]()));}})[_0xf450('0x47')](handleError(_0x17ed40,null));};
\ No newline at end of file
+var _0x708c=['destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','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','update','download','basename','output','root','savename','Sequelize','join','format','%s.%s','toLowerCase','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then'];(function(_0x5cb2eb,_0x544081){var _0xae80c0=function(_0x38ef17){while(--_0x38ef17){_0x5cb2eb['push'](_0x5cb2eb['shift']());}};_0xae80c0(++_0x544081);}(_0x708c,0x9e));var _0xc708=function(_0x222fca,_0x12134f){_0x222fca=_0x222fca-0x0;var _0x1bc0a4=_0x708c[_0x222fca];return _0x1bc0a4;};'use strict';var emlformat=require(_0xc708('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc708('0x1'));var rp=require('request-promise');var moment=require(_0xc708('0x2'));var BPromise=require(_0xc708('0x3'));var Mustache=require(_0xc708('0x4'));var util=require(_0xc708('0x5'));var path=require(_0xc708('0x6'));var sox=require(_0xc708('0x7'));var csv=require(_0xc708('0x8'));var ejs=require(_0xc708('0x9'));var fs=require('fs');var fs_extra=require(_0xc708('0xa'));var _=require(_0xc708('0xb'));var squel=require(_0xc708('0xc'));var crypto=require(_0xc708('0xd'));var jsforce=require(_0xc708('0xe'));var deskjs=require(_0xc708('0xf'));var toCsv=require(_0xc708('0x8'));var querystring=require(_0xc708('0x10'));var Papa=require(_0xc708('0x11'));var Redis=require(_0xc708('0x12'));var authService=require(_0xc708('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc708('0x14'));var hardwareService=require(_0xc708('0x15'));var logger=require(_0xc708('0x16'))('api');var utils=require(_0xc708('0x17'));var config=require(_0xc708('0x18'));var licenseUtil=require(_0xc708('0x19'));var db=require(_0xc708('0x1a'))['db'];function respondWithStatusCode(_0x200ec7,_0x529045){_0x529045=_0x529045||0xcc;return function(_0x48c808){if(_0x48c808){return _0x200ec7[_0xc708('0x1b')](_0x529045);}return _0x200ec7[_0xc708('0x1c')](_0x529045)[_0xc708('0x1d')]();};}function respondWithResult(_0x1c2b9d,_0x460b4e){_0x460b4e=_0x460b4e||0xc8;return function(_0x254a4c){if(_0x254a4c){return _0x1c2b9d[_0xc708('0x1c')](_0x460b4e)[_0xc708('0x1e')](_0x254a4c);}};}function respondWithFilteredResult(_0x5edbf2,_0x3ec44a){return function(_0x525386){if(_0x525386){var _0x135b51=typeof _0x3ec44a['offset']===_0xc708('0x1f')&&typeof _0x3ec44a[_0xc708('0x20')]==='undefined';var _0x1f2f58=_0x525386['count'];var _0x521656=_0x135b51?0x0:_0x3ec44a[_0xc708('0x21')];var _0x4ea454=_0x135b51?_0x525386[_0xc708('0x22')]:_0x3ec44a['offset']+_0x3ec44a['limit'];var _0x131a06;if(_0x4ea454>=_0x1f2f58){_0x4ea454=_0x1f2f58;_0x131a06=0xc8;}else{_0x131a06=0xce;}_0x5edbf2[_0xc708('0x1c')](_0x131a06);return _0x5edbf2['set'](_0xc708('0x23'),_0x521656+'-'+_0x4ea454+'/'+_0x1f2f58)[_0xc708('0x1e')](_0x525386);}return null;};}function patchUpdates(_0x269598){return function(_0x7111dd){try{jsonpatch[_0xc708('0x24')](_0x7111dd,_0x269598,!![]);}catch(_0xefc08e){return BPromise[_0xc708('0x25')](_0xefc08e);}return _0x7111dd[_0xc708('0x26')]();};}function saveUpdates(_0x1bf64a,_0x308dfa){return function(_0x4becd4){if(_0x4becd4){return _0x4becd4['update'](_0x1bf64a)[_0xc708('0x27')](function(_0x281c76){return _0x281c76;});}return null;};}function removeEntity(_0x4a17e2,_0x153b39){return function(_0x10b6f8){if(_0x10b6f8){return _0x10b6f8[_0xc708('0x28')]()[_0xc708('0x27')](function(){var _0x36344c=_0x10b6f8[_0xc708('0x29')]({'plain':!![]});var _0x50d11a='ExtractedReports';return db[_0xc708('0x2a')]['destroy']({'where':{'type':_0x50d11a,'resourceId':_0x36344c['id']}})[_0xc708('0x27')](function(){return _0x10b6f8;});})[_0xc708('0x27')](function(){_0x4a17e2[_0xc708('0x1c')](0xcc)[_0xc708('0x1d')]();});}};}function handleEntityNotFound(_0x18df4f,_0x7f40d1){return function(_0x586acf){if(!_0x586acf){_0x18df4f['sendStatus'](0x194);}return _0x586acf;};}function handleError(_0x56f992,_0x1d089e){_0x1d089e=_0x1d089e||0x1f4;return function(_0x378072){logger[_0xc708('0x2b')](_0x378072[_0xc708('0x2c')]);if(_0x378072[_0xc708('0x2d')]){delete _0x378072[_0xc708('0x2d')];}_0x56f992['status'](_0x1d089e)[_0xc708('0x2e')](_0x378072);};}exports[_0xc708('0x2f')]=function(_0x4595f1,_0x45c7ad){var _0x119dae={},_0x5817ad={},_0x41d499={'count':0x0,'rows':[]};var _0x25629=_[_0xc708('0x30')](db['AnalyticExtractedReport'][_0xc708('0x31')],function(_0x43289c){return{'name':_0x43289c[_0xc708('0x32')],'type':_0x43289c[_0xc708('0x33')]['key']};});_0x5817ad[_0xc708('0x34')]=_[_0xc708('0x30')](_0x25629,_0xc708('0x2d'));_0x5817ad[_0xc708('0x35')]=_[_0xc708('0x36')](_0x4595f1['query']);_0x5817ad[_0xc708('0x37')]=_[_0xc708('0x38')](_0x5817ad['model'],_0x5817ad[_0xc708('0x35')]);_0x119dae[_0xc708('0x39')]=_[_0xc708('0x38')](_0x5817ad[_0xc708('0x34')],qs[_0xc708('0x3a')](_0x4595f1[_0xc708('0x35')]['fields']));_0x119dae['attributes']=_0x119dae[_0xc708('0x39')][_0xc708('0x3b')]?_0x119dae[_0xc708('0x39')]:_0x5817ad[_0xc708('0x34')];if(!_0x4595f1[_0xc708('0x35')][_0xc708('0x3c')](_0xc708('0x3d'))){_0x119dae[_0xc708('0x20')]=qs[_0xc708('0x20')](_0x4595f1['query'][_0xc708('0x20')]);_0x119dae[_0xc708('0x21')]=qs[_0xc708('0x21')](_0x4595f1[_0xc708('0x35')]['offset']);}_0x119dae[_0xc708('0x3e')]=qs[_0xc708('0x3f')](_0x4595f1[_0xc708('0x35')][_0xc708('0x3f')]);_0x119dae[_0xc708('0x40')]=qs['filters'](_[_0xc708('0x41')](_0x4595f1['query'],_0x5817ad['filters']),_0x25629);if(_0x4595f1[_0xc708('0x35')][_0xc708('0x42')]){_0x119dae[_0xc708('0x40')]=_[_0xc708('0x43')](_0x119dae[_0xc708('0x40')],{'$or':_[_0xc708('0x30')](_0x25629,function(_0x26e01e){if(_0x26e01e['type']!==_0xc708('0x44')){var _0x5f03fe={};_0x5f03fe[_0x26e01e['name']]={'$like':'%'+_0x4595f1[_0xc708('0x35')][_0xc708('0x42')]+'%'};return _0x5f03fe;}})});}_0x119dae=_['merge']({},_0x119dae,_0x4595f1[_0xc708('0x45')]);var _0x286db4={'where':_0x119dae[_0xc708('0x40')]};return db[_0xc708('0x46')][_0xc708('0x22')](_0x286db4)[_0xc708('0x27')](function(_0xa4c5b0){_0x41d499['count']=_0xa4c5b0;if(_0x4595f1[_0xc708('0x35')][_0xc708('0x47')]){_0x119dae[_0xc708('0x48')]=[{'all':!![]}];}return db[_0xc708('0x46')][_0xc708('0x49')](_0x119dae);})[_0xc708('0x27')](function(_0x219562){_0x41d499[_0xc708('0x4a')]=_0x219562;return _0x41d499;})[_0xc708('0x27')](respondWithFilteredResult(_0x45c7ad,_0x119dae))[_0xc708('0x4b')](handleError(_0x45c7ad,null));};exports[_0xc708('0x4c')]=function(_0xd03771,_0x48dbf0){var _0x4c7096={'raw':!![],'where':{'id':_0xd03771[_0xc708('0x4d')]['id']}},_0x201302={};_0x201302[_0xc708('0x34')]=_[_0xc708('0x36')](db[_0xc708('0x46')]['rawAttributes']);_0x201302[_0xc708('0x35')]=_['keys'](_0xd03771['query']);_0x201302[_0xc708('0x37')]=_[_0xc708('0x38')](_0x201302[_0xc708('0x34')],_0x201302[_0xc708('0x35')]);_0x4c7096[_0xc708('0x39')]=_['intersection'](_0x201302[_0xc708('0x34')],qs[_0xc708('0x3a')](_0xd03771['query'][_0xc708('0x3a')]));_0x4c7096['attributes']=_0x4c7096[_0xc708('0x39')][_0xc708('0x3b')]?_0x4c7096[_0xc708('0x39')]:_0x201302['model'];if(_0xd03771['query'][_0xc708('0x47')]){_0x4c7096[_0xc708('0x48')]=[{'all':!![]}];}_0x4c7096=_[_0xc708('0x43')]({},_0x4c7096,_0xd03771['options']);return db[_0xc708('0x46')][_0xc708('0x4e')](_0x4c7096)[_0xc708('0x27')](handleEntityNotFound(_0x48dbf0,null))[_0xc708('0x27')](respondWithResult(_0x48dbf0,null))['catch'](handleError(_0x48dbf0,null));};exports['create']=function(_0x3caab0,_0x914370){return db['AnalyticExtractedReport'][_0xc708('0x4f')](_0x3caab0[_0xc708('0x50')],{})[_0xc708('0x27')](function(_0x4e375e){var _0x2b648e=_0x3caab0[_0xc708('0x51')][_0xc708('0x29')]({'plain':!![]});if(!_0x2b648e)throw new Error(_0xc708('0x52'));if(_0x2b648e[_0xc708('0x53')]===_0xc708('0x51')){var _0x4aa852=_0x4e375e[_0xc708('0x29')]({'plain':!![]});var _0x1c5a6a='ExtractedReports';return db[_0xc708('0x54')][_0xc708('0x4e')]({'where':{'name':_0x1c5a6a,'userProfileId':_0x2b648e[_0xc708('0x55')]},'raw':!![]})[_0xc708('0x27')](function(_0x3a67d1){if(_0x3a67d1&&_0x3a67d1[_0xc708('0x56')]===0x0){return db[_0xc708('0x2a')][_0xc708('0x4f')]({'name':_0x4aa852[_0xc708('0x2d')],'resourceId':_0x4aa852['id'],'type':_0x3a67d1['name'],'sectionId':_0x3a67d1['id']},{})[_0xc708('0x27')](function(){return _0x4e375e;});}else{return _0x4e375e;}})[_0xc708('0x4b')](function(_0x53e06e){logger['error'](_0xc708('0x57'),_0x53e06e);throw _0x53e06e;});}return _0x4e375e;})[_0xc708('0x27')](respondWithResult(_0x914370,0xc9))[_0xc708('0x4b')](handleError(_0x914370,null));};exports[_0xc708('0x58')]=function(_0x34cd9a,_0xa4e7e6){if(_0x34cd9a[_0xc708('0x50')]['id']){delete _0x34cd9a[_0xc708('0x50')]['id'];}return db[_0xc708('0x46')][_0xc708('0x4e')]({'where':{'id':_0x34cd9a[_0xc708('0x4d')]['id']}})[_0xc708('0x27')](handleEntityNotFound(_0xa4e7e6,null))[_0xc708('0x27')](saveUpdates(_0x34cd9a[_0xc708('0x50')],null))[_0xc708('0x27')](respondWithResult(_0xa4e7e6,null))[_0xc708('0x4b')](handleError(_0xa4e7e6,null));};exports[_0xc708('0x28')]=function(_0x4d898f,_0x28e44e){return db[_0xc708('0x46')][_0xc708('0x4e')]({'where':{'id':_0x4d898f[_0xc708('0x4d')]['id']}})[_0xc708('0x27')](handleEntityNotFound(_0x28e44e,null))[_0xc708('0x27')](removeEntity(_0x28e44e,null))[_0xc708('0x4b')](handleError(_0x28e44e,null));};exports[_0xc708('0x59')]=function(_0x472092,_0x4b2775,_0x3eda18){return db[_0xc708('0x46')][_0xc708('0x4e')]({'where':{'id':_0x472092[_0xc708('0x4d')]['id']},'attributes':[_0xc708('0x2d'),_0xc708('0x5a'),'savename',_0xc708('0x5b')],'raw':!![]})[_0xc708('0x27')](handleEntityNotFound(_0x4b2775,null))[_0xc708('0x27')](function(_0x33d822){if(_0x33d822){if(!fs['existsSync'](path['join'](config[_0xc708('0x5c')],'server/files/reports',_0x33d822[_0xc708('0x5d')]))){throw new db[(_0xc708('0x5e'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x472092[_0xc708('0x35')]['exists']){return _0x4b2775[_0xc708('0x1b')](0xc8);}return _0x4b2775[_0xc708('0x59')](path[_0xc708('0x5f')](config[_0xc708('0x5c')],'server/files/reports',_0x33d822['savename']),util[_0xc708('0x60')](_0xc708('0x61'),_0x33d822['basename']||_0x33d822[_0xc708('0x2d')],_0x33d822['output'][_0xc708('0x62')]()));}})[_0xc708('0x4b')](handleError(_0x4b2775,null));};
\ No newline at end of file