Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index ce77fdb..e7240aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3275=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','get','ExtractedReports','UserProfileResource','end','stack','name','send','index','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','output','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format'];(function(_0x182fa4,_0x936799){var _0x6366ad=function(_0x336daf){while(--_0x336daf){_0x182fa4['push'](_0x182fa4['shift']());}};_0x6366ad(++_0x936799);}(_0x3275,0x173));var _0x5327=function(_0x5513b7,_0x4e3656){_0x5513b7=_0x5513b7-0x0;var _0x565a85=_0x3275[_0x5513b7];return _0x565a85;};'use strict';var emlformat=require(_0x5327('0x0'));var rimraf=require(_0x5327('0x1'));var zipdir=require(_0x5327('0x2'));var jsonpatch=require(_0x5327('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5327('0x4'));var Mustache=require(_0x5327('0x5'));var util=require(_0x5327('0x6'));var path=require('path');var sox=require(_0x5327('0x7'));var csv=require(_0x5327('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5327('0x9'));var _=require(_0x5327('0xa'));var squel=require(_0x5327('0xb'));var crypto=require(_0x5327('0xc'));var jsforce=require(_0x5327('0xd'));var deskjs=require(_0x5327('0xe'));var toCsv=require(_0x5327('0x8'));var querystring=require(_0x5327('0xf'));var Papa=require(_0x5327('0x10'));var Redis=require(_0x5327('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5327('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5327('0x13'));var logger=require(_0x5327('0x14'))(_0x5327('0x15'));var utils=require(_0x5327('0x16'));var config=require(_0x5327('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551812,_0x54e36f){_0x54e36f=_0x54e36f||0xcc;return function(_0x57b778){if(_0x57b778){return _0x551812[_0x5327('0x18')](_0x54e36f);}return _0x551812['status'](_0x54e36f)['end']();};}function respondWithResult(_0x48274d,_0x6d11e5){_0x6d11e5=_0x6d11e5||0xc8;return function(_0x325ac1){if(_0x325ac1){return _0x48274d[_0x5327('0x19')](_0x6d11e5)[_0x5327('0x1a')](_0x325ac1);}};}function respondWithFilteredResult(_0x2d1709,_0x22ea54){return function(_0x51d634){if(_0x51d634){var _0x37823b=typeof _0x22ea54[_0x5327('0x1b')]===_0x5327('0x1c')&&typeof _0x22ea54['limit']===_0x5327('0x1c');var _0x5343ea=_0x51d634['count'];var _0x87929=_0x37823b?0x0:_0x22ea54[_0x5327('0x1b')];var _0x5223c7=_0x37823b?_0x51d634[_0x5327('0x1d')]:_0x22ea54[_0x5327('0x1b')]+_0x22ea54[_0x5327('0x1e')];var _0x5df6ff;if(_0x5223c7>=_0x5343ea){_0x5223c7=_0x5343ea;_0x5df6ff=0xc8;}else{_0x5df6ff=0xce;}_0x2d1709['status'](_0x5df6ff);return _0x2d1709[_0x5327('0x1f')](_0x5327('0x20'),_0x87929+'-'+_0x5223c7+'/'+_0x5343ea)['json'](_0x51d634);}return null;};}function patchUpdates(_0x4fc380){return function(_0x417226){try{jsonpatch['apply'](_0x417226,_0x4fc380,!![]);}catch(_0x157d76){return BPromise[_0x5327('0x21')](_0x157d76);}return _0x417226['save']();};}function saveUpdates(_0x5ad4d3,_0x522fb7){return function(_0x511824){if(_0x511824){return _0x511824['update'](_0x5ad4d3)[_0x5327('0x22')](function(_0x1e5d9c){return _0x1e5d9c;});}return null;};}function removeEntity(_0x18ecf2,_0xd01e4e){return function(_0x2b5edc){if(_0x2b5edc){return _0x2b5edc[_0x5327('0x23')]()[_0x5327('0x22')](function(){var _0x50d2e2=_0x2b5edc[_0x5327('0x24')]({'plain':!![]});var _0x42fe78=_0x5327('0x25');return db[_0x5327('0x26')][_0x5327('0x23')]({'where':{'type':_0x42fe78,'resourceId':_0x50d2e2['id']}})['then'](function(){return _0x2b5edc;});})['then'](function(){_0x18ecf2[_0x5327('0x19')](0xcc)[_0x5327('0x27')]();});}};}function handleEntityNotFound(_0x3928e0,_0x4b5fef){return function(_0x3b0783){if(!_0x3b0783){_0x3928e0[_0x5327('0x18')](0x194);}return _0x3b0783;};}function handleError(_0xef749c,_0x19193f){_0x19193f=_0x19193f||0x1f4;return function(_0x39e4c1){logger['error'](_0x39e4c1[_0x5327('0x28')]);if(_0x39e4c1[_0x5327('0x29')]){delete _0x39e4c1[_0x5327('0x29')];}_0xef749c[_0x5327('0x19')](_0x19193f)[_0x5327('0x2a')](_0x39e4c1);};}exports[_0x5327('0x2b')]=function(_0x587f24,_0xb2b50f){var _0x2c5cb6={},_0x4faaf7={},_0x5e916b={'count':0x0,'rows':[]};var _0x23d60b=_['map'](db[_0x5327('0x2c')]['rawAttributes'],function(_0x5cc805){return{'name':_0x5cc805[_0x5327('0x2d')],'type':_0x5cc805[_0x5327('0x2e')][_0x5327('0x2f')]};});_0x4faaf7[_0x5327('0x30')]=_['map'](_0x23d60b,'name');_0x4faaf7[_0x5327('0x31')]=_[_0x5327('0x32')](_0x587f24[_0x5327('0x31')]);_0x4faaf7[_0x5327('0x33')]=_['intersection'](_0x4faaf7['model'],_0x4faaf7[_0x5327('0x31')]);_0x2c5cb6['attributes']=_[_0x5327('0x34')](_0x4faaf7[_0x5327('0x30')],qs[_0x5327('0x35')](_0x587f24[_0x5327('0x31')][_0x5327('0x35')]));_0x2c5cb6[_0x5327('0x36')]=_0x2c5cb6[_0x5327('0x36')][_0x5327('0x37')]?_0x2c5cb6[_0x5327('0x36')]:_0x4faaf7['model'];if(!_0x587f24[_0x5327('0x31')]['hasOwnProperty'](_0x5327('0x38'))){_0x2c5cb6[_0x5327('0x1e')]=qs[_0x5327('0x1e')](_0x587f24['query'][_0x5327('0x1e')]);_0x2c5cb6['offset']=qs[_0x5327('0x1b')](_0x587f24[_0x5327('0x31')][_0x5327('0x1b')]);}_0x2c5cb6[_0x5327('0x39')]=qs[_0x5327('0x3a')](_0x587f24['query'][_0x5327('0x3a')]);_0x2c5cb6[_0x5327('0x3b')]=qs[_0x5327('0x33')](_[_0x5327('0x3c')](_0x587f24[_0x5327('0x31')],_0x4faaf7[_0x5327('0x33')]),_0x23d60b);if(_0x587f24[_0x5327('0x31')][_0x5327('0x3d')]){_0x2c5cb6[_0x5327('0x3b')]=_['merge'](_0x2c5cb6[_0x5327('0x3b')],{'$or':_[_0x5327('0x3e')](_0x23d60b,function(_0x3fbc6b){if(_0x3fbc6b['type']!==_0x5327('0x3f')){var _0xf683c1={};_0xf683c1[_0x3fbc6b[_0x5327('0x29')]]={'$like':'%'+_0x587f24['query'][_0x5327('0x3d')]+'%'};return _0xf683c1;}})});}_0x2c5cb6=_['merge']({},_0x2c5cb6,_0x587f24[_0x5327('0x40')]);var _0x4a9c02={'where':_0x2c5cb6[_0x5327('0x3b')]};return db[_0x5327('0x2c')][_0x5327('0x1d')](_0x4a9c02)[_0x5327('0x22')](function(_0x331de1){_0x5e916b['count']=_0x331de1;if(_0x587f24[_0x5327('0x31')][_0x5327('0x41')]){_0x2c5cb6[_0x5327('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x2c5cb6);})[_0x5327('0x22')](function(_0x3364c8){_0x5e916b['rows']=_0x3364c8;return _0x5e916b;})[_0x5327('0x22')](respondWithFilteredResult(_0xb2b50f,_0x2c5cb6))[_0x5327('0x43')](handleError(_0xb2b50f,null));};exports[_0x5327('0x44')]=function(_0x13a0d3,_0x1b0a6e){var _0x3ea097={'raw':!![],'where':{'id':_0x13a0d3[_0x5327('0x45')]['id']}},_0x5a5420={};_0x5a5420[_0x5327('0x30')]=_[_0x5327('0x32')](db[_0x5327('0x2c')][_0x5327('0x46')]);_0x5a5420[_0x5327('0x31')]=_[_0x5327('0x32')](_0x13a0d3[_0x5327('0x31')]);_0x5a5420[_0x5327('0x33')]=_['intersection'](_0x5a5420[_0x5327('0x30')],_0x5a5420['query']);_0x3ea097[_0x5327('0x36')]=_[_0x5327('0x34')](_0x5a5420[_0x5327('0x30')],qs[_0x5327('0x35')](_0x13a0d3[_0x5327('0x31')][_0x5327('0x35')]));_0x3ea097[_0x5327('0x36')]=_0x3ea097['attributes']['length']?_0x3ea097[_0x5327('0x36')]:_0x5a5420[_0x5327('0x30')];if(_0x13a0d3[_0x5327('0x31')][_0x5327('0x41')]){_0x3ea097[_0x5327('0x42')]=[{'all':!![]}];}_0x3ea097=_[_0x5327('0x47')]({},_0x3ea097,_0x13a0d3[_0x5327('0x40')]);return db[_0x5327('0x2c')][_0x5327('0x48')](_0x3ea097)[_0x5327('0x22')](handleEntityNotFound(_0x1b0a6e,null))['then'](respondWithResult(_0x1b0a6e,null))[_0x5327('0x43')](handleError(_0x1b0a6e,null));};exports[_0x5327('0x49')]=function(_0x3b0148,_0x4ab7c6){return db[_0x5327('0x2c')][_0x5327('0x49')](_0x3b0148[_0x5327('0x4a')],{})[_0x5327('0x22')](function(_0x203eee){var _0x54ebf4=_0x3b0148[_0x5327('0x4b')][_0x5327('0x24')]({'plain':!![]});if(!_0x54ebf4)throw new Error(_0x5327('0x4c'));if(_0x54ebf4['role']==='user'){var _0x3e2635=_0x203eee[_0x5327('0x24')]({'plain':!![]});var _0xedc3b9=_0x5327('0x25');return db[_0x5327('0x4d')][_0x5327('0x48')]({'where':{'name':_0xedc3b9,'userProfileId':_0x54ebf4['userProfileId']},'raw':!![]})['then'](function(_0x5eb8a1){if(_0x5eb8a1&&_0x5eb8a1['autoAssociation']===0x0){return db[_0x5327('0x26')][_0x5327('0x49')]({'name':_0x3e2635[_0x5327('0x29')],'resourceId':_0x3e2635['id'],'type':_0x5eb8a1['name'],'sectionId':_0x5eb8a1['id']},{})['then'](function(){return _0x203eee;});}else{return _0x203eee;}})['catch'](function(_0x730754){logger[_0x5327('0x4e')](_0x5327('0x4f'),_0x730754);throw _0x730754;});}return _0x203eee;})[_0x5327('0x22')](respondWithResult(_0x4ab7c6,0xc9))[_0x5327('0x43')](handleError(_0x4ab7c6,null));};exports[_0x5327('0x50')]=function(_0x2026a2,_0x4942dc){if(_0x2026a2[_0x5327('0x4a')]['id']){delete _0x2026a2['body']['id'];}return db[_0x5327('0x2c')][_0x5327('0x48')]({'where':{'id':_0x2026a2[_0x5327('0x45')]['id']}})[_0x5327('0x22')](handleEntityNotFound(_0x4942dc,null))[_0x5327('0x22')](saveUpdates(_0x2026a2[_0x5327('0x4a')],null))[_0x5327('0x22')](respondWithResult(_0x4942dc,null))[_0x5327('0x43')](handleError(_0x4942dc,null));};exports[_0x5327('0x23')]=function(_0x4b4c59,_0x69b4bd){return db[_0x5327('0x2c')]['find']({'where':{'id':_0x4b4c59[_0x5327('0x45')]['id']}})[_0x5327('0x22')](handleEntityNotFound(_0x69b4bd,null))[_0x5327('0x22')](removeEntity(_0x69b4bd,null))[_0x5327('0x43')](handleError(_0x69b4bd,null));};exports[_0x5327('0x51')]=function(_0x2744ed,_0x4e9f0c,_0x6a9b65){return db[_0x5327('0x2c')][_0x5327('0x48')]({'where':{'id':_0x2744ed['params']['id']},'attributes':['name',_0x5327('0x52'),_0x5327('0x53'),_0x5327('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x4e9f0c,null))[_0x5327('0x22')](function(_0x18991a){if(_0x18991a){if(!fs['existsSync'](path['join'](config[_0x5327('0x55')],_0x5327('0x56'),_0x18991a[_0x5327('0x53')]))){throw new db[(_0x5327('0x57'))]['ValidationError'](_0x5327('0x58'));}if(_0x2744ed[_0x5327('0x31')][_0x5327('0x59')]){return _0x4e9f0c[_0x5327('0x18')](0xc8);}return _0x4e9f0c[_0x5327('0x51')](path['join'](config[_0x5327('0x55')],_0x5327('0x56'),_0x18991a[_0x5327('0x53')]),util[_0x5327('0x5a')](_0x5327('0x5b'),_0x18991a[_0x5327('0x52')]||_0x18991a[_0x5327('0x29')],_0x18991a[_0x5327('0x54')][_0x5327('0x5c')]()));}})[_0x5327('0x43')](handleError(_0x4e9f0c,null));};
\ No newline at end of file
+var _0x13f9=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','send','map','AnalyticExtractedReport','rawAttributes','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','output','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x13f9,0x111));var _0x913f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x13f9[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x913f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x913f('0x1'));var jsonpatch=require(_0x913f('0x2'));var rp=require(_0x913f('0x3'));var moment=require(_0x913f('0x4'));var BPromise=require(_0x913f('0x5'));var Mustache=require(_0x913f('0x6'));var util=require('util');var path=require(_0x913f('0x7'));var sox=require(_0x913f('0x8'));var csv=require(_0x913f('0x9'));var ejs=require(_0x913f('0xa'));var fs=require('fs');var fs_extra=require(_0x913f('0xb'));var _=require('lodash');var squel=require(_0x913f('0xc'));var crypto=require(_0x913f('0xd'));var jsforce=require(_0x913f('0xe'));var deskjs=require(_0x913f('0xf'));var toCsv=require(_0x913f('0x9'));var querystring=require(_0x913f('0x10'));var Papa=require('papaparse');var Redis=require(_0x913f('0x11'));var authService=require(_0x913f('0x12'));var qs=require(_0x913f('0x13'));var as=require(_0x913f('0x14'));var hardwareService=require(_0x913f('0x15'));var logger=require(_0x913f('0x16'))(_0x913f('0x17'));var utils=require(_0x913f('0x18'));var config=require(_0x913f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x913f('0x1a'))['db'];function respondWithStatusCode(_0x314193,_0x1599e8){_0x1599e8=_0x1599e8||0xcc;return function(_0x3b5f28){if(_0x3b5f28){return _0x314193[_0x913f('0x1b')](_0x1599e8);}return _0x314193[_0x913f('0x1c')](_0x1599e8)[_0x913f('0x1d')]();};}function respondWithResult(_0x4d9623,_0x11fa5d){_0x11fa5d=_0x11fa5d||0xc8;return function(_0x515313){if(_0x515313){return _0x4d9623[_0x913f('0x1c')](_0x11fa5d)[_0x913f('0x1e')](_0x515313);}};}function respondWithFilteredResult(_0x29a5d7,_0x49741f){return function(_0x3fc036){if(_0x3fc036){var _0x2a2613=typeof _0x49741f[_0x913f('0x1f')]===_0x913f('0x20')&&typeof _0x49741f['limit']==='undefined';var _0x496757=_0x3fc036[_0x913f('0x21')];var _0x400efd=_0x2a2613?0x0:_0x49741f[_0x913f('0x1f')];var _0x12260d=_0x2a2613?_0x3fc036[_0x913f('0x21')]:_0x49741f[_0x913f('0x1f')]+_0x49741f[_0x913f('0x22')];var _0x35e072;if(_0x12260d>=_0x496757){_0x12260d=_0x496757;_0x35e072=0xc8;}else{_0x35e072=0xce;}_0x29a5d7[_0x913f('0x1c')](_0x35e072);return _0x29a5d7[_0x913f('0x23')](_0x913f('0x24'),_0x400efd+'-'+_0x12260d+'/'+_0x496757)['json'](_0x3fc036);}return null;};}function patchUpdates(_0x403493){return function(_0xf5c204){try{jsonpatch[_0x913f('0x25')](_0xf5c204,_0x403493,!![]);}catch(_0x4bca30){return BPromise[_0x913f('0x26')](_0x4bca30);}return _0xf5c204[_0x913f('0x27')]();};}function saveUpdates(_0x30d2e2,_0xdaa146){return function(_0xa7083c){if(_0xa7083c){return _0xa7083c[_0x913f('0x28')](_0x30d2e2)[_0x913f('0x29')](function(_0x30e010){return _0x30e010;});}return null;};}function removeEntity(_0x3c1b9f,_0x35de63){return function(_0x378ea2){if(_0x378ea2){return _0x378ea2[_0x913f('0x2a')]()['then'](function(){var _0x57c3bf=_0x378ea2[_0x913f('0x2b')]({'plain':!![]});var _0x19c8be=_0x913f('0x2c');return db[_0x913f('0x2d')]['destroy']({'where':{'type':_0x19c8be,'resourceId':_0x57c3bf['id']}})[_0x913f('0x29')](function(){return _0x378ea2;});})['then'](function(){_0x3c1b9f[_0x913f('0x1c')](0xcc)[_0x913f('0x1d')]();});}};}function handleEntityNotFound(_0x34adda,_0x465f8b){return function(_0x1db481){if(!_0x1db481){_0x34adda['sendStatus'](0x194);}return _0x1db481;};}function handleError(_0x485369,_0x15ba24){_0x15ba24=_0x15ba24||0x1f4;return function(_0x3260c0){logger[_0x913f('0x2e')](_0x3260c0[_0x913f('0x2f')]);if(_0x3260c0['name']){delete _0x3260c0['name'];}_0x485369[_0x913f('0x1c')](_0x15ba24)[_0x913f('0x30')](_0x3260c0);};}exports['index']=function(_0x2d4f18,_0x56f61a){var _0x4f81b0={},_0x45a467={},_0x3c4535={'count':0x0,'rows':[]};var _0x2ad431=_[_0x913f('0x31')](db[_0x913f('0x32')][_0x913f('0x33')],function(_0x1c05df){return{'name':_0x1c05df['fieldName'],'type':_0x1c05df['type']['key']};});_0x45a467[_0x913f('0x34')]=_[_0x913f('0x31')](_0x2ad431,_0x913f('0x35'));_0x45a467[_0x913f('0x36')]=_['keys'](_0x2d4f18['query']);_0x45a467[_0x913f('0x37')]=_[_0x913f('0x38')](_0x45a467[_0x913f('0x34')],_0x45a467[_0x913f('0x36')]);_0x4f81b0[_0x913f('0x39')]=_[_0x913f('0x38')](_0x45a467[_0x913f('0x34')],qs[_0x913f('0x3a')](_0x2d4f18['query'][_0x913f('0x3a')]));_0x4f81b0[_0x913f('0x39')]=_0x4f81b0[_0x913f('0x39')][_0x913f('0x3b')]?_0x4f81b0[_0x913f('0x39')]:_0x45a467['model'];if(!_0x2d4f18[_0x913f('0x36')][_0x913f('0x3c')](_0x913f('0x3d'))){_0x4f81b0[_0x913f('0x22')]=qs[_0x913f('0x22')](_0x2d4f18[_0x913f('0x36')][_0x913f('0x22')]);_0x4f81b0[_0x913f('0x1f')]=qs[_0x913f('0x1f')](_0x2d4f18[_0x913f('0x36')][_0x913f('0x1f')]);}_0x4f81b0[_0x913f('0x3e')]=qs[_0x913f('0x3f')](_0x2d4f18['query'][_0x913f('0x3f')]);_0x4f81b0[_0x913f('0x40')]=qs[_0x913f('0x37')](_[_0x913f('0x41')](_0x2d4f18[_0x913f('0x36')],_0x45a467['filters']),_0x2ad431);if(_0x2d4f18['query'][_0x913f('0x42')]){_0x4f81b0[_0x913f('0x40')]=_[_0x913f('0x43')](_0x4f81b0[_0x913f('0x40')],{'$or':_[_0x913f('0x31')](_0x2ad431,function(_0x15a1fa){if(_0x15a1fa['type']!=='VIRTUAL'){var _0x1990c5={};_0x1990c5[_0x15a1fa['name']]={'$like':'%'+_0x2d4f18[_0x913f('0x36')][_0x913f('0x42')]+'%'};return _0x1990c5;}})});}_0x4f81b0=_[_0x913f('0x43')]({},_0x4f81b0,_0x2d4f18['options']);var _0x57368a={'where':_0x4f81b0['where']};return db[_0x913f('0x32')][_0x913f('0x21')](_0x57368a)['then'](function(_0x13efee){_0x3c4535['count']=_0x13efee;if(_0x2d4f18[_0x913f('0x36')][_0x913f('0x44')]){_0x4f81b0['include']=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x4f81b0);})['then'](function(_0x388594){_0x3c4535[_0x913f('0x45')]=_0x388594;return _0x3c4535;})[_0x913f('0x29')](respondWithFilteredResult(_0x56f61a,_0x4f81b0))[_0x913f('0x46')](handleError(_0x56f61a,null));};exports[_0x913f('0x47')]=function(_0x5d405f,_0xa25475){var _0x4d2cac={'raw':!![],'where':{'id':_0x5d405f[_0x913f('0x48')]['id']}},_0x1dd529={};_0x1dd529[_0x913f('0x34')]=_[_0x913f('0x49')](db[_0x913f('0x32')][_0x913f('0x33')]);_0x1dd529[_0x913f('0x36')]=_[_0x913f('0x49')](_0x5d405f[_0x913f('0x36')]);_0x1dd529[_0x913f('0x37')]=_[_0x913f('0x38')](_0x1dd529[_0x913f('0x34')],_0x1dd529[_0x913f('0x36')]);_0x4d2cac[_0x913f('0x39')]=_[_0x913f('0x38')](_0x1dd529[_0x913f('0x34')],qs['fields'](_0x5d405f[_0x913f('0x36')]['fields']));_0x4d2cac['attributes']=_0x4d2cac[_0x913f('0x39')][_0x913f('0x3b')]?_0x4d2cac[_0x913f('0x39')]:_0x1dd529[_0x913f('0x34')];if(_0x5d405f[_0x913f('0x36')][_0x913f('0x44')]){_0x4d2cac['include']=[{'all':!![]}];}_0x4d2cac=_[_0x913f('0x43')]({},_0x4d2cac,_0x5d405f[_0x913f('0x4a')]);return db[_0x913f('0x32')][_0x913f('0x4b')](_0x4d2cac)[_0x913f('0x29')](handleEntityNotFound(_0xa25475,null))[_0x913f('0x29')](respondWithResult(_0xa25475,null))[_0x913f('0x46')](handleError(_0xa25475,null));};exports[_0x913f('0x4c')]=function(_0x581468,_0x3cabc9){return db['AnalyticExtractedReport'][_0x913f('0x4c')](_0x581468[_0x913f('0x4d')],{})['then'](function(_0x1b1f7b){var _0x3cb630=_0x581468['user'][_0x913f('0x2b')]({'plain':!![]});if(!_0x3cb630)throw new Error(_0x913f('0x4e'));if(_0x3cb630['role']==='user'){var _0x333382=_0x1b1f7b[_0x913f('0x2b')]({'plain':!![]});var _0x5aa2ca='ExtractedReports';return db[_0x913f('0x4f')][_0x913f('0x4b')]({'where':{'name':_0x5aa2ca,'userProfileId':_0x3cb630[_0x913f('0x50')]},'raw':!![]})['then'](function(_0x19dd8b){if(_0x19dd8b&&_0x19dd8b['autoAssociation']===0x0){return db[_0x913f('0x2d')][_0x913f('0x4c')]({'name':_0x333382[_0x913f('0x35')],'resourceId':_0x333382['id'],'type':_0x19dd8b[_0x913f('0x35')],'sectionId':_0x19dd8b['id']},{})[_0x913f('0x29')](function(){return _0x1b1f7b;});}else{return _0x1b1f7b;}})['catch'](function(_0x5510d7){logger[_0x913f('0x2e')](_0x913f('0x51'),_0x5510d7);throw _0x5510d7;});}return _0x1b1f7b;})[_0x913f('0x29')](respondWithResult(_0x3cabc9,0xc9))[_0x913f('0x46')](handleError(_0x3cabc9,null));};exports['update']=function(_0x3a3bb9,_0x2180ba){if(_0x3a3bb9[_0x913f('0x4d')]['id']){delete _0x3a3bb9[_0x913f('0x4d')]['id'];}return db[_0x913f('0x32')]['find']({'where':{'id':_0x3a3bb9['params']['id']}})[_0x913f('0x29')](handleEntityNotFound(_0x2180ba,null))[_0x913f('0x29')](saveUpdates(_0x3a3bb9[_0x913f('0x4d')],null))['then'](respondWithResult(_0x2180ba,null))['catch'](handleError(_0x2180ba,null));};exports['destroy']=function(_0x353592,_0x23408b){return db[_0x913f('0x32')][_0x913f('0x4b')]({'where':{'id':_0x353592[_0x913f('0x48')]['id']}})[_0x913f('0x29')](handleEntityNotFound(_0x23408b,null))[_0x913f('0x29')](removeEntity(_0x23408b,null))[_0x913f('0x46')](handleError(_0x23408b,null));};exports[_0x913f('0x52')]=function(_0x5dca1c,_0x2961c9,_0x1df12a){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5dca1c['params']['id']},'attributes':['name',_0x913f('0x53'),_0x913f('0x54'),'output'],'raw':!![]})[_0x913f('0x29')](handleEntityNotFound(_0x2961c9,null))[_0x913f('0x29')](function(_0xeaee14){if(_0xeaee14){if(!fs[_0x913f('0x55')](path[_0x913f('0x56')](config[_0x913f('0x57')],_0x913f('0x58'),_0xeaee14[_0x913f('0x54')]))){throw new db['Sequelize'][(_0x913f('0x59'))](_0x913f('0x5a'));}if(_0x5dca1c[_0x913f('0x36')][_0x913f('0x5b')]){return _0x2961c9['sendStatus'](0xc8);}return _0x2961c9[_0x913f('0x52')](path['join'](config['root'],_0x913f('0x58'),_0xeaee14[_0x913f('0x54')]),util[_0x913f('0x5c')]('%s.%s',_0xeaee14[_0x913f('0x53')]||_0xeaee14[_0x913f('0x35')],_0xeaee14[_0x913f('0x5d')]['toLowerCase']()));}})[_0x913f('0x46')](handleError(_0x2961c9,null));};
\ No newline at end of file