Built motion from commit 709aa6fb5ed03aa61bc373fcdbf622215d37d30b. Version 3.0.0...
[motion-next.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 8cea243..dd75fde 100644 (file)
@@ -1 +1 @@
-const a13_0x27f6=['../../config/environment','savename','query','fieldName','key','body','length','user','../../components/parsers/qs','api','map','findOne','undefined','basename','output','ExtractedReports','count','lodash','util','order','../../config/logger','Content-Range','limit','include','params','pick','like','nolimit','name','end','userProfileId','filters','stack','rows','UserProfileSection','AnalyticExtractedReport','status','offset','format','VIRTUAL','includeAll','rawAttributes','then','where','options','index','download','type','role','root','existsSync','fields','findAll','path','model','catch','filter','keys','show','sort','sendStatus','get','destroy','exists','intersection','error','attributes','autoAssociation','set','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','merge','update'];(function(_0x3b308f,_0x27f6cb){const _0x372180=function(_0x4f3a9b){while(--_0x4f3a9b){_0x3b308f['push'](_0x3b308f['shift']());}};_0x372180(++_0x27f6cb);}(a13_0x27f6,0xc2));const a13_0x3721=function(_0x3b308f,_0x27f6cb){_0x3b308f=_0x3b308f-0x0;let _0x372180=a13_0x27f6[_0x3b308f];return _0x372180;};const _0x342d4f=a13_0x3721;'use strict';const util=require(_0x342d4f('0x2b')),path=require(_0x342d4f('0x5')),fs=require('fs'),_=require(_0x342d4f('0x2a')),qs=require(_0x342d4f('0x21')),logger=require(_0x342d4f('0x2d'))(_0x342d4f('0x22')),config=require(_0x342d4f('0x19')),db=require('../../mysqldb')['db'],{Op,ValidationError}=require('sequelize');function respondWithResult(_0x4f3a9b,_0x1ea87c){return _0x1ea87c=_0x1ea87c||0xc8,function(_0x17f16c){const _0x4e3168=a13_0x3721;if(_0x17f16c)return _0x4f3a9b[_0x4e3168('0x3d')](_0x1ea87c)['json'](_0x17f16c);};}function respondWithFilteredResult(_0x4da3fa,_0x2c7ed3){return function(_0x3c944d){const _0x2c38ee=a13_0x3721;if(_0x3c944d){const _0x4859bb=_0x3c944d['count'],_0x4368e1=_0x2c7ed3[_0x2c38ee('0x3e')];let _0x280e2f=_0x2c7ed3[_0x2c38ee('0x3e')]+_0x2c7ed3[_0x2c38ee('0x2f')],_0x99868f;return _0x280e2f>=_0x4859bb?(_0x280e2f=_0x4859bb,_0x99868f=0xc8):_0x99868f=0xce,_0x4da3fa[_0x2c38ee('0x3d')](_0x99868f),_0x4da3fa[_0x2c38ee('0x14')](_0x2c38ee('0x2e'),_0x4368e1+'-'+_0x280e2f+'/'+_0x4859bb)['json'](_0x3c944d);}return null;};}function saveUpdates(_0x5427b9){return function(_0x2a5144){const _0x1aaa6f=a13_0x3721;if(_0x2a5144)return _0x2a5144[_0x1aaa6f('0x18')](_0x5427b9)[_0x1aaa6f('0x43')](function(_0x38309e){return _0x38309e;});return null;};}function removeEntity(_0x501703){return function(_0x34889a){const _0x1e82d5=a13_0x3721;if(_0x34889a)return _0x34889a[_0x1e82d5('0xe')]()[_0x1e82d5('0x43')](function(){const _0x31802e=_0x1e82d5,_0x573ec5=_0x34889a[_0x31802e('0xd')]({'plain':!![]}),_0x43f596=_0x31802e('0x28');return db['UserProfileResource'][_0x31802e('0xe')]({'where':{'type':_0x43f596,'resourceId':_0x573ec5['id']}})['then'](function(){return _0x34889a;});})[_0x1e82d5('0x43')](function(){const _0x1eaf30=_0x1e82d5;_0x501703[_0x1eaf30('0x3d')](0xcc)[_0x1eaf30('0x36')]();});};}function handleEntityNotFound(_0xddd2f1){return function(_0x4fac77){const _0xa97903=a13_0x3721;return!_0x4fac77&&_0xddd2f1[_0xa97903('0xc')](0x194),_0x4fac77;};}function handleError(_0x280d95,_0x28e2f9){return _0x28e2f9=_0x28e2f9||0x1f4,function(_0x347587){const _0x3c4f3f=a13_0x3721;logger[_0x3c4f3f('0x11')](_0x347587[_0x3c4f3f('0x39')]),_0x347587['name']&&delete _0x347587[_0x3c4f3f('0x35')],_0x280d95[_0x3c4f3f('0x3d')](_0x28e2f9)['send'](_0x347587);};}exports[_0x342d4f('0x46')]=function(_0x6f9a6e,_0x331ecf){const _0x30c3ab=_0x342d4f;let _0x43fcbf={};const _0x13edb3={},_0x2801e2={'count':0x0,'rows':[]},_0x4305e8=_[_0x30c3ab('0x23')](db[_0x30c3ab('0x3c')][_0x30c3ab('0x42')],function(_0x43fd04){const _0x2067f8=_0x30c3ab;return{'name':_0x43fd04[_0x2067f8('0x1c')],'type':_0x43fd04[_0x2067f8('0x48')][_0x2067f8('0x1d')]};});_0x13edb3[_0x30c3ab('0x6')]=_['map'](_0x4305e8,_0x30c3ab('0x35')),_0x13edb3['query']=_[_0x30c3ab('0x9')](_0x6f9a6e['query']),_0x13edb3[_0x30c3ab('0x38')]=_[_0x30c3ab('0x10')](_0x13edb3[_0x30c3ab('0x6')],_0x13edb3[_0x30c3ab('0x1b')]),_0x43fcbf['attributes']=_['intersection'](_0x13edb3[_0x30c3ab('0x6')],qs[_0x30c3ab('0x3')](_0x6f9a6e[_0x30c3ab('0x1b')][_0x30c3ab('0x3')])),_0x43fcbf[_0x30c3ab('0x12')]=_0x43fcbf[_0x30c3ab('0x12')][_0x30c3ab('0x1f')]?_0x43fcbf[_0x30c3ab('0x12')]:_0x13edb3['model'];typeof _0x6f9a6e[_0x30c3ab('0x1b')][_0x30c3ab('0x34')]===_0x30c3ab('0x25')&&(_0x43fcbf[_0x30c3ab('0x2f')]=qs['limit'](_0x6f9a6e[_0x30c3ab('0x1b')][_0x30c3ab('0x2f')]),_0x43fcbf['offset']=qs[_0x30c3ab('0x3e')](_0x6f9a6e[_0x30c3ab('0x1b')][_0x30c3ab('0x3e')]));_0x43fcbf[_0x30c3ab('0x2c')]=qs[_0x30c3ab('0xb')](_0x6f9a6e['query'][_0x30c3ab('0xb')]),_0x43fcbf[_0x30c3ab('0x44')]=qs[_0x30c3ab('0x38')](_[_0x30c3ab('0x32')](_0x6f9a6e[_0x30c3ab('0x1b')],_0x13edb3[_0x30c3ab('0x38')]),_0x4305e8);_0x6f9a6e[_0x30c3ab('0x1b')]['filter']&&(_0x43fcbf[_0x30c3ab('0x44')]=_['merge'](_0x43fcbf[_0x30c3ab('0x44')],{[Op['or']]:_[_0x30c3ab('0x23')](_0x4305e8,function(_0x2be18f){const _0x1610d4=_0x30c3ab;if(_0x2be18f['type']!==_0x1610d4('0x40')){const _0x2c4ec6={};return _0x2c4ec6[_0x2be18f[_0x1610d4('0x35')]]={[Op[_0x1610d4('0x33')]]:'%'+_0x6f9a6e[_0x1610d4('0x1b')][_0x1610d4('0x8')]+'%'},_0x2c4ec6;}})}));_0x43fcbf=_[_0x30c3ab('0x17')]({},_0x43fcbf,_0x6f9a6e[_0x30c3ab('0x45')]);const _0x15132a={'where':_0x43fcbf[_0x30c3ab('0x44')]};return db[_0x30c3ab('0x3c')][_0x30c3ab('0x29')](_0x15132a)['then'](function(_0x3732df){const _0xb1afd6=_0x30c3ab;return _0x2801e2['count']=_0x3732df,_0x6f9a6e['query'][_0xb1afd6('0x41')]&&(_0x43fcbf[_0xb1afd6('0x30')]=[{'all':!![]}]),db['AnalyticExtractedReport'][_0xb1afd6('0x4')](_0x43fcbf);})[_0x30c3ab('0x43')](function(_0xa55dec){const _0x221972=_0x30c3ab;return _0x2801e2[_0x221972('0x3a')]=_0xa55dec,_0x2801e2;})[_0x30c3ab('0x43')](respondWithFilteredResult(_0x331ecf,_0x43fcbf))['catch'](handleError(_0x331ecf,null));},exports[_0x342d4f('0xa')]=function(_0x57181b,_0x7b1d48){const _0x4ed42c=_0x342d4f;let _0x234ce2={'raw':!![],'where':{'id':_0x57181b['params']['id']}};const _0x5526d8={};return _0x5526d8[_0x4ed42c('0x6')]=_[_0x4ed42c('0x9')](db['AnalyticExtractedReport'][_0x4ed42c('0x42')]),_0x5526d8[_0x4ed42c('0x1b')]=_[_0x4ed42c('0x9')](_0x57181b['query']),_0x5526d8[_0x4ed42c('0x38')]=_[_0x4ed42c('0x10')](_0x5526d8['model'],_0x5526d8[_0x4ed42c('0x1b')]),_0x234ce2[_0x4ed42c('0x12')]=_[_0x4ed42c('0x10')](_0x5526d8[_0x4ed42c('0x6')],qs['fields'](_0x57181b['query'][_0x4ed42c('0x3')])),_0x234ce2[_0x4ed42c('0x12')]=_0x234ce2['attributes'][_0x4ed42c('0x1f')]?_0x234ce2[_0x4ed42c('0x12')]:_0x5526d8['model'],_0x57181b['query'][_0x4ed42c('0x41')]&&(_0x234ce2[_0x4ed42c('0x30')]=[{'all':!![]}]),_0x234ce2=_[_0x4ed42c('0x17')]({},_0x234ce2,_0x57181b[_0x4ed42c('0x45')]),db['AnalyticExtractedReport'][_0x4ed42c('0x24')](_0x234ce2)[_0x4ed42c('0x43')](handleEntityNotFound(_0x7b1d48,null))[_0x4ed42c('0x43')](respondWithResult(_0x7b1d48,null))[_0x4ed42c('0x7')](handleError(_0x7b1d48,null));},exports['create']=function(_0x3ae817,_0x29a1d0){const _0x40d9b2=_0x342d4f;return db[_0x40d9b2('0x3c')][_0x40d9b2('0x15')](_0x3ae817['body'],{})[_0x40d9b2('0x43')](function(_0x1f87fc){const _0x2f259d=_0x40d9b2,_0x33d00b=_0x3ae817[_0x2f259d('0x20')]['get']({'plain':!![]});if(!_0x33d00b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33d00b[_0x2f259d('0x0')]===_0x2f259d('0x20')){const _0x23c24e=_0x1f87fc[_0x2f259d('0xd')]({'plain':!![]}),_0x501cdf=_0x2f259d('0x28');return db[_0x2f259d('0x3b')][_0x2f259d('0x24')]({'where':{'name':_0x501cdf,'userProfileId':_0x33d00b[_0x2f259d('0x37')]},'raw':!![]})['then'](function(_0x7d7577){const _0x16cd2c=_0x2f259d;return _0x7d7577&&_0x7d7577[_0x16cd2c('0x13')]===0x0?db['UserProfileResource'][_0x16cd2c('0x15')]({'name':_0x23c24e['name'],'resourceId':_0x23c24e['id'],'type':_0x7d7577['name'],'sectionId':_0x7d7577['id']},{})[_0x16cd2c('0x43')](function(){return _0x1f87fc;}):_0x1f87fc;})[_0x2f259d('0x7')](function(_0x260fa6){const _0x2a0381=_0x2f259d;logger[_0x2a0381('0x11')](_0x2a0381('0x16'),_0x260fa6);throw _0x260fa6;});}return _0x1f87fc;})[_0x40d9b2('0x43')](respondWithResult(_0x29a1d0,0xc9))[_0x40d9b2('0x7')](handleError(_0x29a1d0,null));},exports[_0x342d4f('0x18')]=function(_0xa8a458,_0x54572a){const _0x28a396=_0x342d4f;return _0xa8a458[_0x28a396('0x1e')]['id']&&delete _0xa8a458['body']['id'],db['AnalyticExtractedReport']['findOne']({'where':{'id':_0xa8a458['params']['id']}})[_0x28a396('0x43')](handleEntityNotFound(_0x54572a,null))[_0x28a396('0x43')](saveUpdates(_0xa8a458[_0x28a396('0x1e')],null))['then'](respondWithResult(_0x54572a,null))[_0x28a396('0x7')](handleError(_0x54572a,null));},exports[_0x342d4f('0xe')]=function(_0x33627e,_0x424b18){const _0x374172=_0x342d4f;return db[_0x374172('0x3c')][_0x374172('0x24')]({'where':{'id':_0x33627e[_0x374172('0x31')]['id']}})['then'](handleEntityNotFound(_0x424b18,null))['then'](removeEntity(_0x424b18,null))[_0x374172('0x7')](handleError(_0x424b18,null));},exports[_0x342d4f('0x47')]=function(_0x5ee959,_0x4cbc69){const _0x23fda4=_0x342d4f;return db[_0x23fda4('0x3c')][_0x23fda4('0x24')]({'where':{'id':_0x5ee959['params']['id']},'attributes':[_0x23fda4('0x35'),_0x23fda4('0x26'),'savename',_0x23fda4('0x27')],'raw':!![]})[_0x23fda4('0x43')](handleEntityNotFound(_0x4cbc69,null))['then'](function(_0x19ca47){const _0x4bfac7=_0x23fda4;if(_0x19ca47){if(!fs[_0x4bfac7('0x2')](path['join'](config[_0x4bfac7('0x1')],'files/reports',_0x19ca47['savename'])))throw new ValidationError('Report\x20not\x20found\x20or\x20empty');if(_0x5ee959[_0x4bfac7('0x1b')][_0x4bfac7('0xf')])return _0x4cbc69[_0x4bfac7('0xc')](0xc8);return _0x4cbc69[_0x4bfac7('0x47')](path['join'](config[_0x4bfac7('0x1')],'files/reports',_0x19ca47[_0x4bfac7('0x1a')]),util[_0x4bfac7('0x3f')]('%s.%s',_0x19ca47[_0x4bfac7('0x26')]||_0x19ca47[_0x4bfac7('0x35')],_0x19ca47['output']['toLowerCase']()));}})[_0x23fda4('0x7')](handleError(_0x4cbc69,null));};
\ No newline at end of file
+const a13_0x523a=['like','create','body','sendStatus','set','limit','output','rows','role','merge','toLowerCase','includeAll','fieldName','exists','model','length','UserProfileSection','update','findOne','%s.%s','query','filters','download','fields','get','undefined','show','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unable\x20to\x20retrieve\x20the\x20current\x20user','then','end','index','format','lodash','pick','user','send','rawAttributes','root','savename','intersection','userProfileId','../../config/logger','stack','order','AnalyticExtractedReport','../../config/environment','params','destroy','error','basename','where','options','type','map','offset','../../components/parsers/qs','include','nolimit','status','count','filter','sort','join','existsSync','sequelize','files/reports','ExtractedReports','Report\x20not\x20found\x20or\x20empty','keys','UserProfileResource','attributes','name','catch'];(function(_0x25c795,_0x523a1b){const _0x3785ae=function(_0x1f1677){while(--_0x1f1677){_0x25c795['push'](_0x25c795['shift']());}};_0x3785ae(++_0x523a1b);}(a13_0x523a,0x89));const a13_0x3785=function(_0x25c795,_0x523a1b){_0x25c795=_0x25c795-0x0;let _0x3785ae=a13_0x523a[_0x25c795];return _0x3785ae;};const _0x4d6dfc=a13_0x3785;'use strict';const util=require('util'),path=require('path'),fs=require('fs'),_=require(_0x4d6dfc('0x2c')),qs=require(_0x4d6dfc('0x43')),logger=require(_0x4d6dfc('0x35'))('api'),config=require(_0x4d6dfc('0x39')),db=require('../../mysqldb')['db'],{Op,ValidationError}=require(_0x4d6dfc('0x2'));function respondWithResult(_0x1f1677,_0x17792e){return _0x17792e=_0x17792e||0xc8,function(_0x5ca56e){const _0x4e3ea0=a13_0x3785;if(_0x5ca56e)return _0x1f1677[_0x4e3ea0('0x46')](_0x17792e)['json'](_0x5ca56e);};}function respondWithFilteredResult(_0x8b57d3,_0x1d7400){return function(_0x5e0ec5){const _0x398cc4=a13_0x3785;if(_0x5e0ec5){const _0x376984=_0x5e0ec5[_0x398cc4('0x47')],_0x3a4b19=_0x1d7400[_0x398cc4('0x42')];let _0x170abf=_0x1d7400[_0x398cc4('0x42')]+_0x1d7400[_0x398cc4('0x10')],_0x2c71cd;return _0x170abf>=_0x376984?(_0x170abf=_0x376984,_0x2c71cd=0xc8):_0x2c71cd=0xce,_0x8b57d3['status'](_0x2c71cd),_0x8b57d3[_0x398cc4('0xf')]('Content-Range',_0x3a4b19+'-'+_0x170abf+'/'+_0x376984)['json'](_0x5e0ec5);}return null;};}function saveUpdates(_0x2952d6){return function(_0x33577f){const _0xed9491=a13_0x3785;if(_0x33577f)return _0x33577f[_0xed9491('0x1c')](_0x2952d6)[_0xed9491('0x28')](function(_0x4ffe83){return _0x4ffe83;});return null;};}function removeEntity(_0x227418){return function(_0x565420){const _0x28eec4=a13_0x3785;if(_0x565420)return _0x565420[_0x28eec4('0x3b')]()['then'](function(){const _0x2bf5c6=_0x28eec4,_0x24a1c4=_0x565420[_0x2bf5c6('0x23')]({'plain':!![]}),_0x5d5029=_0x2bf5c6('0x4');return db[_0x2bf5c6('0x7')][_0x2bf5c6('0x3b')]({'where':{'type':_0x5d5029,'resourceId':_0x24a1c4['id']}})[_0x2bf5c6('0x28')](function(){return _0x565420;});})[_0x28eec4('0x28')](function(){const _0x5cf6ba=_0x28eec4;_0x227418[_0x5cf6ba('0x46')](0xcc)[_0x5cf6ba('0x29')]();});};}function handleEntityNotFound(_0x804517){return function(_0x1bc3c6){const _0x3e3375=a13_0x3785;return!_0x1bc3c6&&_0x804517[_0x3e3375('0xe')](0x194),_0x1bc3c6;};}function handleError(_0x4943da,_0x8f6e73){return _0x8f6e73=_0x8f6e73||0x1f4,function(_0x716da){const _0x535884=a13_0x3785;logger[_0x535884('0x3c')](_0x716da[_0x535884('0x36')]),_0x716da['name']&&delete _0x716da['name'],_0x4943da[_0x535884('0x46')](_0x8f6e73)[_0x535884('0x2f')](_0x716da);};}exports[_0x4d6dfc('0x2a')]=function(_0x1b5ed0,_0x46d155){const _0x97cb0c=_0x4d6dfc;let _0x26616f={};const _0x95fb85={},_0x5718e6={'count':0x0,'rows':[]},_0x18f02b=_[_0x97cb0c('0x41')](db[_0x97cb0c('0x38')][_0x97cb0c('0x30')],function(_0x3d8c18){const _0x2c5455=_0x97cb0c;return{'name':_0x3d8c18[_0x2c5455('0x17')],'type':_0x3d8c18['type']['key']};});_0x95fb85['model']=_[_0x97cb0c('0x41')](_0x18f02b,'name'),_0x95fb85[_0x97cb0c('0x1f')]=_[_0x97cb0c('0x6')](_0x1b5ed0['query']),_0x95fb85[_0x97cb0c('0x20')]=_['intersection'](_0x95fb85[_0x97cb0c('0x19')],_0x95fb85['query']),_0x26616f[_0x97cb0c('0x8')]=_[_0x97cb0c('0x33')](_0x95fb85[_0x97cb0c('0x19')],qs[_0x97cb0c('0x22')](_0x1b5ed0['query'][_0x97cb0c('0x22')])),_0x26616f[_0x97cb0c('0x8')]=_0x26616f[_0x97cb0c('0x8')][_0x97cb0c('0x1a')]?_0x26616f[_0x97cb0c('0x8')]:_0x95fb85[_0x97cb0c('0x19')];typeof _0x1b5ed0[_0x97cb0c('0x1f')][_0x97cb0c('0x45')]===_0x97cb0c('0x24')&&(_0x26616f[_0x97cb0c('0x10')]=qs['limit'](_0x1b5ed0[_0x97cb0c('0x1f')][_0x97cb0c('0x10')]),_0x26616f[_0x97cb0c('0x42')]=qs[_0x97cb0c('0x42')](_0x1b5ed0[_0x97cb0c('0x1f')][_0x97cb0c('0x42')]));_0x26616f[_0x97cb0c('0x37')]=qs['sort'](_0x1b5ed0['query'][_0x97cb0c('0x49')]),_0x26616f['where']=qs[_0x97cb0c('0x20')](_[_0x97cb0c('0x2d')](_0x1b5ed0[_0x97cb0c('0x1f')],_0x95fb85['filters']),_0x18f02b);_0x1b5ed0['query'][_0x97cb0c('0x48')]&&(_0x26616f['where']=_[_0x97cb0c('0x14')](_0x26616f[_0x97cb0c('0x3e')],{[Op['or']]:_[_0x97cb0c('0x41')](_0x18f02b,function(_0x27a952){const _0x43893f=_0x97cb0c;if(_0x27a952[_0x43893f('0x40')]!=='VIRTUAL'){const _0x583f59={};return _0x583f59[_0x27a952[_0x43893f('0x9')]]={[Op[_0x43893f('0xb')]]:'%'+_0x1b5ed0[_0x43893f('0x1f')][_0x43893f('0x48')]+'%'},_0x583f59;}})}));_0x26616f=_[_0x97cb0c('0x14')]({},_0x26616f,_0x1b5ed0[_0x97cb0c('0x3f')]);const _0x3a202b={'where':_0x26616f[_0x97cb0c('0x3e')]};return db[_0x97cb0c('0x38')][_0x97cb0c('0x47')](_0x3a202b)['then'](function(_0x144947){const _0x3ef24a=_0x97cb0c;return _0x5718e6[_0x3ef24a('0x47')]=_0x144947,_0x1b5ed0[_0x3ef24a('0x1f')][_0x3ef24a('0x16')]&&(_0x26616f[_0x3ef24a('0x44')]=[{'all':!![]}]),db['AnalyticExtractedReport']['findAll'](_0x26616f);})[_0x97cb0c('0x28')](function(_0xa1fff5){const _0x1fd6ac=_0x97cb0c;return _0x5718e6[_0x1fd6ac('0x12')]=_0xa1fff5,_0x5718e6;})[_0x97cb0c('0x28')](respondWithFilteredResult(_0x46d155,_0x26616f))[_0x97cb0c('0xa')](handleError(_0x46d155,null));},exports[_0x4d6dfc('0x25')]=function(_0x4a3373,_0x429db2){const _0x47320e=_0x4d6dfc;let _0x484125={'raw':!![],'where':{'id':_0x4a3373['params']['id']}};const _0x2d2faa={};return _0x2d2faa['model']=_['keys'](db['AnalyticExtractedReport'][_0x47320e('0x30')]),_0x2d2faa[_0x47320e('0x1f')]=_[_0x47320e('0x6')](_0x4a3373[_0x47320e('0x1f')]),_0x2d2faa[_0x47320e('0x20')]=_[_0x47320e('0x33')](_0x2d2faa[_0x47320e('0x19')],_0x2d2faa[_0x47320e('0x1f')]),_0x484125['attributes']=_['intersection'](_0x2d2faa['model'],qs[_0x47320e('0x22')](_0x4a3373[_0x47320e('0x1f')][_0x47320e('0x22')])),_0x484125['attributes']=_0x484125[_0x47320e('0x8')][_0x47320e('0x1a')]?_0x484125['attributes']:_0x2d2faa[_0x47320e('0x19')],_0x4a3373['query']['includeAll']&&(_0x484125[_0x47320e('0x44')]=[{'all':!![]}]),_0x484125=_['merge']({},_0x484125,_0x4a3373[_0x47320e('0x3f')]),db[_0x47320e('0x38')][_0x47320e('0x1d')](_0x484125)['then'](handleEntityNotFound(_0x429db2,null))[_0x47320e('0x28')](respondWithResult(_0x429db2,null))[_0x47320e('0xa')](handleError(_0x429db2,null));},exports[_0x4d6dfc('0xc')]=function(_0x8f18fb,_0x403efc){const _0x22d0db=_0x4d6dfc;return db['AnalyticExtractedReport'][_0x22d0db('0xc')](_0x8f18fb[_0x22d0db('0xd')],{})[_0x22d0db('0x28')](function(_0x212776){const _0x425d24=_0x22d0db,_0x572f99=_0x8f18fb[_0x425d24('0x2e')][_0x425d24('0x23')]({'plain':!![]});if(!_0x572f99)throw new Error(_0x425d24('0x27'));if(_0x572f99[_0x425d24('0x13')]===_0x425d24('0x2e')){const _0xc8272c=_0x212776[_0x425d24('0x23')]({'plain':!![]}),_0x10177b=_0x425d24('0x4');return db[_0x425d24('0x1b')][_0x425d24('0x1d')]({'where':{'name':_0x10177b,'userProfileId':_0x572f99[_0x425d24('0x34')]},'raw':!![]})['then'](function(_0x4fb48e){const _0xda6467=_0x425d24;return _0x4fb48e&&_0x4fb48e['autoAssociation']===0x0?db[_0xda6467('0x7')][_0xda6467('0xc')]({'name':_0xc8272c['name'],'resourceId':_0xc8272c['id'],'type':_0x4fb48e[_0xda6467('0x9')],'sectionId':_0x4fb48e['id']},{})[_0xda6467('0x28')](function(){return _0x212776;}):_0x212776;})[_0x425d24('0xa')](function(_0x3fae66){const _0x26505e=_0x425d24;logger[_0x26505e('0x3c')](_0x26505e('0x26'),_0x3fae66);throw _0x3fae66;});}return _0x212776;})[_0x22d0db('0x28')](respondWithResult(_0x403efc,0xc9))['catch'](handleError(_0x403efc,null));},exports[_0x4d6dfc('0x1c')]=function(_0x5df301,_0x1252de){const _0x14b5cc=_0x4d6dfc;return _0x5df301['body']['id']&&delete _0x5df301['body']['id'],db[_0x14b5cc('0x38')]['findOne']({'where':{'id':_0x5df301['params']['id']}})[_0x14b5cc('0x28')](handleEntityNotFound(_0x1252de,null))[_0x14b5cc('0x28')](saveUpdates(_0x5df301[_0x14b5cc('0xd')],null))['then'](respondWithResult(_0x1252de,null))[_0x14b5cc('0xa')](handleError(_0x1252de,null));},exports['destroy']=function(_0x154a78,_0x40de76){const _0x4a824c=_0x4d6dfc;return db[_0x4a824c('0x38')][_0x4a824c('0x1d')]({'where':{'id':_0x154a78[_0x4a824c('0x3a')]['id']}})[_0x4a824c('0x28')](handleEntityNotFound(_0x40de76,null))[_0x4a824c('0x28')](removeEntity(_0x40de76,null))[_0x4a824c('0xa')](handleError(_0x40de76,null));},exports['download']=function(_0x4e1eca,_0x1497e0){const _0x2cbab4=_0x4d6dfc;return db[_0x2cbab4('0x38')][_0x2cbab4('0x1d')]({'where':{'id':_0x4e1eca[_0x2cbab4('0x3a')]['id']},'attributes':[_0x2cbab4('0x9'),_0x2cbab4('0x3d'),_0x2cbab4('0x32'),_0x2cbab4('0x11')],'raw':!![]})[_0x2cbab4('0x28')](handleEntityNotFound(_0x1497e0,null))[_0x2cbab4('0x28')](function(_0x6816d5){const _0x22457c=_0x2cbab4;if(_0x6816d5){if(!fs[_0x22457c('0x1')](path[_0x22457c('0x0')](config[_0x22457c('0x31')],_0x22457c('0x3'),_0x6816d5['savename'])))throw new ValidationError(_0x22457c('0x5'));if(_0x4e1eca['query'][_0x22457c('0x18')])return _0x1497e0[_0x22457c('0xe')](0xc8);return _0x1497e0[_0x22457c('0x21')](path[_0x22457c('0x0')](config[_0x22457c('0x31')],_0x22457c('0x3'),_0x6816d5[_0x22457c('0x32')]),util[_0x22457c('0x2b')](_0x22457c('0x1e'),_0x6816d5[_0x22457c('0x3d')]||_0x6816d5[_0x22457c('0x9')],_0x6816d5[_0x22457c('0x11')][_0x22457c('0x15')]()));}})[_0x2cbab4('0xa')](handleError(_0x1497e0,null));};
\ No newline at end of file