Built motion from commit ab870f9e.|2.5.44
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 3d4b2ce..800bc5c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86d7=['then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','AnalyticExtractedReport','findAll','rows','catch','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','basename','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x12c34e,_0x39287a){var _0x244e88=function(_0x34507b){while(--_0x34507b){_0x12c34e['push'](_0x12c34e['shift']());}};_0x244e88(++_0x39287a);}(_0x86d7,0x111));var _0x786d=function(_0x399a08,_0x56586e){_0x399a08=_0x399a08-0x0;var _0x21f3c5=_0x86d7[_0x399a08];return _0x21f3c5;};'use strict';var pdf=require(_0x786d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x786d('0x1'));var zipdir=require(_0x786d('0x2'));var jsonpatch=require(_0x786d('0x3'));var rp=require(_0x786d('0x4'));var moment=require(_0x786d('0x5'));var BPromise=require(_0x786d('0x6'));var Mustache=require('mustache');var util=require(_0x786d('0x7'));var path=require(_0x786d('0x8'));var sox=require(_0x786d('0x9'));var csv=require('to-csv');var ejs=require(_0x786d('0xa'));var fs=require('fs');var _=require(_0x786d('0xb'));var squel=require(_0x786d('0xc'));var crypto=require('crypto');var jsforce=require(_0x786d('0xd'));var deskjs=require(_0x786d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x786d('0xf'));var Papa=require(_0x786d('0x10'));var Redis=require(_0x786d('0x11'));var authService=require(_0x786d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x786d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x786d('0x14'))(_0x786d('0x15'));var utils=require(_0x786d('0x16'));var config=require(_0x786d('0x17'));var licenseUtil=require(_0x786d('0x18'));var db=require(_0x786d('0x19'))['db'];function respondWithStatusCode(_0x647cec,_0x1b24e8){_0x1b24e8=_0x1b24e8||0xcc;return function(_0x458bdf){if(_0x458bdf){return _0x647cec[_0x786d('0x1a')](_0x1b24e8);}return _0x647cec['status'](_0x1b24e8)[_0x786d('0x1b')]();};}function respondWithResult(_0x876c8f,_0x22d80b){_0x22d80b=_0x22d80b||0xc8;return function(_0x293602){if(_0x293602){return _0x876c8f[_0x786d('0x1c')](_0x22d80b)[_0x786d('0x1d')](_0x293602);}};}function respondWithFilteredResult(_0x2d225e,_0x5006bb){return function(_0x215c53){if(_0x215c53){var _0x52b917=_0x215c53[_0x786d('0x1e')],_0x5e9a7a=_0x5006bb[_0x786d('0x1f')],_0x502099=_0x5006bb[_0x786d('0x1f')]+_0x5006bb[_0x786d('0x20')],_0x20360f;if(_0x502099>=_0x52b917){_0x502099=_0x52b917;_0x20360f=0xc8;}else{_0x20360f=0xce;}_0x2d225e[_0x786d('0x1c')](_0x20360f);return _0x2d225e[_0x786d('0x21')](_0x786d('0x22'),_0x5e9a7a+'-'+_0x502099+'/'+_0x52b917)[_0x786d('0x1d')](_0x215c53);}return null;};}function patchUpdates(_0x4b6b71){return function(_0x4c50f6){try{jsonpatch[_0x786d('0x23')](_0x4c50f6,_0x4b6b71,!![]);}catch(_0x38479e){return BPromise[_0x786d('0x24')](_0x38479e);}return _0x4c50f6[_0x786d('0x25')]();};}function saveUpdates(_0x12dfb6,_0x1019f9){return function(_0x34db29){if(_0x34db29){return _0x34db29[_0x786d('0x26')](_0x12dfb6)[_0x786d('0x27')](function(_0x546bf2){return _0x546bf2;});}return null;};}function removeEntity(_0x293930,_0x9a2e4){return function(_0x129dd7){if(_0x129dd7){return _0x129dd7[_0x786d('0x28')]()[_0x786d('0x27')](function(){var _0x6f62e7=_0x129dd7['get']({'plain':!![]});var _0x1fde13='ExtractedReports';return db[_0x786d('0x29')][_0x786d('0x28')]({'where':{'type':_0x1fde13,'resourceId':_0x6f62e7['id']}})['then'](function(){return _0x129dd7;});})['then'](function(){_0x293930[_0x786d('0x1c')](0xcc)[_0x786d('0x1b')]();});}};}function handleEntityNotFound(_0x1f181d,_0x4f14ed){return function(_0x152534){if(!_0x152534){_0x1f181d[_0x786d('0x1a')](0x194);}return _0x152534;};}function handleError(_0x32daa6,_0x867dca){_0x867dca=_0x867dca||0x1f4;return function(_0x16fc6a){logger[_0x786d('0x2a')](_0x16fc6a[_0x786d('0x2b')]);if(_0x16fc6a['name']){delete _0x16fc6a[_0x786d('0x2c')];}_0x32daa6[_0x786d('0x1c')](_0x867dca)[_0x786d('0x2d')](_0x16fc6a);};}exports[_0x786d('0x2e')]=function(_0x92705,_0x2645cb){var _0x2bce4b={},_0x349c73={},_0x5d8077={'count':0x0,'rows':[]};var _0x21763e=_[_0x786d('0x2f')](db['AnalyticExtractedReport'][_0x786d('0x30')],function(_0x3bae02){return{'name':_0x3bae02[_0x786d('0x31')],'type':_0x3bae02[_0x786d('0x32')][_0x786d('0x33')]};});_0x349c73['model']=_[_0x786d('0x2f')](_0x21763e,_0x786d('0x2c'));_0x349c73[_0x786d('0x34')]=_[_0x786d('0x35')](_0x92705[_0x786d('0x34')]);_0x349c73[_0x786d('0x36')]=_[_0x786d('0x37')](_0x349c73[_0x786d('0x38')],_0x349c73[_0x786d('0x34')]);_0x2bce4b['attributes']=_['intersection'](_0x349c73[_0x786d('0x38')],qs[_0x786d('0x39')](_0x92705[_0x786d('0x34')][_0x786d('0x39')]));_0x2bce4b[_0x786d('0x3a')]=_0x2bce4b['attributes']['length']?_0x2bce4b[_0x786d('0x3a')]:_0x349c73['model'];if(!_0x92705[_0x786d('0x34')][_0x786d('0x3b')](_0x786d('0x3c'))){_0x2bce4b['limit']=qs[_0x786d('0x20')](_0x92705[_0x786d('0x34')]['limit']);_0x2bce4b[_0x786d('0x1f')]=qs[_0x786d('0x1f')](_0x92705['query'][_0x786d('0x1f')]);}_0x2bce4b[_0x786d('0x3d')]=qs[_0x786d('0x3e')](_0x92705['query']['sort']);_0x2bce4b[_0x786d('0x3f')]=qs[_0x786d('0x36')](_[_0x786d('0x40')](_0x92705[_0x786d('0x34')],_0x349c73[_0x786d('0x36')]),_0x21763e);if(_0x92705[_0x786d('0x34')][_0x786d('0x41')]){_0x2bce4b[_0x786d('0x3f')]=_['merge'](_0x2bce4b[_0x786d('0x3f')],{'$or':_[_0x786d('0x2f')](_0x21763e,function(_0x4526a5){if(_0x4526a5['type']!==_0x786d('0x42')){var _0x4b39b5={};_0x4b39b5[_0x4526a5[_0x786d('0x2c')]]={'$like':'%'+_0x92705['query'][_0x786d('0x41')]+'%'};return _0x4b39b5;}})});}_0x2bce4b=_[_0x786d('0x43')]({},_0x2bce4b,_0x92705[_0x786d('0x44')]);var _0x1f4f93={'where':_0x2bce4b[_0x786d('0x3f')]};return db['AnalyticExtractedReport'][_0x786d('0x1e')](_0x1f4f93)[_0x786d('0x27')](function(_0x3277a4){_0x5d8077[_0x786d('0x1e')]=_0x3277a4;if(_0x92705[_0x786d('0x34')][_0x786d('0x45')]){_0x2bce4b[_0x786d('0x46')]=[{'all':!![]}];}return db[_0x786d('0x47')][_0x786d('0x48')](_0x2bce4b);})[_0x786d('0x27')](function(_0x29c5a7){_0x5d8077[_0x786d('0x49')]=_0x29c5a7;return _0x5d8077;})[_0x786d('0x27')](respondWithFilteredResult(_0x2645cb,_0x2bce4b))[_0x786d('0x4a')](handleError(_0x2645cb,null));};exports[_0x786d('0x4b')]=function(_0x5cd272,_0x1db529){var _0x2b0af0={'raw':!![],'where':{'id':_0x5cd272[_0x786d('0x4c')]['id']}},_0x1700ba={};_0x1700ba[_0x786d('0x38')]=_[_0x786d('0x35')](db[_0x786d('0x47')]['rawAttributes']);_0x1700ba['query']=_[_0x786d('0x35')](_0x5cd272[_0x786d('0x34')]);_0x1700ba[_0x786d('0x36')]=_[_0x786d('0x37')](_0x1700ba[_0x786d('0x38')],_0x1700ba[_0x786d('0x34')]);_0x2b0af0[_0x786d('0x3a')]=_[_0x786d('0x37')](_0x1700ba[_0x786d('0x38')],qs[_0x786d('0x39')](_0x5cd272['query'][_0x786d('0x39')]));_0x2b0af0['attributes']=_0x2b0af0[_0x786d('0x3a')][_0x786d('0x4d')]?_0x2b0af0[_0x786d('0x3a')]:_0x1700ba[_0x786d('0x38')];if(_0x5cd272['query'][_0x786d('0x45')]){_0x2b0af0[_0x786d('0x46')]=[{'all':!![]}];}_0x2b0af0=_['merge']({},_0x2b0af0,_0x5cd272[_0x786d('0x44')]);return db[_0x786d('0x47')][_0x786d('0x4e')](_0x2b0af0)['then'](handleEntityNotFound(_0x1db529,null))['then'](respondWithResult(_0x1db529,null))[_0x786d('0x4a')](handleError(_0x1db529,null));};exports[_0x786d('0x4f')]=function(_0x336ade,_0x2f137e){return db[_0x786d('0x47')][_0x786d('0x4f')](_0x336ade[_0x786d('0x50')],{})[_0x786d('0x27')](function(_0x3cb756){var _0x2892b4=_0x336ade['user'][_0x786d('0x51')]({'plain':!![]});if(!_0x2892b4)throw new Error(_0x786d('0x52'));if(_0x2892b4[_0x786d('0x53')]===_0x786d('0x54')){var _0x5530e3=_0x3cb756[_0x786d('0x51')]({'plain':!![]});var _0x3a627e=_0x786d('0x55');return db[_0x786d('0x56')][_0x786d('0x4e')]({'where':{'name':_0x3a627e,'userProfileId':_0x2892b4[_0x786d('0x57')]},'raw':!![]})[_0x786d('0x27')](function(_0x5e3582){if(_0x5e3582&&_0x5e3582[_0x786d('0x58')]===0x0){return db['UserProfileResource'][_0x786d('0x4f')]({'name':_0x5530e3[_0x786d('0x2c')],'resourceId':_0x5530e3['id'],'type':_0x5e3582[_0x786d('0x2c')],'sectionId':_0x5e3582['id']},{})[_0x786d('0x27')](function(){return _0x3cb756;});}else{return _0x3cb756;}})[_0x786d('0x4a')](function(_0x5817ff){logger[_0x786d('0x2a')](_0x786d('0x59'),_0x5817ff);throw _0x5817ff;});}return _0x3cb756;})['then'](respondWithResult(_0x2f137e,0xc9))[_0x786d('0x4a')](handleError(_0x2f137e,null));};exports[_0x786d('0x26')]=function(_0x571cfd,_0x3dcfdc){if(_0x571cfd[_0x786d('0x50')]['id']){delete _0x571cfd[_0x786d('0x50')]['id'];}return db[_0x786d('0x47')][_0x786d('0x4e')]({'where':{'id':_0x571cfd['params']['id']}})[_0x786d('0x27')](handleEntityNotFound(_0x3dcfdc,null))[_0x786d('0x27')](saveUpdates(_0x571cfd['body'],null))[_0x786d('0x27')](respondWithResult(_0x3dcfdc,null))[_0x786d('0x4a')](handleError(_0x3dcfdc,null));};exports['destroy']=function(_0x4af0fa,_0x19f9e0){return db[_0x786d('0x47')][_0x786d('0x4e')]({'where':{'id':_0x4af0fa[_0x786d('0x4c')]['id']}})[_0x786d('0x27')](handleEntityNotFound(_0x19f9e0,null))[_0x786d('0x27')](removeEntity(_0x19f9e0,null))[_0x786d('0x4a')](handleError(_0x19f9e0,null));};exports['download']=function(_0x44bdc7,_0xc637fa,_0x90b426){return db[_0x786d('0x47')][_0x786d('0x4e')]({'where':{'id':_0x44bdc7['params']['id']},'attributes':['name','basename',_0x786d('0x5a'),_0x786d('0x5b')],'raw':!![]})[_0x786d('0x27')](handleEntityNotFound(_0xc637fa,null))[_0x786d('0x27')](function(_0x4a0640){if(_0x4a0640){if(!fs[_0x786d('0x5c')](path[_0x786d('0x5d')](config[_0x786d('0x5e')],_0x786d('0x5f'),_0x4a0640[_0x786d('0x5a')]))){throw new db[(_0x786d('0x60'))][(_0x786d('0x61'))](_0x786d('0x62'));}if(_0x44bdc7[_0x786d('0x34')]['exists']){return _0xc637fa[_0x786d('0x1a')](0xc8);}return _0xc637fa[_0x786d('0x63')](path[_0x786d('0x5d')](config[_0x786d('0x5e')],_0x786d('0x5f'),_0x4a0640[_0x786d('0x5a')]),util[_0x786d('0x64')](_0x786d('0x65'),_0x4a0640[_0x786d('0x66')]||_0x4a0640[_0x786d('0x2c')],_0x4a0640[_0x786d('0x5b')][_0x786d('0x67')]()));}})[_0x786d('0x4a')](handleError(_0xc637fa,null));};
\ No newline at end of file
+var _0x2f11=['user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','savename','output','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','find','create','role'];(function(_0x19a7ba,_0x517aef){var _0x230c13=function(_0x33e4aa){while(--_0x33e4aa){_0x19a7ba['push'](_0x19a7ba['shift']());}};_0x230c13(++_0x517aef);}(_0x2f11,0xcc));var _0x12f1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2f11[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x12f1('0x0'));var rimraf=require(_0x12f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12f1('0x2'));var rp=require(_0x12f1('0x3'));var moment=require('moment');var BPromise=require(_0x12f1('0x4'));var Mustache=require(_0x12f1('0x5'));var util=require(_0x12f1('0x6'));var path=require(_0x12f1('0x7'));var sox=require(_0x12f1('0x8'));var csv=require(_0x12f1('0x9'));var ejs=require(_0x12f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12f1('0xb'));var squel=require(_0x12f1('0xc'));var crypto=require(_0x12f1('0xd'));var jsforce=require(_0x12f1('0xe'));var deskjs=require(_0x12f1('0xf'));var toCsv=require(_0x12f1('0x9'));var querystring=require(_0x12f1('0x10'));var Papa=require(_0x12f1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x12f1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12f1('0x13'));var logger=require(_0x12f1('0x14'))(_0x12f1('0x15'));var utils=require(_0x12f1('0x16'));var config=require(_0x12f1('0x17'));var licenseUtil=require(_0x12f1('0x18'));var db=require(_0x12f1('0x19'))['db'];function respondWithStatusCode(_0x51897a,_0x283105){_0x283105=_0x283105||0xcc;return function(_0x398261){if(_0x398261){return _0x51897a[_0x12f1('0x1a')](_0x283105);}return _0x51897a['status'](_0x283105)[_0x12f1('0x1b')]();};}function respondWithResult(_0x3f3405,_0x49bf6e){_0x49bf6e=_0x49bf6e||0xc8;return function(_0x4793d0){if(_0x4793d0){return _0x3f3405[_0x12f1('0x1c')](_0x49bf6e)[_0x12f1('0x1d')](_0x4793d0);}};}function respondWithFilteredResult(_0x5ad5a2,_0x2e167a){return function(_0x553a6c){if(_0x553a6c){var _0x2ef174=typeof _0x2e167a[_0x12f1('0x1e')]==='undefined'&&typeof _0x2e167a[_0x12f1('0x1f')]===_0x12f1('0x20');var _0xea2598=_0x553a6c[_0x12f1('0x21')];var _0x3b80c2=_0x2ef174?0x0:_0x2e167a[_0x12f1('0x1e')];var _0x2e9f1d=_0x2ef174?_0x553a6c[_0x12f1('0x21')]:_0x2e167a['offset']+_0x2e167a['limit'];var _0x164c55;if(_0x2e9f1d>=_0xea2598){_0x2e9f1d=_0xea2598;_0x164c55=0xc8;}else{_0x164c55=0xce;}_0x5ad5a2[_0x12f1('0x1c')](_0x164c55);return _0x5ad5a2[_0x12f1('0x22')](_0x12f1('0x23'),_0x3b80c2+'-'+_0x2e9f1d+'/'+_0xea2598)[_0x12f1('0x1d')](_0x553a6c);}return null;};}function patchUpdates(_0x5e807d){return function(_0x5ad5c7){try{jsonpatch[_0x12f1('0x24')](_0x5ad5c7,_0x5e807d,!![]);}catch(_0x3672b7){return BPromise[_0x12f1('0x25')](_0x3672b7);}return _0x5ad5c7['save']();};}function saveUpdates(_0x1226b8,_0xde26f4){return function(_0x4d0856){if(_0x4d0856){return _0x4d0856[_0x12f1('0x26')](_0x1226b8)[_0x12f1('0x27')](function(_0x38f759){return _0x38f759;});}return null;};}function removeEntity(_0x3cc332,_0x4c39d9){return function(_0x344c7f){if(_0x344c7f){return _0x344c7f[_0x12f1('0x28')]()[_0x12f1('0x27')](function(){var _0x4ff7c3=_0x344c7f[_0x12f1('0x29')]({'plain':!![]});var _0x534217='ExtractedReports';return db[_0x12f1('0x2a')][_0x12f1('0x28')]({'where':{'type':_0x534217,'resourceId':_0x4ff7c3['id']}})[_0x12f1('0x27')](function(){return _0x344c7f;});})['then'](function(){_0x3cc332[_0x12f1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5856c0,_0x1f9702){return function(_0xbbb8d){if(!_0xbbb8d){_0x5856c0[_0x12f1('0x1a')](0x194);}return _0xbbb8d;};}function handleError(_0x3e7cbd,_0x5449f0){_0x5449f0=_0x5449f0||0x1f4;return function(_0x387a43){logger[_0x12f1('0x2b')](_0x387a43[_0x12f1('0x2c')]);if(_0x387a43[_0x12f1('0x2d')]){delete _0x387a43[_0x12f1('0x2d')];}_0x3e7cbd[_0x12f1('0x1c')](_0x5449f0)[_0x12f1('0x2e')](_0x387a43);};}exports[_0x12f1('0x2f')]=function(_0x459624,_0x533934){var _0x4711f4={},_0x1943ef={},_0x22d249={'count':0x0,'rows':[]};var _0x377e20=_[_0x12f1('0x30')](db[_0x12f1('0x31')][_0x12f1('0x32')],function(_0x1e372f){return{'name':_0x1e372f[_0x12f1('0x33')],'type':_0x1e372f[_0x12f1('0x34')][_0x12f1('0x35')]};});_0x1943ef[_0x12f1('0x36')]=_[_0x12f1('0x30')](_0x377e20,_0x12f1('0x2d'));_0x1943ef[_0x12f1('0x37')]=_[_0x12f1('0x38')](_0x459624[_0x12f1('0x37')]);_0x1943ef['filters']=_['intersection'](_0x1943ef[_0x12f1('0x36')],_0x1943ef[_0x12f1('0x37')]);_0x4711f4[_0x12f1('0x39')]=_[_0x12f1('0x3a')](_0x1943ef[_0x12f1('0x36')],qs[_0x12f1('0x3b')](_0x459624['query'][_0x12f1('0x3b')]));_0x4711f4[_0x12f1('0x39')]=_0x4711f4[_0x12f1('0x39')][_0x12f1('0x3c')]?_0x4711f4[_0x12f1('0x39')]:_0x1943ef['model'];if(!_0x459624['query']['hasOwnProperty']('nolimit')){_0x4711f4[_0x12f1('0x1f')]=qs['limit'](_0x459624[_0x12f1('0x37')][_0x12f1('0x1f')]);_0x4711f4[_0x12f1('0x1e')]=qs[_0x12f1('0x1e')](_0x459624[_0x12f1('0x37')][_0x12f1('0x1e')]);}_0x4711f4[_0x12f1('0x3d')]=qs[_0x12f1('0x3e')](_0x459624[_0x12f1('0x37')][_0x12f1('0x3e')]);_0x4711f4['where']=qs[_0x12f1('0x3f')](_[_0x12f1('0x40')](_0x459624[_0x12f1('0x37')],_0x1943ef[_0x12f1('0x3f')]),_0x377e20);if(_0x459624[_0x12f1('0x37')][_0x12f1('0x41')]){_0x4711f4[_0x12f1('0x42')]=_[_0x12f1('0x43')](_0x4711f4[_0x12f1('0x42')],{'$or':_[_0x12f1('0x30')](_0x377e20,function(_0x14bd5c){if(_0x14bd5c['type']!==_0x12f1('0x44')){var _0x36de04={};_0x36de04[_0x14bd5c[_0x12f1('0x2d')]]={'$like':'%'+_0x459624['query'][_0x12f1('0x41')]+'%'};return _0x36de04;}})});}_0x4711f4=_[_0x12f1('0x43')]({},_0x4711f4,_0x459624['options']);var _0x2fc405={'where':_0x4711f4[_0x12f1('0x42')]};return db[_0x12f1('0x31')][_0x12f1('0x21')](_0x2fc405)[_0x12f1('0x27')](function(_0x4642ac){_0x22d249[_0x12f1('0x21')]=_0x4642ac;if(_0x459624[_0x12f1('0x37')][_0x12f1('0x45')]){_0x4711f4['include']=[{'all':!![]}];}return db[_0x12f1('0x31')][_0x12f1('0x46')](_0x4711f4);})[_0x12f1('0x27')](function(_0x178a6c){_0x22d249['rows']=_0x178a6c;return _0x22d249;})[_0x12f1('0x27')](respondWithFilteredResult(_0x533934,_0x4711f4))[_0x12f1('0x47')](handleError(_0x533934,null));};exports[_0x12f1('0x48')]=function(_0x3d3ddb,_0x44cb7b){var _0x565663={'raw':!![],'where':{'id':_0x3d3ddb[_0x12f1('0x49')]['id']}},_0x9a81ea={};_0x9a81ea[_0x12f1('0x36')]=_['keys'](db['AnalyticExtractedReport'][_0x12f1('0x32')]);_0x9a81ea[_0x12f1('0x37')]=_[_0x12f1('0x38')](_0x3d3ddb['query']);_0x9a81ea[_0x12f1('0x3f')]=_['intersection'](_0x9a81ea[_0x12f1('0x36')],_0x9a81ea[_0x12f1('0x37')]);_0x565663[_0x12f1('0x39')]=_[_0x12f1('0x3a')](_0x9a81ea[_0x12f1('0x36')],qs[_0x12f1('0x3b')](_0x3d3ddb[_0x12f1('0x37')]['fields']));_0x565663['attributes']=_0x565663[_0x12f1('0x39')][_0x12f1('0x3c')]?_0x565663['attributes']:_0x9a81ea[_0x12f1('0x36')];if(_0x3d3ddb['query']['includeAll']){_0x565663[_0x12f1('0x4a')]=[{'all':!![]}];}_0x565663=_[_0x12f1('0x43')]({},_0x565663,_0x3d3ddb['options']);return db['AnalyticExtractedReport'][_0x12f1('0x4b')](_0x565663)[_0x12f1('0x27')](handleEntityNotFound(_0x44cb7b,null))[_0x12f1('0x27')](respondWithResult(_0x44cb7b,null))[_0x12f1('0x47')](handleError(_0x44cb7b,null));};exports[_0x12f1('0x4c')]=function(_0x2cbe99,_0x561ff1){return db[_0x12f1('0x31')]['create'](_0x2cbe99['body'],{})[_0x12f1('0x27')](function(_0x4a6f10){var _0x302825=_0x2cbe99['user']['get']({'plain':!![]});if(!_0x302825)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x302825[_0x12f1('0x4d')]===_0x12f1('0x4e')){var _0x5ed6ae=_0x4a6f10['get']({'plain':!![]});var _0x2aec0b='ExtractedReports';return db[_0x12f1('0x4f')][_0x12f1('0x4b')]({'where':{'name':_0x2aec0b,'userProfileId':_0x302825[_0x12f1('0x50')]},'raw':!![]})[_0x12f1('0x27')](function(_0xf20dda){if(_0xf20dda&&_0xf20dda[_0x12f1('0x51')]===0x0){return db[_0x12f1('0x2a')][_0x12f1('0x4c')]({'name':_0x5ed6ae[_0x12f1('0x2d')],'resourceId':_0x5ed6ae['id'],'type':_0xf20dda[_0x12f1('0x2d')],'sectionId':_0xf20dda['id']},{})['then'](function(){return _0x4a6f10;});}else{return _0x4a6f10;}})[_0x12f1('0x47')](function(_0x2f8e93){logger['error'](_0x12f1('0x52'),_0x2f8e93);throw _0x2f8e93;});}return _0x4a6f10;})[_0x12f1('0x27')](respondWithResult(_0x561ff1,0xc9))[_0x12f1('0x47')](handleError(_0x561ff1,null));};exports[_0x12f1('0x26')]=function(_0x442f2f,_0x40196f){if(_0x442f2f[_0x12f1('0x53')]['id']){delete _0x442f2f[_0x12f1('0x53')]['id'];}return db[_0x12f1('0x31')][_0x12f1('0x4b')]({'where':{'id':_0x442f2f[_0x12f1('0x49')]['id']}})[_0x12f1('0x27')](handleEntityNotFound(_0x40196f,null))[_0x12f1('0x27')](saveUpdates(_0x442f2f[_0x12f1('0x53')],null))[_0x12f1('0x27')](respondWithResult(_0x40196f,null))[_0x12f1('0x47')](handleError(_0x40196f,null));};exports['destroy']=function(_0x1d2aba,_0x42fb33){return db[_0x12f1('0x31')]['find']({'where':{'id':_0x1d2aba['params']['id']}})[_0x12f1('0x27')](handleEntityNotFound(_0x42fb33,null))[_0x12f1('0x27')](removeEntity(_0x42fb33,null))[_0x12f1('0x47')](handleError(_0x42fb33,null));};exports['download']=function(_0x320415,_0x94a647,_0x2eed8c){return db['AnalyticExtractedReport'][_0x12f1('0x4b')]({'where':{'id':_0x320415[_0x12f1('0x49')]['id']},'attributes':[_0x12f1('0x2d'),'basename',_0x12f1('0x54'),_0x12f1('0x55')],'raw':!![]})[_0x12f1('0x27')](handleEntityNotFound(_0x94a647,null))['then'](function(_0x48dda0){if(_0x48dda0){if(!fs['existsSync'](path[_0x12f1('0x56')](config[_0x12f1('0x57')],'server/files/reports',_0x48dda0[_0x12f1('0x54')]))){throw new db[(_0x12f1('0x58'))][(_0x12f1('0x59'))](_0x12f1('0x5a'));}if(_0x320415['query'][_0x12f1('0x5b')]){return _0x94a647['sendStatus'](0xc8);}return _0x94a647['download'](path[_0x12f1('0x56')](config['root'],'server/files/reports',_0x48dda0['savename']),util['format'](_0x12f1('0x5c'),_0x48dda0['basename']||_0x48dda0[_0x12f1('0x2d')],_0x48dda0[_0x12f1('0x55')][_0x12f1('0x5d')]()));}})['catch'](handleError(_0x94a647,null));};
\ No newline at end of file