Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 15b0ac2..e512956 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18f6=['path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','map','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticExtractedReport','includeAll','rows','catch','show','params','fields','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','output','existsSync','join','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','root','format','%s.%s','toLowerCase','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache'];(function(_0xe571a9,_0x3bb4d2){var _0x24eb18=function(_0xc6306c){while(--_0xc6306c){_0xe571a9['push'](_0xe571a9['shift']());}};_0x24eb18(++_0x3bb4d2);}(_0x18f6,0x16e));var _0x618f=function(_0x93398c,_0xb9e33f){_0x93398c=_0x93398c-0x0;var _0xa694e9=_0x18f6[_0x93398c];return _0xa694e9;};'use strict';var pdf=require(_0x618f('0x0'));var emlformat=require(_0x618f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x618f('0x2'));var rp=require(_0x618f('0x3'));var moment=require(_0x618f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x618f('0x5'));var util=require('util');var path=require(_0x618f('0x6'));var sox=require(_0x618f('0x7'));var csv=require(_0x618f('0x8'));var ejs=require(_0x618f('0x9'));var fs=require('fs');var _=require(_0x618f('0xa'));var squel=require(_0x618f('0xb'));var crypto=require('crypto');var jsforce=require(_0x618f('0xc'));var deskjs=require(_0x618f('0xd'));var toCsv=require(_0x618f('0x8'));var querystring=require(_0x618f('0xe'));var Papa=require(_0x618f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x618f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x618f('0x11'))(_0x618f('0x12'));var utils=require('../../config/utils');var config=require(_0x618f('0x13'));var licenseUtil=require(_0x618f('0x14'));var db=require(_0x618f('0x15'))['db'];function respondWithStatusCode(_0x4da324,_0x22f790){_0x22f790=_0x22f790||0xcc;return function(_0x5a5f02){if(_0x5a5f02){return _0x4da324[_0x618f('0x16')](_0x22f790);}return _0x4da324[_0x618f('0x17')](_0x22f790)[_0x618f('0x18')]();};}function respondWithResult(_0x97055e,_0x36ab49){_0x36ab49=_0x36ab49||0xc8;return function(_0x2622ea){if(_0x2622ea){return _0x97055e[_0x618f('0x17')](_0x36ab49)[_0x618f('0x19')](_0x2622ea);}};}function respondWithFilteredResult(_0x73b49,_0x12751c){return function(_0x4e3e8b){if(_0x4e3e8b){var _0x1dc341=_0x4e3e8b[_0x618f('0x1a')],_0x2c11ef=_0x12751c[_0x618f('0x1b')],_0x57d002=_0x12751c[_0x618f('0x1b')]+_0x12751c[_0x618f('0x1c')],_0x6b699c;if(_0x57d002>=_0x1dc341){_0x57d002=_0x1dc341;_0x6b699c=0xc8;}else{_0x6b699c=0xce;}_0x73b49['status'](_0x6b699c);return _0x73b49['set'](_0x618f('0x1d'),_0x2c11ef+'-'+_0x57d002+'/'+_0x1dc341)['json'](_0x4e3e8b);}return null;};}function patchUpdates(_0x4dcc65){return function(_0x2647f2){try{jsonpatch[_0x618f('0x1e')](_0x2647f2,_0x4dcc65,!![]);}catch(_0x469223){return BPromise[_0x618f('0x1f')](_0x469223);}return _0x2647f2[_0x618f('0x20')]();};}function saveUpdates(_0x284747,_0x4c4420){return function(_0x37ed6b){if(_0x37ed6b){return _0x37ed6b[_0x618f('0x21')](_0x284747)[_0x618f('0x22')](function(_0x2cbf72){return _0x2cbf72;});}return null;};}function removeEntity(_0x55877f,_0x12f7f7){return function(_0x2f6958){if(_0x2f6958){return _0x2f6958[_0x618f('0x23')]()[_0x618f('0x22')](function(){var _0x2939ac=_0x2f6958[_0x618f('0x24')]({'plain':!![]});var _0x5674e1=_0x618f('0x25');return db[_0x618f('0x26')][_0x618f('0x23')]({'where':{'type':_0x5674e1,'resourceId':_0x2939ac['id']}})[_0x618f('0x22')](function(){return _0x2f6958;});})[_0x618f('0x22')](function(){_0x55877f[_0x618f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e432f,_0x59187d){return function(_0x239086){if(!_0x239086){_0x1e432f[_0x618f('0x16')](0x194);}return _0x239086;};}function handleError(_0x54494c,_0x413c09){_0x413c09=_0x413c09||0x1f4;return function(_0x1723ad){logger['error'](_0x1723ad[_0x618f('0x27')]);if(_0x1723ad[_0x618f('0x28')]){delete _0x1723ad['name'];}_0x54494c[_0x618f('0x17')](_0x413c09)[_0x618f('0x29')](_0x1723ad);};}exports['index']=function(_0x225acc,_0xaf0429){var _0x507ec6={},_0x562f73={},_0x566c06={'count':0x0,'rows':[]};var _0x181797=_[_0x618f('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x4f7a3b){return{'name':_0x4f7a3b['fieldName'],'type':_0x4f7a3b[_0x618f('0x2b')]['key']};});_0x562f73[_0x618f('0x2c')]=_[_0x618f('0x2a')](_0x181797,'name');_0x562f73['query']=_[_0x618f('0x2d')](_0x225acc['query']);_0x562f73[_0x618f('0x2e')]=_[_0x618f('0x2f')](_0x562f73[_0x618f('0x2c')],_0x562f73[_0x618f('0x30')]);_0x507ec6[_0x618f('0x31')]=_[_0x618f('0x2f')](_0x562f73[_0x618f('0x2c')],qs['fields'](_0x225acc[_0x618f('0x30')]['fields']));_0x507ec6[_0x618f('0x31')]=_0x507ec6[_0x618f('0x31')][_0x618f('0x32')]?_0x507ec6['attributes']:_0x562f73['model'];if(!_0x225acc['query'][_0x618f('0x33')](_0x618f('0x34'))){_0x507ec6[_0x618f('0x1c')]=qs[_0x618f('0x1c')](_0x225acc[_0x618f('0x30')][_0x618f('0x1c')]);_0x507ec6[_0x618f('0x1b')]=qs['offset'](_0x225acc['query'][_0x618f('0x1b')]);}_0x507ec6[_0x618f('0x35')]=qs[_0x618f('0x36')](_0x225acc[_0x618f('0x30')][_0x618f('0x36')]);_0x507ec6[_0x618f('0x37')]=qs[_0x618f('0x2e')](_[_0x618f('0x38')](_0x225acc[_0x618f('0x30')],_0x562f73[_0x618f('0x2e')]),_0x181797);if(_0x225acc['query'][_0x618f('0x39')]){_0x507ec6[_0x618f('0x37')]=_['merge'](_0x507ec6['where'],{'$or':_[_0x618f('0x2a')](_0x181797,function(_0x5288e4){if(_0x5288e4[_0x618f('0x2b')]!==_0x618f('0x3a')){var _0x58034d={};_0x58034d[_0x5288e4[_0x618f('0x28')]]={'$like':'%'+_0x225acc[_0x618f('0x30')][_0x618f('0x39')]+'%'};return _0x58034d;}})});}_0x507ec6=_[_0x618f('0x3b')]({},_0x507ec6,_0x225acc[_0x618f('0x3c')]);var _0x3aed95={'where':_0x507ec6['where']};return db[_0x618f('0x3d')][_0x618f('0x1a')](_0x3aed95)[_0x618f('0x22')](function(_0x2606ae){_0x566c06[_0x618f('0x1a')]=_0x2606ae;if(_0x225acc[_0x618f('0x30')][_0x618f('0x3e')]){_0x507ec6['include']=[{'all':!![]}];}return db[_0x618f('0x3d')]['findAll'](_0x507ec6);})[_0x618f('0x22')](function(_0x5ed4a6){_0x566c06[_0x618f('0x3f')]=_0x5ed4a6;return _0x566c06;})[_0x618f('0x22')](respondWithFilteredResult(_0xaf0429,_0x507ec6))[_0x618f('0x40')](handleError(_0xaf0429,null));};exports[_0x618f('0x41')]=function(_0x41d8c5,_0xc8320f){var _0xc91c94={'raw':!![],'where':{'id':_0x41d8c5[_0x618f('0x42')]['id']}},_0x59d325={};_0x59d325[_0x618f('0x2c')]=_[_0x618f('0x2d')](db[_0x618f('0x3d')]['rawAttributes']);_0x59d325[_0x618f('0x30')]=_[_0x618f('0x2d')](_0x41d8c5['query']);_0x59d325[_0x618f('0x2e')]=_[_0x618f('0x2f')](_0x59d325[_0x618f('0x2c')],_0x59d325[_0x618f('0x30')]);_0xc91c94[_0x618f('0x31')]=_['intersection'](_0x59d325[_0x618f('0x2c')],qs[_0x618f('0x43')](_0x41d8c5['query'][_0x618f('0x43')]));_0xc91c94[_0x618f('0x31')]=_0xc91c94['attributes'][_0x618f('0x32')]?_0xc91c94[_0x618f('0x31')]:_0x59d325['model'];if(_0x41d8c5[_0x618f('0x30')][_0x618f('0x3e')]){_0xc91c94[_0x618f('0x44')]=[{'all':!![]}];}_0xc91c94=_[_0x618f('0x3b')]({},_0xc91c94,_0x41d8c5['options']);return db[_0x618f('0x3d')][_0x618f('0x45')](_0xc91c94)[_0x618f('0x22')](handleEntityNotFound(_0xc8320f,null))['then'](respondWithResult(_0xc8320f,null))[_0x618f('0x40')](handleError(_0xc8320f,null));};exports[_0x618f('0x46')]=function(_0x39dc74,_0x20abc3){return db[_0x618f('0x3d')]['create'](_0x39dc74['body'],{})[_0x618f('0x22')](function(_0x546597){var _0x13d39a=_0x39dc74['user'][_0x618f('0x24')]({'plain':!![]});if(!_0x13d39a)throw new Error(_0x618f('0x47'));if(_0x13d39a[_0x618f('0x48')]===_0x618f('0x49')){var _0x1523b8=_0x546597[_0x618f('0x24')]({'plain':!![]});var _0x1663ea=_0x618f('0x25');return db[_0x618f('0x4a')]['find']({'where':{'name':_0x1663ea,'userProfileId':_0x13d39a[_0x618f('0x4b')]},'raw':!![]})[_0x618f('0x22')](function(_0x203c9c){if(_0x203c9c&&_0x203c9c[_0x618f('0x4c')]===0x0){return db['UserProfileResource'][_0x618f('0x46')]({'name':_0x1523b8[_0x618f('0x28')],'resourceId':_0x1523b8['id'],'type':_0x203c9c[_0x618f('0x28')],'sectionId':_0x203c9c['id']},{})[_0x618f('0x22')](function(){return _0x546597;});}else{return _0x546597;}})[_0x618f('0x40')](function(_0x5b4f09){logger[_0x618f('0x4d')](_0x618f('0x4e'),_0x5b4f09);throw _0x5b4f09;});}return _0x546597;})['then'](respondWithResult(_0x20abc3,0xc9))[_0x618f('0x40')](handleError(_0x20abc3,null));};exports[_0x618f('0x21')]=function(_0x5b4d5d,_0x4c817a){if(_0x5b4d5d[_0x618f('0x4f')]['id']){delete _0x5b4d5d[_0x618f('0x4f')]['id'];}return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x5b4d5d[_0x618f('0x42')]['id']}})[_0x618f('0x22')](handleEntityNotFound(_0x4c817a,null))['then'](saveUpdates(_0x5b4d5d[_0x618f('0x4f')],null))[_0x618f('0x22')](respondWithResult(_0x4c817a,null))[_0x618f('0x40')](handleError(_0x4c817a,null));};exports[_0x618f('0x23')]=function(_0x300add,_0x2b2c71){return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x300add['params']['id']}})[_0x618f('0x22')](handleEntityNotFound(_0x2b2c71,null))['then'](removeEntity(_0x2b2c71,null))[_0x618f('0x40')](handleError(_0x2b2c71,null));};exports[_0x618f('0x50')]=function(_0x1317ac,_0x41f0cb,_0x59fbfc){return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x1317ac[_0x618f('0x42')]['id']},'attributes':[_0x618f('0x28'),_0x618f('0x51'),'savename',_0x618f('0x52')],'raw':!![]})[_0x618f('0x22')](handleEntityNotFound(_0x41f0cb,null))[_0x618f('0x22')](function(_0x2ddf21){if(_0x2ddf21){if(!fs[_0x618f('0x53')](path[_0x618f('0x54')](config['root'],_0x618f('0x55'),_0x2ddf21[_0x618f('0x56')]))){throw new db[(_0x618f('0x57'))]['ValidationError'](_0x618f('0x58'));}if(_0x1317ac[_0x618f('0x30')]['exists']){return _0x41f0cb[_0x618f('0x16')](0xc8);}return _0x41f0cb[_0x618f('0x50')](path['join'](config[_0x618f('0x59')],_0x618f('0x55'),_0x2ddf21['savename']),util[_0x618f('0x5a')](_0x618f('0x5b'),_0x2ddf21[_0x618f('0x51')]||_0x2ddf21[_0x618f('0x28')],_0x2ddf21[_0x618f('0x52')][_0x618f('0x5c')]()));}})[_0x618f('0x40')](handleError(_0x41f0cb,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