Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 05f6b01..e512956 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+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