Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 58f06b9..2045053 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f7b=['pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','intersection','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','nolimit','offset','order','sort','where'];(function(_0x2229de,_0x596a5b){var _0x25d05e=function(_0x2c8bda){while(--_0x2c8bda){_0x2229de['push'](_0x2229de['shift']());}};_0x25d05e(++_0x596a5b);}(_0x1f7b,0x81));var _0xb1f7=function(_0x5a91a5,_0x1eb099){_0x5a91a5=_0x5a91a5-0x0;var _0x8f99de=_0x1f7b[_0x5a91a5];return _0x8f99de;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb1f7('0x0'));var jsonpatch=require(_0xb1f7('0x1'));var rp=require(_0xb1f7('0x2'));var moment=require(_0xb1f7('0x3'));var BPromise=require(_0xb1f7('0x4'));var Mustache=require(_0xb1f7('0x5'));var util=require(_0xb1f7('0x6'));var path=require('path');var sox=require(_0xb1f7('0x7'));var csv=require(_0xb1f7('0x8'));var ejs=require(_0xb1f7('0x9'));var fs=require('fs');var _=require(_0xb1f7('0xa'));var squel=require(_0xb1f7('0xb'));var crypto=require(_0xb1f7('0xc'));var jsforce=require(_0xb1f7('0xd'));var deskjs=require(_0xb1f7('0xe'));var toCsv=require(_0xb1f7('0x8'));var querystring=require(_0xb1f7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb1f7('0x10'));var as=require(_0xb1f7('0x11'));var hardwareService=require(_0xb1f7('0x12'));var logger=require(_0xb1f7('0x13'))(_0xb1f7('0x14'));var utils=require('../../config/utils');var config=require(_0xb1f7('0x15'));var db=require(_0xb1f7('0x16'))['db'];function respondWithStatusCode(_0x111f64,_0x4f25b3){_0x4f25b3=_0x4f25b3||0xcc;return function(_0x236e63){if(_0x236e63){return _0x111f64[_0xb1f7('0x17')](_0x4f25b3);}return _0x111f64[_0xb1f7('0x18')](_0x4f25b3)[_0xb1f7('0x19')]();};}function respondWithResult(_0x3c5227,_0x985ac5){_0x985ac5=_0x985ac5||0xc8;return function(_0x1658ed){if(_0x1658ed){return _0x3c5227['status'](_0x985ac5)[_0xb1f7('0x1a')](_0x1658ed);}};}function respondWithFilteredResult(_0x25b1c3,_0x48e78d){return function(_0x2d9112){if(_0x2d9112){var _0x2716b6=_0x2d9112[_0xb1f7('0x1b')],_0x5cd37f=_0x48e78d['offset'],_0x3589de=_0x48e78d['offset']+_0x48e78d[_0xb1f7('0x1c')],_0x27e301;if(_0x3589de>=_0x2716b6){_0x3589de=_0x2716b6;_0x27e301=0xc8;}else{_0x27e301=0xce;}_0x25b1c3[_0xb1f7('0x18')](_0x27e301);return _0x25b1c3[_0xb1f7('0x1d')](_0xb1f7('0x1e'),_0x5cd37f+'-'+_0x3589de+'/'+_0x2716b6)[_0xb1f7('0x1a')](_0x2d9112);}return null;};}function patchUpdates(_0x151e6a){return function(_0x228580){try{jsonpatch[_0xb1f7('0x1f')](_0x228580,_0x151e6a,!![]);}catch(_0x48581c){return BPromise[_0xb1f7('0x20')](_0x48581c);}return _0x228580[_0xb1f7('0x21')]();};}function saveUpdates(_0x2041c0,_0x2a1b1e){return function(_0x289006){if(_0x289006){return _0x289006[_0xb1f7('0x22')](_0x2041c0)['then'](function(_0x496d0e){return _0x496d0e;});}return null;};}function removeEntity(_0x244ef5,_0x41fe58){return function(_0x534c11){if(_0x534c11){return _0x534c11[_0xb1f7('0x23')]()[_0xb1f7('0x24')](function(){var _0x4c3db3=_0x534c11[_0xb1f7('0x25')]({'plain':!![]});var _0x1e79c5=_0xb1f7('0x26');return db[_0xb1f7('0x27')][_0xb1f7('0x23')]({'where':{'type':_0x1e79c5,'resourceId':_0x4c3db3['id']}})[_0xb1f7('0x24')](function(){return _0x534c11;});})[_0xb1f7('0x24')](function(){_0x244ef5[_0xb1f7('0x18')](0xcc)[_0xb1f7('0x19')]();});}};}function handleEntityNotFound(_0x2c8bbb,_0x538676){return function(_0x44093b){if(!_0x44093b){_0x2c8bbb[_0xb1f7('0x17')](0x194);}return _0x44093b;};}function handleError(_0x10f4bc,_0x37aa4c){_0x37aa4c=_0x37aa4c||0x1f4;return function(_0x245b66){logger[_0xb1f7('0x28')](_0x245b66[_0xb1f7('0x29')]);if(_0x245b66[_0xb1f7('0x2a')]){delete _0x245b66[_0xb1f7('0x2a')];}_0x10f4bc[_0xb1f7('0x18')](_0x37aa4c)[_0xb1f7('0x2b')](_0x245b66);};}exports[_0xb1f7('0x2c')]=function(_0x41b942,_0x5c9120){var _0x36b1cd={},_0x175e42={},_0x2ed355={'count':0x0,'rows':[]};var _0x184ae6=_[_0xb1f7('0x2d')](db[_0xb1f7('0x2e')][_0xb1f7('0x2f')],function(_0x57983f){return{'name':_0x57983f[_0xb1f7('0x30')],'type':_0x57983f[_0xb1f7('0x31')][_0xb1f7('0x32')]};});_0x175e42['model']=_[_0xb1f7('0x2d')](_0x184ae6,_0xb1f7('0x2a'));_0x175e42[_0xb1f7('0x33')]=_['keys'](_0x41b942['query']);_0x175e42[_0xb1f7('0x34')]=_['intersection'](_0x175e42[_0xb1f7('0x35')],_0x175e42[_0xb1f7('0x33')]);_0x36b1cd['attributes']=_['intersection'](_0x175e42['model'],qs[_0xb1f7('0x36')](_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x36')]));_0x36b1cd[_0xb1f7('0x37')]=_0x36b1cd[_0xb1f7('0x37')]['length']?_0x36b1cd[_0xb1f7('0x37')]:_0x175e42[_0xb1f7('0x35')];if(!_0x41b942['query']['hasOwnProperty'](_0xb1f7('0x38'))){_0x36b1cd[_0xb1f7('0x1c')]=qs[_0xb1f7('0x1c')](_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x1c')]);_0x36b1cd[_0xb1f7('0x39')]=qs[_0xb1f7('0x39')](_0x41b942[_0xb1f7('0x33')]['offset']);}_0x36b1cd[_0xb1f7('0x3a')]=qs[_0xb1f7('0x3b')](_0x41b942['query']['sort']);_0x36b1cd[_0xb1f7('0x3c')]=qs[_0xb1f7('0x34')](_[_0xb1f7('0x3d')](_0x41b942[_0xb1f7('0x33')],_0x175e42[_0xb1f7('0x34')]),_0x184ae6);if(_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x3e')]){_0x36b1cd[_0xb1f7('0x3c')]=_['merge'](_0x36b1cd['where'],{'$or':_[_0xb1f7('0x2d')](_0x184ae6,function(_0x49ece7){if(_0x49ece7['type']!==_0xb1f7('0x3f')){var _0x573681={};_0x573681[_0x49ece7[_0xb1f7('0x2a')]]={'$like':'%'+_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x3e')]+'%'};return _0x573681;}})});}_0x36b1cd=_[_0xb1f7('0x40')]({},_0x36b1cd,_0x41b942[_0xb1f7('0x41')]);var _0x5dbc14={'where':_0x36b1cd[_0xb1f7('0x3c')]};return db[_0xb1f7('0x2e')][_0xb1f7('0x1b')](_0x5dbc14)['then'](function(_0x2911d1){_0x2ed355[_0xb1f7('0x1b')]=_0x2911d1;if(_0x41b942[_0xb1f7('0x33')][_0xb1f7('0x42')]){_0x36b1cd['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xb1f7('0x43')](_0x36b1cd);})['then'](function(_0x5c0479){_0x2ed355['rows']=_0x5c0479;return _0x2ed355;})[_0xb1f7('0x24')](respondWithFilteredResult(_0x5c9120,_0x36b1cd))[_0xb1f7('0x44')](handleError(_0x5c9120,null));};exports[_0xb1f7('0x45')]=function(_0x1604d6,_0x1f32b8){var _0x4938b3={'raw':!![],'where':{'id':_0x1604d6[_0xb1f7('0x46')]['id']}},_0x48d248={};_0x48d248[_0xb1f7('0x35')]=_['keys'](db['AnalyticExtractedReport'][_0xb1f7('0x2f')]);_0x48d248['query']=_[_0xb1f7('0x47')](_0x1604d6['query']);_0x48d248[_0xb1f7('0x34')]=_[_0xb1f7('0x48')](_0x48d248['model'],_0x48d248[_0xb1f7('0x33')]);_0x4938b3[_0xb1f7('0x37')]=_[_0xb1f7('0x48')](_0x48d248[_0xb1f7('0x35')],qs['fields'](_0x1604d6['query'][_0xb1f7('0x36')]));_0x4938b3[_0xb1f7('0x37')]=_0x4938b3['attributes'][_0xb1f7('0x49')]?_0x4938b3[_0xb1f7('0x37')]:_0x48d248[_0xb1f7('0x35')];if(_0x1604d6[_0xb1f7('0x33')][_0xb1f7('0x42')]){_0x4938b3['include']=[{'all':!![]}];}_0x4938b3=_[_0xb1f7('0x40')]({},_0x4938b3,_0x1604d6[_0xb1f7('0x41')]);return db['AnalyticExtractedReport']['find'](_0x4938b3)[_0xb1f7('0x24')](handleEntityNotFound(_0x1f32b8,null))[_0xb1f7('0x24')](respondWithResult(_0x1f32b8,null))['catch'](handleError(_0x1f32b8,null));};exports[_0xb1f7('0x4a')]=function(_0x37bc9a,_0x1ab427){return db[_0xb1f7('0x2e')][_0xb1f7('0x4a')](_0x37bc9a['body'],{})[_0xb1f7('0x24')](function(_0x12ece4){var _0xed0ef=_0x37bc9a[_0xb1f7('0x4b')][_0xb1f7('0x25')]({'plain':!![]});if(!_0xed0ef)throw new Error(_0xb1f7('0x4c'));if(_0xed0ef[_0xb1f7('0x4d')]===_0xb1f7('0x4b')){var _0x18dab9=_0x12ece4['get']({'plain':!![]});var _0xf096ea=_0xb1f7('0x26');return db['UserProfileSection'][_0xb1f7('0x4e')]({'where':{'name':_0xf096ea,'userProfileId':_0xed0ef[_0xb1f7('0x4f')]},'raw':!![]})[_0xb1f7('0x24')](function(_0x22bc57){if(_0x22bc57&&_0x22bc57[_0xb1f7('0x50')]===0x0){return db[_0xb1f7('0x27')][_0xb1f7('0x4a')]({'name':_0x18dab9['name'],'resourceId':_0x18dab9['id'],'type':_0x22bc57[_0xb1f7('0x2a')],'sectionId':_0x22bc57['id']},{})[_0xb1f7('0x24')](function(){return _0x12ece4;});}else{return _0x12ece4;}})[_0xb1f7('0x44')](function(_0x3b8679){logger[_0xb1f7('0x28')](_0xb1f7('0x51'),_0x3b8679);throw _0x3b8679;});}return _0x12ece4;})[_0xb1f7('0x24')](respondWithResult(_0x1ab427,0xc9))[_0xb1f7('0x44')](handleError(_0x1ab427,null));};exports[_0xb1f7('0x22')]=function(_0x2bcaf0,_0x284bc7){if(_0x2bcaf0[_0xb1f7('0x52')]['id']){delete _0x2bcaf0[_0xb1f7('0x52')]['id'];}return db['AnalyticExtractedReport'][_0xb1f7('0x4e')]({'where':{'id':_0x2bcaf0[_0xb1f7('0x46')]['id']}})[_0xb1f7('0x24')](handleEntityNotFound(_0x284bc7,null))[_0xb1f7('0x24')](saveUpdates(_0x2bcaf0[_0xb1f7('0x52')],null))[_0xb1f7('0x24')](respondWithResult(_0x284bc7,null))[_0xb1f7('0x44')](handleError(_0x284bc7,null));};exports['destroy']=function(_0x1ae7f2,_0x16bc1b){return db[_0xb1f7('0x2e')]['find']({'where':{'id':_0x1ae7f2['params']['id']}})[_0xb1f7('0x24')](handleEntityNotFound(_0x16bc1b,null))[_0xb1f7('0x24')](removeEntity(_0x16bc1b,null))[_0xb1f7('0x44')](handleError(_0x16bc1b,null));};exports[_0xb1f7('0x53')]=function(_0x5033d8,_0x368008,_0x1f1c7f){return db[_0xb1f7('0x2e')]['find']({'where':{'id':_0x5033d8[_0xb1f7('0x46')]['id']},'attributes':[_0xb1f7('0x2a'),'basename',_0xb1f7('0x54'),_0xb1f7('0x55')],'raw':!![]})[_0xb1f7('0x24')](handleEntityNotFound(_0x368008,null))[_0xb1f7('0x24')](function(_0x299783){if(_0x299783){if(!fs['existsSync'](path[_0xb1f7('0x56')](config[_0xb1f7('0x57')],_0xb1f7('0x58'),_0x299783['savename']))){throw new db[(_0xb1f7('0x59'))][(_0xb1f7('0x5a'))](_0xb1f7('0x5b'));}if(_0x5033d8[_0xb1f7('0x33')]['exists']){return _0x368008[_0xb1f7('0x17')](0xc8);}return _0x368008['download'](path['join'](config[_0xb1f7('0x57')],_0xb1f7('0x58'),_0x299783['savename']),util[_0xb1f7('0x5c')](_0xb1f7('0x5d'),_0x299783['basename']||_0x299783['name'],_0x299783[_0xb1f7('0x55')][_0xb1f7('0x5e')]()));}})['catch'](handleError(_0x368008,null));};
\ No newline at end of file
+var _0x6ac0=['%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','name','send','index','map','AnalyticExtractedReport','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','update','body','download','basename','savename','output','existsSync','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format'];(function(_0x1f0e4a,_0x44079d){var _0x5b92df=function(_0x55b4b3){while(--_0x55b4b3){_0x1f0e4a['push'](_0x1f0e4a['shift']());}};_0x5b92df(++_0x44079d);}(_0x6ac0,0x172));var _0x06ac=function(_0x37e7aa,_0x770964){_0x37e7aa=_0x37e7aa-0x0;var _0xc7c828=_0x6ac0[_0x37e7aa];return _0xc7c828;};'use strict';var emlformat=require(_0x06ac('0x0'));var rimraf=require(_0x06ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06ac('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x06ac('0x3'));var Mustache=require(_0x06ac('0x4'));var util=require(_0x06ac('0x5'));var path=require(_0x06ac('0x6'));var sox=require(_0x06ac('0x7'));var csv=require('to-csv');var ejs=require(_0x06ac('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06ac('0x9'));var squel=require(_0x06ac('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x06ac('0xb'));var toCsv=require(_0x06ac('0xc'));var querystring=require(_0x06ac('0xd'));var Papa=require('papaparse');var Redis=require(_0x06ac('0xe'));var authService=require(_0x06ac('0xf'));var qs=require(_0x06ac('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06ac('0x11'));var logger=require(_0x06ac('0x12'))(_0x06ac('0x13'));var utils=require(_0x06ac('0x14'));var config=require(_0x06ac('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x06ac('0x16'))['db'];function respondWithStatusCode(_0x3b7f7c,_0x3a0e6a){_0x3a0e6a=_0x3a0e6a||0xcc;return function(_0x36c506){if(_0x36c506){return _0x3b7f7c['sendStatus'](_0x3a0e6a);}return _0x3b7f7c[_0x06ac('0x17')](_0x3a0e6a)[_0x06ac('0x18')]();};}function respondWithResult(_0x3025c0,_0x3de61f){_0x3de61f=_0x3de61f||0xc8;return function(_0x59cbfa){if(_0x59cbfa){return _0x3025c0[_0x06ac('0x17')](_0x3de61f)['json'](_0x59cbfa);}};}function respondWithFilteredResult(_0x45d676,_0x4960c8){return function(_0x481e52){if(_0x481e52){var _0x168cb1=typeof _0x4960c8['offset']==='undefined'&&typeof _0x4960c8['limit']==='undefined';var _0x269a65=_0x481e52[_0x06ac('0x19')];var _0x3e4f76=_0x168cb1?0x0:_0x4960c8[_0x06ac('0x1a')];var _0x53e4da=_0x168cb1?_0x481e52[_0x06ac('0x19')]:_0x4960c8[_0x06ac('0x1a')]+_0x4960c8[_0x06ac('0x1b')];var _0x5510c2;if(_0x53e4da>=_0x269a65){_0x53e4da=_0x269a65;_0x5510c2=0xc8;}else{_0x5510c2=0xce;}_0x45d676[_0x06ac('0x17')](_0x5510c2);return _0x45d676[_0x06ac('0x1c')](_0x06ac('0x1d'),_0x3e4f76+'-'+_0x53e4da+'/'+_0x269a65)['json'](_0x481e52);}return null;};}function patchUpdates(_0x2f6344){return function(_0x21f360){try{jsonpatch['apply'](_0x21f360,_0x2f6344,!![]);}catch(_0x555c84){return BPromise[_0x06ac('0x1e')](_0x555c84);}return _0x21f360[_0x06ac('0x1f')]();};}function saveUpdates(_0x3e9e0d,_0x5d9185){return function(_0x17188b){if(_0x17188b){return _0x17188b['update'](_0x3e9e0d)[_0x06ac('0x20')](function(_0x5bc600){return _0x5bc600;});}return null;};}function removeEntity(_0x4d658c,_0x447bc0){return function(_0x34a85f){if(_0x34a85f){return _0x34a85f[_0x06ac('0x21')]()[_0x06ac('0x20')](function(){var _0x1bdfbf=_0x34a85f[_0x06ac('0x22')]({'plain':!![]});var _0x581705=_0x06ac('0x23');return db[_0x06ac('0x24')][_0x06ac('0x21')]({'where':{'type':_0x581705,'resourceId':_0x1bdfbf['id']}})[_0x06ac('0x20')](function(){return _0x34a85f;});})[_0x06ac('0x20')](function(){_0x4d658c[_0x06ac('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dad6a,_0x3215a6){return function(_0x38be8b){if(!_0x38be8b){_0x3dad6a[_0x06ac('0x25')](0x194);}return _0x38be8b;};}function handleError(_0x23b10a,_0x1cfe5b){_0x1cfe5b=_0x1cfe5b||0x1f4;return function(_0x193aee){logger[_0x06ac('0x26')](_0x193aee['stack']);if(_0x193aee[_0x06ac('0x27')]){delete _0x193aee['name'];}_0x23b10a['status'](_0x1cfe5b)[_0x06ac('0x28')](_0x193aee);};}exports[_0x06ac('0x29')]=function(_0x5da242,_0x526a9d){var _0x1261ed={},_0x3d5d86={},_0x2eea1b={'count':0x0,'rows':[]};var _0x57e38b=_[_0x06ac('0x2a')](db[_0x06ac('0x2b')]['rawAttributes'],function(_0x141448){return{'name':_0x141448[_0x06ac('0x2c')],'type':_0x141448['type']['key']};});_0x3d5d86[_0x06ac('0x2d')]=_[_0x06ac('0x2a')](_0x57e38b,_0x06ac('0x27'));_0x3d5d86[_0x06ac('0x2e')]=_[_0x06ac('0x2f')](_0x5da242[_0x06ac('0x2e')]);_0x3d5d86[_0x06ac('0x30')]=_[_0x06ac('0x31')](_0x3d5d86['model'],_0x3d5d86[_0x06ac('0x2e')]);_0x1261ed[_0x06ac('0x32')]=_[_0x06ac('0x31')](_0x3d5d86[_0x06ac('0x2d')],qs[_0x06ac('0x33')](_0x5da242[_0x06ac('0x2e')][_0x06ac('0x33')]));_0x1261ed[_0x06ac('0x32')]=_0x1261ed[_0x06ac('0x32')][_0x06ac('0x34')]?_0x1261ed[_0x06ac('0x32')]:_0x3d5d86[_0x06ac('0x2d')];if(!_0x5da242[_0x06ac('0x2e')][_0x06ac('0x35')](_0x06ac('0x36'))){_0x1261ed[_0x06ac('0x1b')]=qs[_0x06ac('0x1b')](_0x5da242[_0x06ac('0x2e')]['limit']);_0x1261ed[_0x06ac('0x1a')]=qs[_0x06ac('0x1a')](_0x5da242[_0x06ac('0x2e')][_0x06ac('0x1a')]);}_0x1261ed[_0x06ac('0x37')]=qs[_0x06ac('0x38')](_0x5da242[_0x06ac('0x2e')][_0x06ac('0x38')]);_0x1261ed[_0x06ac('0x39')]=qs[_0x06ac('0x30')](_[_0x06ac('0x3a')](_0x5da242['query'],_0x3d5d86[_0x06ac('0x30')]),_0x57e38b);if(_0x5da242[_0x06ac('0x2e')][_0x06ac('0x3b')]){_0x1261ed[_0x06ac('0x39')]=_['merge'](_0x1261ed[_0x06ac('0x39')],{'$or':_[_0x06ac('0x2a')](_0x57e38b,function(_0x1f0949){if(_0x1f0949['type']!==_0x06ac('0x3c')){var _0x5f336c={};_0x5f336c[_0x1f0949[_0x06ac('0x27')]]={'$like':'%'+_0x5da242[_0x06ac('0x2e')]['filter']+'%'};return _0x5f336c;}})});}_0x1261ed=_[_0x06ac('0x3d')]({},_0x1261ed,_0x5da242['options']);var _0x409ee1={'where':_0x1261ed[_0x06ac('0x39')]};return db[_0x06ac('0x2b')][_0x06ac('0x19')](_0x409ee1)[_0x06ac('0x20')](function(_0xfdfe7){_0x2eea1b[_0x06ac('0x19')]=_0xfdfe7;if(_0x5da242[_0x06ac('0x2e')][_0x06ac('0x3e')]){_0x1261ed[_0x06ac('0x3f')]=[{'all':!![]}];}return db[_0x06ac('0x2b')][_0x06ac('0x40')](_0x1261ed);})[_0x06ac('0x20')](function(_0x503915){_0x2eea1b['rows']=_0x503915;return _0x2eea1b;})['then'](respondWithFilteredResult(_0x526a9d,_0x1261ed))[_0x06ac('0x41')](handleError(_0x526a9d,null));};exports[_0x06ac('0x42')]=function(_0x513586,_0x28bfc7){var _0x5bc4cc={'raw':!![],'where':{'id':_0x513586[_0x06ac('0x43')]['id']}},_0x458a56={};_0x458a56[_0x06ac('0x2d')]=_['keys'](db[_0x06ac('0x2b')][_0x06ac('0x44')]);_0x458a56[_0x06ac('0x2e')]=_[_0x06ac('0x2f')](_0x513586[_0x06ac('0x2e')]);_0x458a56[_0x06ac('0x30')]=_[_0x06ac('0x31')](_0x458a56[_0x06ac('0x2d')],_0x458a56[_0x06ac('0x2e')]);_0x5bc4cc['attributes']=_[_0x06ac('0x31')](_0x458a56[_0x06ac('0x2d')],qs[_0x06ac('0x33')](_0x513586[_0x06ac('0x2e')][_0x06ac('0x33')]));_0x5bc4cc[_0x06ac('0x32')]=_0x5bc4cc[_0x06ac('0x32')][_0x06ac('0x34')]?_0x5bc4cc['attributes']:_0x458a56['model'];if(_0x513586[_0x06ac('0x2e')][_0x06ac('0x3e')]){_0x5bc4cc[_0x06ac('0x3f')]=[{'all':!![]}];}_0x5bc4cc=_['merge']({},_0x5bc4cc,_0x513586[_0x06ac('0x45')]);return db['AnalyticExtractedReport']['find'](_0x5bc4cc)[_0x06ac('0x20')](handleEntityNotFound(_0x28bfc7,null))['then'](respondWithResult(_0x28bfc7,null))[_0x06ac('0x41')](handleError(_0x28bfc7,null));};exports['create']=function(_0x630476,_0x2548e3){return db[_0x06ac('0x2b')][_0x06ac('0x46')](_0x630476['body'],{})[_0x06ac('0x20')](function(_0x3c894c){var _0x77af54=_0x630476['user']['get']({'plain':!![]});if(!_0x77af54)throw new Error(_0x06ac('0x47'));if(_0x77af54['role']===_0x06ac('0x48')){var _0x1732ec=_0x3c894c[_0x06ac('0x22')]({'plain':!![]});var _0x342448=_0x06ac('0x23');return db[_0x06ac('0x49')][_0x06ac('0x4a')]({'where':{'name':_0x342448,'userProfileId':_0x77af54['userProfileId']},'raw':!![]})[_0x06ac('0x20')](function(_0x89ca6b){if(_0x89ca6b&&_0x89ca6b[_0x06ac('0x4b')]===0x0){return db[_0x06ac('0x24')]['create']({'name':_0x1732ec[_0x06ac('0x27')],'resourceId':_0x1732ec['id'],'type':_0x89ca6b[_0x06ac('0x27')],'sectionId':_0x89ca6b['id']},{})['then'](function(){return _0x3c894c;});}else{return _0x3c894c;}})[_0x06ac('0x41')](function(_0x1ad341){logger[_0x06ac('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ad341);throw _0x1ad341;});}return _0x3c894c;})[_0x06ac('0x20')](respondWithResult(_0x2548e3,0xc9))[_0x06ac('0x41')](handleError(_0x2548e3,null));};exports[_0x06ac('0x4c')]=function(_0x4226d4,_0x4db7b0){if(_0x4226d4[_0x06ac('0x4d')]['id']){delete _0x4226d4[_0x06ac('0x4d')]['id'];}return db[_0x06ac('0x2b')][_0x06ac('0x4a')]({'where':{'id':_0x4226d4[_0x06ac('0x43')]['id']}})[_0x06ac('0x20')](handleEntityNotFound(_0x4db7b0,null))[_0x06ac('0x20')](saveUpdates(_0x4226d4[_0x06ac('0x4d')],null))[_0x06ac('0x20')](respondWithResult(_0x4db7b0,null))[_0x06ac('0x41')](handleError(_0x4db7b0,null));};exports[_0x06ac('0x21')]=function(_0x471afc,_0xde2ec4){return db[_0x06ac('0x2b')][_0x06ac('0x4a')]({'where':{'id':_0x471afc[_0x06ac('0x43')]['id']}})[_0x06ac('0x20')](handleEntityNotFound(_0xde2ec4,null))[_0x06ac('0x20')](removeEntity(_0xde2ec4,null))[_0x06ac('0x41')](handleError(_0xde2ec4,null));};exports[_0x06ac('0x4e')]=function(_0x258fe8,_0x265df7,_0x5471e9){return db[_0x06ac('0x2b')][_0x06ac('0x4a')]({'where':{'id':_0x258fe8[_0x06ac('0x43')]['id']},'attributes':[_0x06ac('0x27'),_0x06ac('0x4f'),_0x06ac('0x50'),_0x06ac('0x51')],'raw':!![]})[_0x06ac('0x20')](handleEntityNotFound(_0x265df7,null))['then'](function(_0x5bd552){if(_0x5bd552){if(!fs[_0x06ac('0x52')](path['join'](config[_0x06ac('0x53')],'server/files/reports',_0x5bd552[_0x06ac('0x50')]))){throw new db[(_0x06ac('0x54'))][(_0x06ac('0x55'))](_0x06ac('0x56'));}if(_0x258fe8[_0x06ac('0x2e')][_0x06ac('0x57')]){return _0x265df7[_0x06ac('0x25')](0xc8);}return _0x265df7['download'](path['join'](config[_0x06ac('0x53')],_0x06ac('0x58'),_0x5bd552[_0x06ac('0x50')]),util[_0x06ac('0x59')](_0x06ac('0x5a'),_0x5bd552[_0x06ac('0x4f')]||_0x5bd552[_0x06ac('0x27')],_0x5bd552[_0x06ac('0x51')][_0x06ac('0x5b')]()));}})[_0x06ac('0x41')](handleError(_0x265df7,null));};
\ No newline at end of file