Built motion from commit (unavailable).|2.5.12
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index b8a120b..05f6b01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca66=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','findAll','rows','catch','show','params','find','create','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xca66,0x8b));var _0x6ca6=function(_0x168386,_0x5789b4){_0x168386=_0x168386-0x0;var _0x2a6a9b=_0xca66[_0x168386];return _0x2a6a9b;};'use strict';var pdf=require(_0x6ca6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ca6('0x1'));var jsonpatch=require(_0x6ca6('0x2'));var rp=require(_0x6ca6('0x3'));var moment=require('moment');var BPromise=require(_0x6ca6('0x4'));var Mustache=require('mustache');var util=require(_0x6ca6('0x5'));var path=require('path');var sox=require(_0x6ca6('0x6'));var csv=require(_0x6ca6('0x7'));var ejs=require(_0x6ca6('0x8'));var fs=require('fs');var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x7'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=_0x36ff3e[_0x6ca6('0x1b')],_0x260b56=_0x5785b1[_0x6ca6('0x1c')],_0x3f03e6=_0x5785b1['offset']+_0x5785b1[_0x6ca6('0x1d')],_0x2c4a5c;if(_0x3f03e6>=_0x19e94f){_0x3f03e6=_0x19e94f;_0x2c4a5c=0xc8;}else{_0x2c4a5c=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x2c4a5c);return _0x52c59a[_0x6ca6('0x1e')](_0x6ca6('0x1f'),_0x260b56+'-'+_0x3f03e6+'/'+_0x19e94f)[_0x6ca6('0x20')](_0x36ff3e);}return null;};}function patchUpdates(_0x2b0a8c){return function(_0x16a3d7){try{jsonpatch[_0x6ca6('0x21')](_0x16a3d7,_0x2b0a8c,!![]);}catch(_0x3a4aa1){return BPromise[_0x6ca6('0x22')](_0x3a4aa1);}return _0x16a3d7[_0x6ca6('0x23')]();};}function saveUpdates(_0x4c3be9,_0x28a982){return function(_0x254afe){if(_0x254afe){return _0x254afe[_0x6ca6('0x24')](_0x4c3be9)[_0x6ca6('0x25')](function(_0x3a24aa){return _0x3a24aa;});}return null;};}function removeEntity(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x26')]()['then'](function(){var _0x4927c1=_0xfb962d[_0x6ca6('0x27')]({'plain':!![]});var _0x216701=_0x6ca6('0x28');return db[_0x6ca6('0x29')][_0x6ca6('0x26')]({'where':{'type':_0x216701,'resourceId':_0x4927c1['id']}})['then'](function(){return _0xfb962d;});})[_0x6ca6('0x25')](function(){_0x438694[_0x6ca6('0x19')](0xcc)[_0x6ca6('0x1a')]();});}};}function handleEntityNotFound(_0x2d8c64,_0x3971a2){return function(_0x29f37e){if(!_0x29f37e){_0x2d8c64[_0x6ca6('0x2a')](0x194);}return _0x29f37e;};}function handleError(_0x2a1e2d,_0x516daf){_0x516daf=_0x516daf||0x1f4;return function(_0x55b07f){logger[_0x6ca6('0x2b')](_0x55b07f[_0x6ca6('0x2c')]);if(_0x55b07f[_0x6ca6('0x2d')]){delete _0x55b07f[_0x6ca6('0x2d')];}_0x2a1e2d['status'](_0x516daf)['send'](_0x55b07f);};}exports[_0x6ca6('0x2e')]=function(_0x47cf48,_0x4ab84c){var _0x141e78={},_0xefd407={},_0x4a15cb={'count':0x0,'rows':[]};var _0x50aa5a=_[_0x6ca6('0x2f')](db[_0x6ca6('0x30')][_0x6ca6('0x31')],function(_0x484411){return{'name':_0x484411[_0x6ca6('0x32')],'type':_0x484411[_0x6ca6('0x33')][_0x6ca6('0x34')]};});_0xefd407[_0x6ca6('0x35')]=_['map'](_0x50aa5a,_0x6ca6('0x2d'));_0xefd407[_0x6ca6('0x36')]=_[_0x6ca6('0x37')](_0x47cf48[_0x6ca6('0x36')]);_0xefd407['filters']=_['intersection'](_0xefd407['model'],_0xefd407['query']);_0x141e78['attributes']=_[_0x6ca6('0x38')](_0xefd407[_0x6ca6('0x35')],qs[_0x6ca6('0x39')](_0x47cf48['query'][_0x6ca6('0x39')]));_0x141e78[_0x6ca6('0x3a')]=_0x141e78[_0x6ca6('0x3a')][_0x6ca6('0x3b')]?_0x141e78['attributes']:_0xefd407[_0x6ca6('0x35')];if(!_0x47cf48[_0x6ca6('0x36')][_0x6ca6('0x3c')](_0x6ca6('0x3d'))){_0x141e78['limit']=qs[_0x6ca6('0x1d')](_0x47cf48['query'][_0x6ca6('0x1d')]);_0x141e78['offset']=qs['offset'](_0x47cf48[_0x6ca6('0x36')][_0x6ca6('0x1c')]);}_0x141e78[_0x6ca6('0x3e')]=qs[_0x6ca6('0x3f')](_0x47cf48['query']['sort']);_0x141e78[_0x6ca6('0x40')]=qs[_0x6ca6('0x41')](_['pick'](_0x47cf48[_0x6ca6('0x36')],_0xefd407['filters']),_0x50aa5a);if(_0x47cf48[_0x6ca6('0x36')]['filter']){_0x141e78[_0x6ca6('0x40')]=_[_0x6ca6('0x42')](_0x141e78[_0x6ca6('0x40')],{'$or':_[_0x6ca6('0x2f')](_0x50aa5a,function(_0x33b5e6){if(_0x33b5e6[_0x6ca6('0x33')]!==_0x6ca6('0x43')){var _0x204f4e={};_0x204f4e[_0x33b5e6['name']]={'$like':'%'+_0x47cf48[_0x6ca6('0x36')]['filter']+'%'};return _0x204f4e;}})});}_0x141e78=_['merge']({},_0x141e78,_0x47cf48[_0x6ca6('0x44')]);var _0x306eda={'where':_0x141e78['where']};return db[_0x6ca6('0x30')]['count'](_0x306eda)[_0x6ca6('0x25')](function(_0x90eab7){_0x4a15cb[_0x6ca6('0x1b')]=_0x90eab7;if(_0x47cf48[_0x6ca6('0x36')]['includeAll']){_0x141e78['include']=[{'all':!![]}];}return db[_0x6ca6('0x30')][_0x6ca6('0x45')](_0x141e78);})[_0x6ca6('0x25')](function(_0x3423e2){_0x4a15cb[_0x6ca6('0x46')]=_0x3423e2;return _0x4a15cb;})['then'](respondWithFilteredResult(_0x4ab84c,_0x141e78))[_0x6ca6('0x47')](handleError(_0x4ab84c,null));};exports[_0x6ca6('0x48')]=function(_0x5bed6e,_0x317b5e){var _0x3b60db={'raw':!![],'where':{'id':_0x5bed6e[_0x6ca6('0x49')]['id']}},_0x323051={};_0x323051[_0x6ca6('0x35')]=_[_0x6ca6('0x37')](db[_0x6ca6('0x30')][_0x6ca6('0x31')]);_0x323051[_0x6ca6('0x36')]=_['keys'](_0x5bed6e[_0x6ca6('0x36')]);_0x323051[_0x6ca6('0x41')]=_[_0x6ca6('0x38')](_0x323051[_0x6ca6('0x35')],_0x323051[_0x6ca6('0x36')]);_0x3b60db[_0x6ca6('0x3a')]=_[_0x6ca6('0x38')](_0x323051[_0x6ca6('0x35')],qs['fields'](_0x5bed6e['query'][_0x6ca6('0x39')]));_0x3b60db[_0x6ca6('0x3a')]=_0x3b60db[_0x6ca6('0x3a')][_0x6ca6('0x3b')]?_0x3b60db[_0x6ca6('0x3a')]:_0x323051[_0x6ca6('0x35')];if(_0x5bed6e[_0x6ca6('0x36')]['includeAll']){_0x3b60db['include']=[{'all':!![]}];}_0x3b60db=_[_0x6ca6('0x42')]({},_0x3b60db,_0x5bed6e[_0x6ca6('0x44')]);return db['AnalyticExtractedReport'][_0x6ca6('0x4a')](_0x3b60db)[_0x6ca6('0x25')](handleEntityNotFound(_0x317b5e,null))[_0x6ca6('0x25')](respondWithResult(_0x317b5e,null))[_0x6ca6('0x47')](handleError(_0x317b5e,null));};exports[_0x6ca6('0x4b')]=function(_0x3c76f7,_0x13efc1){return db['AnalyticExtractedReport'][_0x6ca6('0x4b')](_0x3c76f7[_0x6ca6('0x4c')],{})[_0x6ca6('0x25')](function(_0x4fde51){var _0x408df3=_0x3c76f7['user'][_0x6ca6('0x27')]({'plain':!![]});if(!_0x408df3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x408df3['role']==='user'){var _0x199489=_0x4fde51[_0x6ca6('0x27')]({'plain':!![]});var _0x2177c4='ExtractedReports';return db[_0x6ca6('0x4d')]['find']({'where':{'name':_0x2177c4,'userProfileId':_0x408df3[_0x6ca6('0x4e')]},'raw':!![]})[_0x6ca6('0x25')](function(_0xe0b775){if(_0xe0b775&&_0xe0b775[_0x6ca6('0x4f')]===0x0){return db[_0x6ca6('0x29')][_0x6ca6('0x4b')]({'name':_0x199489[_0x6ca6('0x2d')],'resourceId':_0x199489['id'],'type':_0xe0b775[_0x6ca6('0x2d')],'sectionId':_0xe0b775['id']},{})[_0x6ca6('0x25')](function(){return _0x4fde51;});}else{return _0x4fde51;}})[_0x6ca6('0x47')](function(_0x321f41){logger['error'](_0x6ca6('0x50'),_0x321f41);throw _0x321f41;});}return _0x4fde51;})[_0x6ca6('0x25')](respondWithResult(_0x13efc1,0xc9))[_0x6ca6('0x47')](handleError(_0x13efc1,null));};exports[_0x6ca6('0x24')]=function(_0x11fda2,_0x594209){if(_0x11fda2[_0x6ca6('0x4c')]['id']){delete _0x11fda2[_0x6ca6('0x4c')]['id'];}return db[_0x6ca6('0x30')]['find']({'where':{'id':_0x11fda2['params']['id']}})['then'](handleEntityNotFound(_0x594209,null))['then'](saveUpdates(_0x11fda2[_0x6ca6('0x4c')],null))[_0x6ca6('0x25')](respondWithResult(_0x594209,null))[_0x6ca6('0x47')](handleError(_0x594209,null));};exports['destroy']=function(_0x4d3aa0,_0x387adf){return db[_0x6ca6('0x30')][_0x6ca6('0x4a')]({'where':{'id':_0x4d3aa0['params']['id']}})[_0x6ca6('0x25')](handleEntityNotFound(_0x387adf,null))['then'](removeEntity(_0x387adf,null))[_0x6ca6('0x47')](handleError(_0x387adf,null));};exports[_0x6ca6('0x51')]=function(_0x20c63d,_0x16af08,_0x511eb1){return db[_0x6ca6('0x30')]['find']({'where':{'id':_0x20c63d['params']['id']},'attributes':[_0x6ca6('0x2d'),_0x6ca6('0x52'),_0x6ca6('0x53'),_0x6ca6('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x16af08,null))[_0x6ca6('0x25')](function(_0x1c12ae){if(_0x1c12ae){if(!fs[_0x6ca6('0x55')](path[_0x6ca6('0x56')](config[_0x6ca6('0x57')],_0x6ca6('0x58'),_0x1c12ae[_0x6ca6('0x53')]))){throw new db[(_0x6ca6('0x59'))][(_0x6ca6('0x5a'))](_0x6ca6('0x5b'));}if(_0x20c63d[_0x6ca6('0x36')][_0x6ca6('0x5c')]){return _0x16af08[_0x6ca6('0x2a')](0xc8);}return _0x16af08[_0x6ca6('0x51')](path[_0x6ca6('0x56')](config[_0x6ca6('0x57')],'server/files/reports',_0x1c12ae[_0x6ca6('0x53')]),util[_0x6ca6('0x5d')](_0x6ca6('0x5e'),_0x1c12ae[_0x6ca6('0x52')]||_0x1c12ae[_0x6ca6('0x2d')],_0x1c12ae[_0x6ca6('0x54')][_0x6ca6('0x5f')]()));}})[_0x6ca6('0x47')](handleError(_0x16af08,null));};
\ No newline at end of file
+var _0x6f73=['get','UserProfileResource','end','error','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','intersection','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x6f73,0x164));var _0x36f7=function(_0xd2c445,_0x3c5b7f){_0xd2c445=_0xd2c445-0x0;var _0x215bf7=_0x6f73[_0xd2c445];return _0x215bf7;};'use strict';var pdf=require(_0x36f7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x36f7('0x1'));var zipdir=require(_0x36f7('0x2'));var jsonpatch=require(_0x36f7('0x3'));var rp=require(_0x36f7('0x4'));var moment=require('moment');var BPromise=require(_0x36f7('0x5'));var Mustache=require(_0x36f7('0x6'));var util=require(_0x36f7('0x7'));var path=require(_0x36f7('0x8'));var sox=require('sox');var csv=require(_0x36f7('0x9'));var ejs=require(_0x36f7('0xa'));var fs=require('fs');var _=require(_0x36f7('0xb'));var squel=require(_0x36f7('0xc'));var crypto=require(_0x36f7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x36f7('0xe'));var toCsv=require(_0x36f7('0x9'));var querystring=require(_0x36f7('0xf'));var Papa=require(_0x36f7('0x10'));var Redis=require(_0x36f7('0x11'));var authService=require(_0x36f7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x36f7('0x13'))('api');var utils=require(_0x36f7('0x14'));var config=require(_0x36f7('0x15'));var licenseUtil=require(_0x36f7('0x16'));var db=require(_0x36f7('0x17'))['db'];function respondWithStatusCode(_0x243084,_0x1c3271){_0x1c3271=_0x1c3271||0xcc;return function(_0x1fb13e){if(_0x1fb13e){return _0x243084[_0x36f7('0x18')](_0x1c3271);}return _0x243084[_0x36f7('0x19')](_0x1c3271)['end']();};}function respondWithResult(_0x422d9f,_0x256836){_0x256836=_0x256836||0xc8;return function(_0x3dfca8){if(_0x3dfca8){return _0x422d9f[_0x36f7('0x19')](_0x256836)[_0x36f7('0x1a')](_0x3dfca8);}};}function respondWithFilteredResult(_0xe500c7,_0x34f7bc){return function(_0x664a72){if(_0x664a72){var _0x35694e=_0x664a72[_0x36f7('0x1b')],_0x34a889=_0x34f7bc[_0x36f7('0x1c')],_0x3b3b99=_0x34f7bc[_0x36f7('0x1c')]+_0x34f7bc['limit'],_0x3d300c;if(_0x3b3b99>=_0x35694e){_0x3b3b99=_0x35694e;_0x3d300c=0xc8;}else{_0x3d300c=0xce;}_0xe500c7[_0x36f7('0x19')](_0x3d300c);return _0xe500c7['set'](_0x36f7('0x1d'),_0x34a889+'-'+_0x3b3b99+'/'+_0x35694e)[_0x36f7('0x1a')](_0x664a72);}return null;};}function patchUpdates(_0x1761c4){return function(_0x5ba3ce){try{jsonpatch[_0x36f7('0x1e')](_0x5ba3ce,_0x1761c4,!![]);}catch(_0xad4527){return BPromise[_0x36f7('0x1f')](_0xad4527);}return _0x5ba3ce[_0x36f7('0x20')]();};}function saveUpdates(_0xf27351,_0x2672e6){return function(_0x497870){if(_0x497870){return _0x497870[_0x36f7('0x21')](_0xf27351)['then'](function(_0x318db1){return _0x318db1;});}return null;};}function removeEntity(_0xce2c4c,_0x44a956){return function(_0x12b270){if(_0x12b270){return _0x12b270[_0x36f7('0x22')]()[_0x36f7('0x23')](function(){var _0x318fa1=_0x12b270[_0x36f7('0x24')]({'plain':!![]});var _0x17b0dc='ExtractedReports';return db[_0x36f7('0x25')][_0x36f7('0x22')]({'where':{'type':_0x17b0dc,'resourceId':_0x318fa1['id']}})[_0x36f7('0x23')](function(){return _0x12b270;});})[_0x36f7('0x23')](function(){_0xce2c4c[_0x36f7('0x19')](0xcc)[_0x36f7('0x26')]();});}};}function handleEntityNotFound(_0x2be592,_0x3854c5){return function(_0x547629){if(!_0x547629){_0x2be592[_0x36f7('0x18')](0x194);}return _0x547629;};}function handleError(_0x271547,_0x359821){_0x359821=_0x359821||0x1f4;return function(_0x5581fe){logger[_0x36f7('0x27')](_0x5581fe['stack']);if(_0x5581fe[_0x36f7('0x28')]){delete _0x5581fe[_0x36f7('0x28')];}_0x271547[_0x36f7('0x19')](_0x359821)[_0x36f7('0x29')](_0x5581fe);};}exports[_0x36f7('0x2a')]=function(_0x4f2254,_0x139bfa){var _0x5ba7c2={},_0x5288e3={},_0x1e6fae={'count':0x0,'rows':[]};var _0x1744ec=_['map'](db[_0x36f7('0x2b')][_0x36f7('0x2c')],function(_0x2a5e3d){return{'name':_0x2a5e3d[_0x36f7('0x2d')],'type':_0x2a5e3d[_0x36f7('0x2e')][_0x36f7('0x2f')]};});_0x5288e3[_0x36f7('0x30')]=_['map'](_0x1744ec,_0x36f7('0x28'));_0x5288e3[_0x36f7('0x31')]=_[_0x36f7('0x32')](_0x4f2254['query']);_0x5288e3[_0x36f7('0x33')]=_['intersection'](_0x5288e3[_0x36f7('0x30')],_0x5288e3[_0x36f7('0x31')]);_0x5ba7c2[_0x36f7('0x34')]=_['intersection'](_0x5288e3[_0x36f7('0x30')],qs[_0x36f7('0x35')](_0x4f2254[_0x36f7('0x31')][_0x36f7('0x35')]));_0x5ba7c2[_0x36f7('0x34')]=_0x5ba7c2[_0x36f7('0x34')][_0x36f7('0x36')]?_0x5ba7c2[_0x36f7('0x34')]:_0x5288e3['model'];if(!_0x4f2254[_0x36f7('0x31')][_0x36f7('0x37')](_0x36f7('0x38'))){_0x5ba7c2[_0x36f7('0x39')]=qs['limit'](_0x4f2254[_0x36f7('0x31')][_0x36f7('0x39')]);_0x5ba7c2[_0x36f7('0x1c')]=qs[_0x36f7('0x1c')](_0x4f2254[_0x36f7('0x31')]['offset']);}_0x5ba7c2[_0x36f7('0x3a')]=qs[_0x36f7('0x3b')](_0x4f2254['query'][_0x36f7('0x3b')]);_0x5ba7c2[_0x36f7('0x3c')]=qs['filters'](_[_0x36f7('0x3d')](_0x4f2254['query'],_0x5288e3[_0x36f7('0x33')]),_0x1744ec);if(_0x4f2254[_0x36f7('0x31')]['filter']){_0x5ba7c2[_0x36f7('0x3c')]=_['merge'](_0x5ba7c2[_0x36f7('0x3c')],{'$or':_['map'](_0x1744ec,function(_0x18560e){if(_0x18560e['type']!==_0x36f7('0x3e')){var _0x3188be={};_0x3188be[_0x18560e[_0x36f7('0x28')]]={'$like':'%'+_0x4f2254[_0x36f7('0x31')][_0x36f7('0x3f')]+'%'};return _0x3188be;}})});}_0x5ba7c2=_[_0x36f7('0x40')]({},_0x5ba7c2,_0x4f2254[_0x36f7('0x41')]);var _0x45ffad={'where':_0x5ba7c2[_0x36f7('0x3c')]};return db['AnalyticExtractedReport'][_0x36f7('0x1b')](_0x45ffad)['then'](function(_0x37d45e){_0x1e6fae['count']=_0x37d45e;if(_0x4f2254[_0x36f7('0x31')][_0x36f7('0x42')]){_0x5ba7c2['include']=[{'all':!![]}];}return db[_0x36f7('0x2b')][_0x36f7('0x43')](_0x5ba7c2);})[_0x36f7('0x23')](function(_0x4f0a29){_0x1e6fae[_0x36f7('0x44')]=_0x4f0a29;return _0x1e6fae;})[_0x36f7('0x23')](respondWithFilteredResult(_0x139bfa,_0x5ba7c2))['catch'](handleError(_0x139bfa,null));};exports[_0x36f7('0x45')]=function(_0x484c8f,_0x5b17a5){var _0x3ed35e={'raw':!![],'where':{'id':_0x484c8f[_0x36f7('0x46')]['id']}},_0xc5cadf={};_0xc5cadf[_0x36f7('0x30')]=_[_0x36f7('0x32')](db[_0x36f7('0x2b')][_0x36f7('0x2c')]);_0xc5cadf['query']=_['keys'](_0x484c8f[_0x36f7('0x31')]);_0xc5cadf[_0x36f7('0x33')]=_['intersection'](_0xc5cadf[_0x36f7('0x30')],_0xc5cadf[_0x36f7('0x31')]);_0x3ed35e[_0x36f7('0x34')]=_[_0x36f7('0x47')](_0xc5cadf['model'],qs[_0x36f7('0x35')](_0x484c8f[_0x36f7('0x31')][_0x36f7('0x35')]));_0x3ed35e[_0x36f7('0x34')]=_0x3ed35e[_0x36f7('0x34')][_0x36f7('0x36')]?_0x3ed35e[_0x36f7('0x34')]:_0xc5cadf[_0x36f7('0x30')];if(_0x484c8f[_0x36f7('0x31')][_0x36f7('0x42')]){_0x3ed35e['include']=[{'all':!![]}];}_0x3ed35e=_[_0x36f7('0x40')]({},_0x3ed35e,_0x484c8f[_0x36f7('0x41')]);return db['AnalyticExtractedReport'][_0x36f7('0x48')](_0x3ed35e)[_0x36f7('0x23')](handleEntityNotFound(_0x5b17a5,null))[_0x36f7('0x23')](respondWithResult(_0x5b17a5,null))[_0x36f7('0x49')](handleError(_0x5b17a5,null));};exports[_0x36f7('0x4a')]=function(_0x4d0b42,_0xfd6dab){return db[_0x36f7('0x2b')][_0x36f7('0x4a')](_0x4d0b42['body'],{})['then'](function(_0x54786e){var _0x3bd0bc=_0x4d0b42[_0x36f7('0x4b')][_0x36f7('0x24')]({'plain':!![]});if(!_0x3bd0bc)throw new Error(_0x36f7('0x4c'));if(_0x3bd0bc[_0x36f7('0x4d')]==='user'){var _0x26c67d=_0x54786e[_0x36f7('0x24')]({'plain':!![]});var _0x1d0d55=_0x36f7('0x4e');return db[_0x36f7('0x4f')][_0x36f7('0x48')]({'where':{'name':_0x1d0d55,'userProfileId':_0x3bd0bc[_0x36f7('0x50')]},'raw':!![]})[_0x36f7('0x23')](function(_0x22ebcc){if(_0x22ebcc&&_0x22ebcc[_0x36f7('0x51')]===0x0){return db['UserProfileResource'][_0x36f7('0x4a')]({'name':_0x26c67d[_0x36f7('0x28')],'resourceId':_0x26c67d['id'],'type':_0x22ebcc[_0x36f7('0x28')],'sectionId':_0x22ebcc['id']},{})[_0x36f7('0x23')](function(){return _0x54786e;});}else{return _0x54786e;}})['catch'](function(_0x265496){logger['error'](_0x36f7('0x52'),_0x265496);throw _0x265496;});}return _0x54786e;})['then'](respondWithResult(_0xfd6dab,0xc9))[_0x36f7('0x49')](handleError(_0xfd6dab,null));};exports['update']=function(_0x304210,_0x59aed2){if(_0x304210['body']['id']){delete _0x304210[_0x36f7('0x53')]['id'];}return db['AnalyticExtractedReport'][_0x36f7('0x48')]({'where':{'id':_0x304210[_0x36f7('0x46')]['id']}})[_0x36f7('0x23')](handleEntityNotFound(_0x59aed2,null))[_0x36f7('0x23')](saveUpdates(_0x304210[_0x36f7('0x53')],null))['then'](respondWithResult(_0x59aed2,null))[_0x36f7('0x49')](handleError(_0x59aed2,null));};exports[_0x36f7('0x22')]=function(_0x7d4d44,_0x3a7869){return db[_0x36f7('0x2b')][_0x36f7('0x48')]({'where':{'id':_0x7d4d44[_0x36f7('0x46')]['id']}})[_0x36f7('0x23')](handleEntityNotFound(_0x3a7869,null))[_0x36f7('0x23')](removeEntity(_0x3a7869,null))[_0x36f7('0x49')](handleError(_0x3a7869,null));};exports[_0x36f7('0x54')]=function(_0x595c2f,_0x308e67,_0x22eddb){return db[_0x36f7('0x2b')]['find']({'where':{'id':_0x595c2f[_0x36f7('0x46')]['id']},'attributes':[_0x36f7('0x28'),_0x36f7('0x55'),_0x36f7('0x56'),_0x36f7('0x57')],'raw':!![]})[_0x36f7('0x23')](handleEntityNotFound(_0x308e67,null))['then'](function(_0x4bf118){if(_0x4bf118){if(!fs[_0x36f7('0x58')](path[_0x36f7('0x59')](config['root'],_0x36f7('0x5a'),_0x4bf118[_0x36f7('0x56')]))){throw new db[(_0x36f7('0x5b'))]['ValidationError'](_0x36f7('0x5c'));}if(_0x595c2f['query'][_0x36f7('0x5d')]){return _0x308e67[_0x36f7('0x18')](0xc8);}return _0x308e67['download'](path['join'](config[_0x36f7('0x5e')],_0x36f7('0x5a'),_0x4bf118[_0x36f7('0x56')]),util[_0x36f7('0x5f')](_0x36f7('0x60'),_0x4bf118[_0x36f7('0x55')]||_0x4bf118[_0x36f7('0x28')],_0x4bf118[_0x36f7('0x57')][_0x36f7('0x61')]()));}})[_0x36f7('0x49')](handleError(_0x308e67,null));};
\ No newline at end of file