Built motion from commit (unavailable).|2.5.12
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 330ef23..05f6b01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0672=['find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','download','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','sendStatus','error','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','count','includeAll','include','catch','show','params','options'];(function(_0x4b90ca,_0x247dcc){var _0x9903f6=function(_0x2e2360){while(--_0x2e2360){_0x4b90ca['push'](_0x4b90ca['shift']());}};_0x9903f6(++_0x247dcc);}(_0x0672,0x7b));var _0x2067=function(_0x579681,_0x181f3f){_0x579681=_0x579681-0x0;var _0x3054e0=_0x0672[_0x579681];return _0x3054e0;};'use strict';var pdf=require(_0x2067('0x0'));var emlformat=require(_0x2067('0x1'));var rimraf=require(_0x2067('0x2'));var zipdir=require(_0x2067('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2067('0x4'));var moment=require(_0x2067('0x5'));var BPromise=require(_0x2067('0x6'));var Mustache=require(_0x2067('0x7'));var util=require('util');var path=require(_0x2067('0x8'));var sox=require(_0x2067('0x9'));var csv=require(_0x2067('0xa'));var ejs=require(_0x2067('0xb'));var fs=require('fs');var _=require(_0x2067('0xc'));var squel=require(_0x2067('0xd'));var crypto=require(_0x2067('0xe'));var jsforce=require(_0x2067('0xf'));var deskjs=require(_0x2067('0x10'));var toCsv=require(_0x2067('0xa'));var querystring=require(_0x2067('0x11'));var Papa=require(_0x2067('0x12'));var Redis=require(_0x2067('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2067('0x14'));var as=require(_0x2067('0x15'));var hardwareService=require(_0x2067('0x16'));var logger=require('../../config/logger')(_0x2067('0x17'));var utils=require(_0x2067('0x18'));var config=require(_0x2067('0x19'));var db=require(_0x2067('0x1a'))['db'];function respondWithStatusCode(_0x53eca6,_0xdfd18c){_0xdfd18c=_0xdfd18c||0xcc;return function(_0x2b6ebf){if(_0x2b6ebf){return _0x53eca6['sendStatus'](_0xdfd18c);}return _0x53eca6[_0x2067('0x1b')](_0xdfd18c)[_0x2067('0x1c')]();};}function respondWithResult(_0x51ce77,_0x4d53b0){_0x4d53b0=_0x4d53b0||0xc8;return function(_0x4a3188){if(_0x4a3188){return _0x51ce77[_0x2067('0x1b')](_0x4d53b0)[_0x2067('0x1d')](_0x4a3188);}};}function respondWithFilteredResult(_0x2b2a16,_0x99f95c){return function(_0x1d4948){if(_0x1d4948){var _0x508030=_0x1d4948['count'],_0x17280d=_0x99f95c[_0x2067('0x1e')],_0x558b76=_0x99f95c['offset']+_0x99f95c['limit'],_0x560f33;if(_0x558b76>=_0x508030){_0x558b76=_0x508030;_0x560f33=0xc8;}else{_0x560f33=0xce;}_0x2b2a16[_0x2067('0x1b')](_0x560f33);return _0x2b2a16[_0x2067('0x1f')](_0x2067('0x20'),_0x17280d+'-'+_0x558b76+'/'+_0x508030)[_0x2067('0x1d')](_0x1d4948);}return null;};}function patchUpdates(_0x11b1fc){return function(_0x1ba85c){try{jsonpatch[_0x2067('0x21')](_0x1ba85c,_0x11b1fc,!![]);}catch(_0x52bd0a){return BPromise[_0x2067('0x22')](_0x52bd0a);}return _0x1ba85c[_0x2067('0x23')]();};}function saveUpdates(_0xfb76e4,_0x536256){return function(_0x216e20){if(_0x216e20){return _0x216e20[_0x2067('0x24')](_0xfb76e4)['then'](function(_0x2d6dcb){return _0x2d6dcb;});}return null;};}function removeEntity(_0x50eecb,_0x3760f3){return function(_0x49191d){if(_0x49191d){return _0x49191d[_0x2067('0x25')]()[_0x2067('0x26')](function(){var _0x1d40ff=_0x49191d[_0x2067('0x27')]({'plain':!![]});var _0x1e5d5c=_0x2067('0x28');return db['UserProfileResource'][_0x2067('0x25')]({'where':{'type':_0x1e5d5c,'resourceId':_0x1d40ff['id']}})['then'](function(){return _0x49191d;});})['then'](function(){_0x50eecb[_0x2067('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d05de,_0x4e837f){return function(_0x2fba89){if(!_0x2fba89){_0x2d05de[_0x2067('0x29')](0x194);}return _0x2fba89;};}function handleError(_0x45972c,_0x250eba){_0x250eba=_0x250eba||0x1f4;return function(_0x452c1b){logger[_0x2067('0x2a')](_0x452c1b['stack']);if(_0x452c1b[_0x2067('0x2b')]){delete _0x452c1b['name'];}_0x45972c[_0x2067('0x1b')](_0x250eba)[_0x2067('0x2c')](_0x452c1b);};}exports['index']=function(_0x396487,_0x127786){var _0x2719c1={},_0x5c4605={},_0x5192f8={'count':0x0,'rows':[]};var _0x27a819=_[_0x2067('0x2d')](db[_0x2067('0x2e')][_0x2067('0x2f')],function(_0x349888){return{'name':_0x349888[_0x2067('0x30')],'type':_0x349888[_0x2067('0x31')][_0x2067('0x32')]};});_0x5c4605[_0x2067('0x33')]=_[_0x2067('0x2d')](_0x27a819,_0x2067('0x2b'));_0x5c4605[_0x2067('0x34')]=_[_0x2067('0x35')](_0x396487[_0x2067('0x34')]);_0x5c4605[_0x2067('0x36')]=_[_0x2067('0x37')](_0x5c4605[_0x2067('0x33')],_0x5c4605[_0x2067('0x34')]);_0x2719c1[_0x2067('0x38')]=_[_0x2067('0x37')](_0x5c4605[_0x2067('0x33')],qs[_0x2067('0x39')](_0x396487[_0x2067('0x34')][_0x2067('0x39')]));_0x2719c1[_0x2067('0x38')]=_0x2719c1[_0x2067('0x38')][_0x2067('0x3a')]?_0x2719c1[_0x2067('0x38')]:_0x5c4605[_0x2067('0x33')];if(!_0x396487[_0x2067('0x34')][_0x2067('0x3b')](_0x2067('0x3c'))){_0x2719c1['limit']=qs[_0x2067('0x3d')](_0x396487[_0x2067('0x34')][_0x2067('0x3d')]);_0x2719c1['offset']=qs[_0x2067('0x1e')](_0x396487['query']['offset']);}_0x2719c1[_0x2067('0x3e')]=qs[_0x2067('0x3f')](_0x396487['query']['sort']);_0x2719c1[_0x2067('0x40')]=qs[_0x2067('0x36')](_[_0x2067('0x41')](_0x396487[_0x2067('0x34')],_0x5c4605['filters']));if(_0x396487[_0x2067('0x34')][_0x2067('0x42')]){_0x2719c1[_0x2067('0x40')]=_['merge'](_0x2719c1['where'],{'$or':_[_0x2067('0x2d')](_0x27a819,function(_0x4061ea){if(_0x4061ea[_0x2067('0x31')]!==_0x2067('0x43')){var _0x428988={};_0x428988[_0x4061ea[_0x2067('0x2b')]]={'$like':'%'+_0x396487['query'][_0x2067('0x42')]+'%'};return _0x428988;}})});}_0x2719c1=_['merge']({},_0x2719c1,_0x396487['options']);var _0x2de56b={'where':_0x2719c1[_0x2067('0x40')]};return db[_0x2067('0x2e')][_0x2067('0x44')](_0x2de56b)[_0x2067('0x26')](function(_0x48707d){_0x5192f8[_0x2067('0x44')]=_0x48707d;if(_0x396487[_0x2067('0x34')][_0x2067('0x45')]){_0x2719c1[_0x2067('0x46')]=[{'all':!![]}];}return db[_0x2067('0x2e')]['findAll'](_0x2719c1);})['then'](function(_0x50971e){_0x5192f8['rows']=_0x50971e;return _0x5192f8;})[_0x2067('0x26')](respondWithFilteredResult(_0x127786,_0x2719c1))[_0x2067('0x47')](handleError(_0x127786,null));};exports[_0x2067('0x48')]=function(_0x3483d8,_0x5e824b){var _0x1216b9={'raw':!![],'where':{'id':_0x3483d8[_0x2067('0x49')]['id']}},_0x5bbd4b={};_0x5bbd4b[_0x2067('0x33')]=_['keys'](db[_0x2067('0x2e')][_0x2067('0x2f')]);_0x5bbd4b[_0x2067('0x34')]=_[_0x2067('0x35')](_0x3483d8[_0x2067('0x34')]);_0x5bbd4b[_0x2067('0x36')]=_[_0x2067('0x37')](_0x5bbd4b[_0x2067('0x33')],_0x5bbd4b[_0x2067('0x34')]);_0x1216b9[_0x2067('0x38')]=_[_0x2067('0x37')](_0x5bbd4b['model'],qs['fields'](_0x3483d8[_0x2067('0x34')][_0x2067('0x39')]));_0x1216b9[_0x2067('0x38')]=_0x1216b9[_0x2067('0x38')][_0x2067('0x3a')]?_0x1216b9['attributes']:_0x5bbd4b[_0x2067('0x33')];if(_0x3483d8[_0x2067('0x34')][_0x2067('0x45')]){_0x1216b9[_0x2067('0x46')]=[{'all':!![]}];}_0x1216b9=_['merge']({},_0x1216b9,_0x3483d8[_0x2067('0x4a')]);return db[_0x2067('0x2e')][_0x2067('0x4b')](_0x1216b9)[_0x2067('0x26')](handleEntityNotFound(_0x5e824b,null))['then'](respondWithResult(_0x5e824b,null))[_0x2067('0x47')](handleError(_0x5e824b,null));};exports[_0x2067('0x4c')]=function(_0x42fc66,_0x442808){return db[_0x2067('0x2e')]['create'](_0x42fc66['body'],{})['then'](function(_0x45f891){var _0x1f5e9d=_0x42fc66[_0x2067('0x4d')][_0x2067('0x27')]({'plain':!![]});if(!_0x1f5e9d)throw new Error(_0x2067('0x4e'));if(_0x1f5e9d[_0x2067('0x4f')]==='user'){var _0x2ebd0c=_0x45f891[_0x2067('0x27')]({'plain':!![]});var _0x3d4917=_0x2067('0x28');return db[_0x2067('0x50')][_0x2067('0x4b')]({'where':{'name':_0x3d4917,'userProfileId':_0x1f5e9d[_0x2067('0x51')]},'raw':!![]})[_0x2067('0x26')](function(_0x471efa){if(_0x471efa&&_0x471efa[_0x2067('0x52')]===0x0){return db[_0x2067('0x53')]['create']({'name':_0x2ebd0c[_0x2067('0x2b')],'resourceId':_0x2ebd0c['id'],'type':_0x471efa[_0x2067('0x2b')],'sectionId':_0x471efa['id']},{})[_0x2067('0x26')](function(){return _0x45f891;});}else{return _0x45f891;}})[_0x2067('0x47')](function(_0x492b49){logger[_0x2067('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x492b49);throw _0x492b49;});}return _0x45f891;})['then'](respondWithResult(_0x442808,0xc9))[_0x2067('0x47')](handleError(_0x442808,null));};exports[_0x2067('0x24')]=function(_0x38ff73,_0x5f2e70){if(_0x38ff73[_0x2067('0x54')]['id']){delete _0x38ff73['body']['id'];}return db[_0x2067('0x2e')]['find']({'where':{'id':_0x38ff73[_0x2067('0x49')]['id']}})[_0x2067('0x26')](handleEntityNotFound(_0x5f2e70,null))['then'](saveUpdates(_0x38ff73[_0x2067('0x54')],null))['then'](respondWithResult(_0x5f2e70,null))[_0x2067('0x47')](handleError(_0x5f2e70,null));};exports[_0x2067('0x25')]=function(_0x38eda3,_0x572272){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x38eda3[_0x2067('0x49')]['id']}})[_0x2067('0x26')](handleEntityNotFound(_0x572272,null))[_0x2067('0x26')](removeEntity(_0x572272,null))[_0x2067('0x47')](handleError(_0x572272,null));};exports[_0x2067('0x55')]=function(_0x2f47d3,_0x20e251,_0x2d0c1c){return db[_0x2067('0x2e')][_0x2067('0x4b')]({'where':{'id':_0x2f47d3[_0x2067('0x49')]['id']},'attributes':['name','basename','savename',_0x2067('0x56')],'raw':!![]})[_0x2067('0x26')](handleEntityNotFound(_0x20e251,null))[_0x2067('0x26')](function(_0x1afb65){if(_0x1afb65){if(!fs[_0x2067('0x57')](path[_0x2067('0x58')](config[_0x2067('0x59')],_0x2067('0x5a'),_0x1afb65[_0x2067('0x5b')]))){throw new db[(_0x2067('0x5c'))][(_0x2067('0x5d'))](_0x2067('0x5e'));}if(_0x2f47d3[_0x2067('0x34')][_0x2067('0x5f')]){return _0x20e251[_0x2067('0x29')](0xc8);}return _0x20e251[_0x2067('0x55')](path[_0x2067('0x58')](config['root'],'server/files/reports',_0x1afb65[_0x2067('0x5b')]),util[_0x2067('0x60')](_0x2067('0x61'),_0x1afb65['basename']||_0x1afb65[_0x2067('0x2b')],_0x1afb65[_0x2067('0x56')][_0x2067('0x62')]()));}})[_0x2067('0x47')](handleError(_0x20e251,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