Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index b7be1e9..e512956 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 _0xf2d3=['undefined','limit','count','set','Content-Range','reject','update','destroy','then','get','ExtractedReports','UserProfileResource','status','sendStatus','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','create','body','role','user','UserProfileSection','userProfileId','download','savename','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','basename','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset'];(function(_0x32e3ca,_0x2045cf){var _0x279952=function(_0x31c4cd){while(--_0x31c4cd){_0x32e3ca['push'](_0x32e3ca['shift']());}};_0x279952(++_0x2045cf);}(_0xf2d3,0xff));var _0x3f2d=function(_0x50d8cd,_0x471c05){_0x50d8cd=_0x50d8cd-0x0;var _0xbd9dae=_0xf2d3[_0x50d8cd];return _0xbd9dae;};'use strict';var emlformat=require(_0x3f2d('0x0'));var rimraf=require(_0x3f2d('0x1'));var zipdir=require(_0x3f2d('0x2'));var jsonpatch=require(_0x3f2d('0x3'));var rp=require(_0x3f2d('0x4'));var moment=require('moment');var BPromise=require(_0x3f2d('0x5'));var Mustache=require('mustache');var util=require(_0x3f2d('0x6'));var path=require(_0x3f2d('0x7'));var sox=require(_0x3f2d('0x8'));var csv=require(_0x3f2d('0x9'));var ejs=require(_0x3f2d('0xa'));var fs=require('fs');var fs_extra=require(_0x3f2d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f2d('0xc'));var jsforce=require(_0x3f2d('0xd'));var deskjs=require(_0x3f2d('0xe'));var toCsv=require(_0x3f2d('0x9'));var querystring=require(_0x3f2d('0xf'));var Papa=require(_0x3f2d('0x10'));var Redis=require('ioredis');var authService=require(_0x3f2d('0x11'));var qs=require(_0x3f2d('0x12'));var as=require(_0x3f2d('0x13'));var hardwareService=require(_0x3f2d('0x14'));var logger=require(_0x3f2d('0x15'))(_0x3f2d('0x16'));var utils=require(_0x3f2d('0x17'));var config=require(_0x3f2d('0x18'));var licenseUtil=require(_0x3f2d('0x19'));var db=require(_0x3f2d('0x1a'))['db'];function respondWithStatusCode(_0x59455a,_0x35b953){_0x35b953=_0x35b953||0xcc;return function(_0x1fc48f){if(_0x1fc48f){return _0x59455a['sendStatus'](_0x35b953);}return _0x59455a['status'](_0x35b953)[_0x3f2d('0x1b')]();};}function respondWithResult(_0x4adb63,_0x17d69a){_0x17d69a=_0x17d69a||0xc8;return function(_0x5ce2ce){if(_0x5ce2ce){return _0x4adb63['status'](_0x17d69a)[_0x3f2d('0x1c')](_0x5ce2ce);}};}function respondWithFilteredResult(_0x1f7597,_0xcc881){return function(_0x4ad4fa){if(_0x4ad4fa){var _0x454d7d=typeof _0xcc881[_0x3f2d('0x1d')]===_0x3f2d('0x1e')&&typeof _0xcc881[_0x3f2d('0x1f')]==='undefined';var _0x23feb0=_0x4ad4fa[_0x3f2d('0x20')];var _0x23feb1=_0x454d7d?0x0:_0xcc881[_0x3f2d('0x1d')];var _0x274159=_0x454d7d?_0x4ad4fa['count']:_0xcc881[_0x3f2d('0x1d')]+_0xcc881[_0x3f2d('0x1f')];var _0x4b3a4b;if(_0x274159>=_0x23feb0){_0x274159=_0x23feb0;_0x4b3a4b=0xc8;}else{_0x4b3a4b=0xce;}_0x1f7597['status'](_0x4b3a4b);return _0x1f7597[_0x3f2d('0x21')](_0x3f2d('0x22'),_0x23feb1+'-'+_0x274159+'/'+_0x23feb0)[_0x3f2d('0x1c')](_0x4ad4fa);}return null;};}function patchUpdates(_0x44d418){return function(_0x1153b3){try{jsonpatch['apply'](_0x1153b3,_0x44d418,!![]);}catch(_0xd7fe4d){return BPromise[_0x3f2d('0x23')](_0xd7fe4d);}return _0x1153b3['save']();};}function saveUpdates(_0x5e876c,_0x351b6c){return function(_0x205657){if(_0x205657){return _0x205657[_0x3f2d('0x24')](_0x5e876c)['then'](function(_0x9cd9f0){return _0x9cd9f0;});}return null;};}function removeEntity(_0x14b20d,_0x2d93a3){return function(_0x3ecc70){if(_0x3ecc70){return _0x3ecc70[_0x3f2d('0x25')]()[_0x3f2d('0x26')](function(){var _0x49bf88=_0x3ecc70[_0x3f2d('0x27')]({'plain':!![]});var _0x18a971=_0x3f2d('0x28');return db[_0x3f2d('0x29')][_0x3f2d('0x25')]({'where':{'type':_0x18a971,'resourceId':_0x49bf88['id']}})['then'](function(){return _0x3ecc70;});})[_0x3f2d('0x26')](function(){_0x14b20d[_0x3f2d('0x2a')](0xcc)[_0x3f2d('0x1b')]();});}};}function handleEntityNotFound(_0xa8a9d,_0x10854e){return function(_0x2d9fc5){if(!_0x2d9fc5){_0xa8a9d[_0x3f2d('0x2b')](0x194);}return _0x2d9fc5;};}function handleError(_0x23ee64,_0x447e0b){_0x447e0b=_0x447e0b||0x1f4;return function(_0x26b4f8){logger['error'](_0x26b4f8['stack']);if(_0x26b4f8[_0x3f2d('0x2c')]){delete _0x26b4f8[_0x3f2d('0x2c')];}_0x23ee64[_0x3f2d('0x2a')](_0x447e0b)[_0x3f2d('0x2d')](_0x26b4f8);};}exports[_0x3f2d('0x2e')]=function(_0x430f31,_0x5a3a5f){var _0x3cbe1f={},_0x214023={},_0x24d61f={'count':0x0,'rows':[]};var _0x47bd00=_[_0x3f2d('0x2f')](db[_0x3f2d('0x30')][_0x3f2d('0x31')],function(_0x5baa0c){return{'name':_0x5baa0c[_0x3f2d('0x32')],'type':_0x5baa0c[_0x3f2d('0x33')]['key']};});_0x214023[_0x3f2d('0x34')]=_[_0x3f2d('0x2f')](_0x47bd00,_0x3f2d('0x2c'));_0x214023[_0x3f2d('0x35')]=_[_0x3f2d('0x36')](_0x430f31[_0x3f2d('0x35')]);_0x214023['filters']=_[_0x3f2d('0x37')](_0x214023['model'],_0x214023[_0x3f2d('0x35')]);_0x3cbe1f[_0x3f2d('0x38')]=_['intersection'](_0x214023['model'],qs[_0x3f2d('0x39')](_0x430f31[_0x3f2d('0x35')][_0x3f2d('0x39')]));_0x3cbe1f[_0x3f2d('0x38')]=_0x3cbe1f[_0x3f2d('0x38')][_0x3f2d('0x3a')]?_0x3cbe1f[_0x3f2d('0x38')]:_0x214023['model'];if(!_0x430f31['query']['hasOwnProperty'](_0x3f2d('0x3b'))){_0x3cbe1f[_0x3f2d('0x1f')]=qs['limit'](_0x430f31['query'][_0x3f2d('0x1f')]);_0x3cbe1f['offset']=qs[_0x3f2d('0x1d')](_0x430f31[_0x3f2d('0x35')][_0x3f2d('0x1d')]);}_0x3cbe1f[_0x3f2d('0x3c')]=qs[_0x3f2d('0x3d')](_0x430f31[_0x3f2d('0x35')][_0x3f2d('0x3d')]);_0x3cbe1f[_0x3f2d('0x3e')]=qs[_0x3f2d('0x3f')](_[_0x3f2d('0x40')](_0x430f31[_0x3f2d('0x35')],_0x214023[_0x3f2d('0x3f')]),_0x47bd00);if(_0x430f31['query'][_0x3f2d('0x41')]){_0x3cbe1f[_0x3f2d('0x3e')]=_[_0x3f2d('0x42')](_0x3cbe1f['where'],{'$or':_[_0x3f2d('0x2f')](_0x47bd00,function(_0x3d9501){if(_0x3d9501[_0x3f2d('0x33')]!==_0x3f2d('0x43')){var _0x4ae66d={};_0x4ae66d[_0x3d9501[_0x3f2d('0x2c')]]={'$like':'%'+_0x430f31[_0x3f2d('0x35')][_0x3f2d('0x41')]+'%'};return _0x4ae66d;}})});}_0x3cbe1f=_['merge']({},_0x3cbe1f,_0x430f31[_0x3f2d('0x44')]);var _0x234cac={'where':_0x3cbe1f['where']};return db[_0x3f2d('0x30')][_0x3f2d('0x20')](_0x234cac)[_0x3f2d('0x26')](function(_0x1c4e43){_0x24d61f['count']=_0x1c4e43;if(_0x430f31[_0x3f2d('0x35')][_0x3f2d('0x45')]){_0x3cbe1f[_0x3f2d('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x3cbe1f);})[_0x3f2d('0x26')](function(_0x40e323){_0x24d61f['rows']=_0x40e323;return _0x24d61f;})['then'](respondWithFilteredResult(_0x5a3a5f,_0x3cbe1f))['catch'](handleError(_0x5a3a5f,null));};exports['show']=function(_0x3769e2,_0x270f4f){var _0x2c989c={'raw':!![],'where':{'id':_0x3769e2[_0x3f2d('0x47')]['id']}},_0x57be4b={};_0x57be4b['model']=_[_0x3f2d('0x36')](db['AnalyticExtractedReport']['rawAttributes']);_0x57be4b[_0x3f2d('0x35')]=_['keys'](_0x3769e2[_0x3f2d('0x35')]);_0x57be4b[_0x3f2d('0x3f')]=_[_0x3f2d('0x37')](_0x57be4b['model'],_0x57be4b['query']);_0x2c989c[_0x3f2d('0x38')]=_[_0x3f2d('0x37')](_0x57be4b[_0x3f2d('0x34')],qs[_0x3f2d('0x39')](_0x3769e2[_0x3f2d('0x35')]['fields']));_0x2c989c[_0x3f2d('0x38')]=_0x2c989c[_0x3f2d('0x38')]['length']?_0x2c989c['attributes']:_0x57be4b['model'];if(_0x3769e2[_0x3f2d('0x35')][_0x3f2d('0x45')]){_0x2c989c[_0x3f2d('0x46')]=[{'all':!![]}];}_0x2c989c=_[_0x3f2d('0x42')]({},_0x2c989c,_0x3769e2[_0x3f2d('0x44')]);return db[_0x3f2d('0x30')][_0x3f2d('0x48')](_0x2c989c)[_0x3f2d('0x26')](handleEntityNotFound(_0x270f4f,null))[_0x3f2d('0x26')](respondWithResult(_0x270f4f,null))[_0x3f2d('0x49')](handleError(_0x270f4f,null));};exports[_0x3f2d('0x4a')]=function(_0x176739,_0x5c6f1e){return db['AnalyticExtractedReport'][_0x3f2d('0x4a')](_0x176739[_0x3f2d('0x4b')],{})[_0x3f2d('0x26')](function(_0x3c3130){var _0x5989ed=_0x176739['user'][_0x3f2d('0x27')]({'plain':!![]});if(!_0x5989ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5989ed[_0x3f2d('0x4c')]===_0x3f2d('0x4d')){var _0x5e45b5=_0x3c3130[_0x3f2d('0x27')]({'plain':!![]});var _0x58cddd=_0x3f2d('0x28');return db[_0x3f2d('0x4e')][_0x3f2d('0x48')]({'where':{'name':_0x58cddd,'userProfileId':_0x5989ed[_0x3f2d('0x4f')]},'raw':!![]})[_0x3f2d('0x26')](function(_0x37d755){if(_0x37d755&&_0x37d755['autoAssociation']===0x0){return db[_0x3f2d('0x29')][_0x3f2d('0x4a')]({'name':_0x5e45b5['name'],'resourceId':_0x5e45b5['id'],'type':_0x37d755[_0x3f2d('0x2c')],'sectionId':_0x37d755['id']},{})[_0x3f2d('0x26')](function(){return _0x3c3130;});}else{return _0x3c3130;}})[_0x3f2d('0x49')](function(_0x4cf452){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cf452);throw _0x4cf452;});}return _0x3c3130;})['then'](respondWithResult(_0x5c6f1e,0xc9))[_0x3f2d('0x49')](handleError(_0x5c6f1e,null));};exports[_0x3f2d('0x24')]=function(_0x26a819,_0x4d303e){if(_0x26a819[_0x3f2d('0x4b')]['id']){delete _0x26a819[_0x3f2d('0x4b')]['id'];}return db[_0x3f2d('0x30')][_0x3f2d('0x48')]({'where':{'id':_0x26a819['params']['id']}})[_0x3f2d('0x26')](handleEntityNotFound(_0x4d303e,null))[_0x3f2d('0x26')](saveUpdates(_0x26a819[_0x3f2d('0x4b')],null))[_0x3f2d('0x26')](respondWithResult(_0x4d303e,null))[_0x3f2d('0x49')](handleError(_0x4d303e,null));};exports[_0x3f2d('0x25')]=function(_0x38a392,_0x244922){return db[_0x3f2d('0x30')][_0x3f2d('0x48')]({'where':{'id':_0x38a392[_0x3f2d('0x47')]['id']}})[_0x3f2d('0x26')](handleEntityNotFound(_0x244922,null))[_0x3f2d('0x26')](removeEntity(_0x244922,null))['catch'](handleError(_0x244922,null));};exports[_0x3f2d('0x50')]=function(_0x2cb4d6,_0x337d61,_0x52a7b2){return db['AnalyticExtractedReport'][_0x3f2d('0x48')]({'where':{'id':_0x2cb4d6[_0x3f2d('0x47')]['id']},'attributes':[_0x3f2d('0x2c'),'basename',_0x3f2d('0x51'),'output'],'raw':!![]})[_0x3f2d('0x26')](handleEntityNotFound(_0x337d61,null))[_0x3f2d('0x26')](function(_0x529615){if(_0x529615){if(!fs[_0x3f2d('0x52')](path['join'](config[_0x3f2d('0x53')],_0x3f2d('0x54'),_0x529615['savename']))){throw new db[(_0x3f2d('0x55'))][(_0x3f2d('0x56'))](_0x3f2d('0x57'));}if(_0x2cb4d6[_0x3f2d('0x35')][_0x3f2d('0x58')]){return _0x337d61[_0x3f2d('0x2b')](0xc8);}return _0x337d61[_0x3f2d('0x50')](path[_0x3f2d('0x59')](config[_0x3f2d('0x53')],_0x3f2d('0x54'),_0x529615[_0x3f2d('0x51')]),util[_0x3f2d('0x5a')](_0x3f2d('0x5b'),_0x529615[_0x3f2d('0x5c')]||_0x529615['name'],_0x529615[_0x3f2d('0x5d')][_0x3f2d('0x5e')]()));}})[_0x3f2d('0x49')](handleError(_0x337d61,null));};
\ No newline at end of file