Built motion from commit (unavailable).|2.5.29
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index 15b0ac2..70f8dde 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18f6=['path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','map','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticExtractedReport','includeAll','rows','catch','show','params','fields','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','output','existsSync','join','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','root','format','%s.%s','toLowerCase','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache'];(function(_0xe571a9,_0x3bb4d2){var _0x24eb18=function(_0xc6306c){while(--_0xc6306c){_0xe571a9['push'](_0xe571a9['shift']());}};_0x24eb18(++_0x3bb4d2);}(_0x18f6,0x16e));var _0x618f=function(_0x93398c,_0xb9e33f){_0x93398c=_0x93398c-0x0;var _0xa694e9=_0x18f6[_0x93398c];return _0xa694e9;};'use strict';var pdf=require(_0x618f('0x0'));var emlformat=require(_0x618f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x618f('0x2'));var rp=require(_0x618f('0x3'));var moment=require(_0x618f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x618f('0x5'));var util=require('util');var path=require(_0x618f('0x6'));var sox=require(_0x618f('0x7'));var csv=require(_0x618f('0x8'));var ejs=require(_0x618f('0x9'));var fs=require('fs');var _=require(_0x618f('0xa'));var squel=require(_0x618f('0xb'));var crypto=require('crypto');var jsforce=require(_0x618f('0xc'));var deskjs=require(_0x618f('0xd'));var toCsv=require(_0x618f('0x8'));var querystring=require(_0x618f('0xe'));var Papa=require(_0x618f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x618f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x618f('0x11'))(_0x618f('0x12'));var utils=require('../../config/utils');var config=require(_0x618f('0x13'));var licenseUtil=require(_0x618f('0x14'));var db=require(_0x618f('0x15'))['db'];function respondWithStatusCode(_0x4da324,_0x22f790){_0x22f790=_0x22f790||0xcc;return function(_0x5a5f02){if(_0x5a5f02){return _0x4da324[_0x618f('0x16')](_0x22f790);}return _0x4da324[_0x618f('0x17')](_0x22f790)[_0x618f('0x18')]();};}function respondWithResult(_0x97055e,_0x36ab49){_0x36ab49=_0x36ab49||0xc8;return function(_0x2622ea){if(_0x2622ea){return _0x97055e[_0x618f('0x17')](_0x36ab49)[_0x618f('0x19')](_0x2622ea);}};}function respondWithFilteredResult(_0x73b49,_0x12751c){return function(_0x4e3e8b){if(_0x4e3e8b){var _0x1dc341=_0x4e3e8b[_0x618f('0x1a')],_0x2c11ef=_0x12751c[_0x618f('0x1b')],_0x57d002=_0x12751c[_0x618f('0x1b')]+_0x12751c[_0x618f('0x1c')],_0x6b699c;if(_0x57d002>=_0x1dc341){_0x57d002=_0x1dc341;_0x6b699c=0xc8;}else{_0x6b699c=0xce;}_0x73b49['status'](_0x6b699c);return _0x73b49['set'](_0x618f('0x1d'),_0x2c11ef+'-'+_0x57d002+'/'+_0x1dc341)['json'](_0x4e3e8b);}return null;};}function patchUpdates(_0x4dcc65){return function(_0x2647f2){try{jsonpatch[_0x618f('0x1e')](_0x2647f2,_0x4dcc65,!![]);}catch(_0x469223){return BPromise[_0x618f('0x1f')](_0x469223);}return _0x2647f2[_0x618f('0x20')]();};}function saveUpdates(_0x284747,_0x4c4420){return function(_0x37ed6b){if(_0x37ed6b){return _0x37ed6b[_0x618f('0x21')](_0x284747)[_0x618f('0x22')](function(_0x2cbf72){return _0x2cbf72;});}return null;};}function removeEntity(_0x55877f,_0x12f7f7){return function(_0x2f6958){if(_0x2f6958){return _0x2f6958[_0x618f('0x23')]()[_0x618f('0x22')](function(){var _0x2939ac=_0x2f6958[_0x618f('0x24')]({'plain':!![]});var _0x5674e1=_0x618f('0x25');return db[_0x618f('0x26')][_0x618f('0x23')]({'where':{'type':_0x5674e1,'resourceId':_0x2939ac['id']}})[_0x618f('0x22')](function(){return _0x2f6958;});})[_0x618f('0x22')](function(){_0x55877f[_0x618f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e432f,_0x59187d){return function(_0x239086){if(!_0x239086){_0x1e432f[_0x618f('0x16')](0x194);}return _0x239086;};}function handleError(_0x54494c,_0x413c09){_0x413c09=_0x413c09||0x1f4;return function(_0x1723ad){logger['error'](_0x1723ad[_0x618f('0x27')]);if(_0x1723ad[_0x618f('0x28')]){delete _0x1723ad['name'];}_0x54494c[_0x618f('0x17')](_0x413c09)[_0x618f('0x29')](_0x1723ad);};}exports['index']=function(_0x225acc,_0xaf0429){var _0x507ec6={},_0x562f73={},_0x566c06={'count':0x0,'rows':[]};var _0x181797=_[_0x618f('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x4f7a3b){return{'name':_0x4f7a3b['fieldName'],'type':_0x4f7a3b[_0x618f('0x2b')]['key']};});_0x562f73[_0x618f('0x2c')]=_[_0x618f('0x2a')](_0x181797,'name');_0x562f73['query']=_[_0x618f('0x2d')](_0x225acc['query']);_0x562f73[_0x618f('0x2e')]=_[_0x618f('0x2f')](_0x562f73[_0x618f('0x2c')],_0x562f73[_0x618f('0x30')]);_0x507ec6[_0x618f('0x31')]=_[_0x618f('0x2f')](_0x562f73[_0x618f('0x2c')],qs['fields'](_0x225acc[_0x618f('0x30')]['fields']));_0x507ec6[_0x618f('0x31')]=_0x507ec6[_0x618f('0x31')][_0x618f('0x32')]?_0x507ec6['attributes']:_0x562f73['model'];if(!_0x225acc['query'][_0x618f('0x33')](_0x618f('0x34'))){_0x507ec6[_0x618f('0x1c')]=qs[_0x618f('0x1c')](_0x225acc[_0x618f('0x30')][_0x618f('0x1c')]);_0x507ec6[_0x618f('0x1b')]=qs['offset'](_0x225acc['query'][_0x618f('0x1b')]);}_0x507ec6[_0x618f('0x35')]=qs[_0x618f('0x36')](_0x225acc[_0x618f('0x30')][_0x618f('0x36')]);_0x507ec6[_0x618f('0x37')]=qs[_0x618f('0x2e')](_[_0x618f('0x38')](_0x225acc[_0x618f('0x30')],_0x562f73[_0x618f('0x2e')]),_0x181797);if(_0x225acc['query'][_0x618f('0x39')]){_0x507ec6[_0x618f('0x37')]=_['merge'](_0x507ec6['where'],{'$or':_[_0x618f('0x2a')](_0x181797,function(_0x5288e4){if(_0x5288e4[_0x618f('0x2b')]!==_0x618f('0x3a')){var _0x58034d={};_0x58034d[_0x5288e4[_0x618f('0x28')]]={'$like':'%'+_0x225acc[_0x618f('0x30')][_0x618f('0x39')]+'%'};return _0x58034d;}})});}_0x507ec6=_[_0x618f('0x3b')]({},_0x507ec6,_0x225acc[_0x618f('0x3c')]);var _0x3aed95={'where':_0x507ec6['where']};return db[_0x618f('0x3d')][_0x618f('0x1a')](_0x3aed95)[_0x618f('0x22')](function(_0x2606ae){_0x566c06[_0x618f('0x1a')]=_0x2606ae;if(_0x225acc[_0x618f('0x30')][_0x618f('0x3e')]){_0x507ec6['include']=[{'all':!![]}];}return db[_0x618f('0x3d')]['findAll'](_0x507ec6);})[_0x618f('0x22')](function(_0x5ed4a6){_0x566c06[_0x618f('0x3f')]=_0x5ed4a6;return _0x566c06;})[_0x618f('0x22')](respondWithFilteredResult(_0xaf0429,_0x507ec6))[_0x618f('0x40')](handleError(_0xaf0429,null));};exports[_0x618f('0x41')]=function(_0x41d8c5,_0xc8320f){var _0xc91c94={'raw':!![],'where':{'id':_0x41d8c5[_0x618f('0x42')]['id']}},_0x59d325={};_0x59d325[_0x618f('0x2c')]=_[_0x618f('0x2d')](db[_0x618f('0x3d')]['rawAttributes']);_0x59d325[_0x618f('0x30')]=_[_0x618f('0x2d')](_0x41d8c5['query']);_0x59d325[_0x618f('0x2e')]=_[_0x618f('0x2f')](_0x59d325[_0x618f('0x2c')],_0x59d325[_0x618f('0x30')]);_0xc91c94[_0x618f('0x31')]=_['intersection'](_0x59d325[_0x618f('0x2c')],qs[_0x618f('0x43')](_0x41d8c5['query'][_0x618f('0x43')]));_0xc91c94[_0x618f('0x31')]=_0xc91c94['attributes'][_0x618f('0x32')]?_0xc91c94[_0x618f('0x31')]:_0x59d325['model'];if(_0x41d8c5[_0x618f('0x30')][_0x618f('0x3e')]){_0xc91c94[_0x618f('0x44')]=[{'all':!![]}];}_0xc91c94=_[_0x618f('0x3b')]({},_0xc91c94,_0x41d8c5['options']);return db[_0x618f('0x3d')][_0x618f('0x45')](_0xc91c94)[_0x618f('0x22')](handleEntityNotFound(_0xc8320f,null))['then'](respondWithResult(_0xc8320f,null))[_0x618f('0x40')](handleError(_0xc8320f,null));};exports[_0x618f('0x46')]=function(_0x39dc74,_0x20abc3){return db[_0x618f('0x3d')]['create'](_0x39dc74['body'],{})[_0x618f('0x22')](function(_0x546597){var _0x13d39a=_0x39dc74['user'][_0x618f('0x24')]({'plain':!![]});if(!_0x13d39a)throw new Error(_0x618f('0x47'));if(_0x13d39a[_0x618f('0x48')]===_0x618f('0x49')){var _0x1523b8=_0x546597[_0x618f('0x24')]({'plain':!![]});var _0x1663ea=_0x618f('0x25');return db[_0x618f('0x4a')]['find']({'where':{'name':_0x1663ea,'userProfileId':_0x13d39a[_0x618f('0x4b')]},'raw':!![]})[_0x618f('0x22')](function(_0x203c9c){if(_0x203c9c&&_0x203c9c[_0x618f('0x4c')]===0x0){return db['UserProfileResource'][_0x618f('0x46')]({'name':_0x1523b8[_0x618f('0x28')],'resourceId':_0x1523b8['id'],'type':_0x203c9c[_0x618f('0x28')],'sectionId':_0x203c9c['id']},{})[_0x618f('0x22')](function(){return _0x546597;});}else{return _0x546597;}})[_0x618f('0x40')](function(_0x5b4f09){logger[_0x618f('0x4d')](_0x618f('0x4e'),_0x5b4f09);throw _0x5b4f09;});}return _0x546597;})['then'](respondWithResult(_0x20abc3,0xc9))[_0x618f('0x40')](handleError(_0x20abc3,null));};exports[_0x618f('0x21')]=function(_0x5b4d5d,_0x4c817a){if(_0x5b4d5d[_0x618f('0x4f')]['id']){delete _0x5b4d5d[_0x618f('0x4f')]['id'];}return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x5b4d5d[_0x618f('0x42')]['id']}})[_0x618f('0x22')](handleEntityNotFound(_0x4c817a,null))['then'](saveUpdates(_0x5b4d5d[_0x618f('0x4f')],null))[_0x618f('0x22')](respondWithResult(_0x4c817a,null))[_0x618f('0x40')](handleError(_0x4c817a,null));};exports[_0x618f('0x23')]=function(_0x300add,_0x2b2c71){return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x300add['params']['id']}})[_0x618f('0x22')](handleEntityNotFound(_0x2b2c71,null))['then'](removeEntity(_0x2b2c71,null))[_0x618f('0x40')](handleError(_0x2b2c71,null));};exports[_0x618f('0x50')]=function(_0x1317ac,_0x41f0cb,_0x59fbfc){return db[_0x618f('0x3d')][_0x618f('0x45')]({'where':{'id':_0x1317ac[_0x618f('0x42')]['id']},'attributes':[_0x618f('0x28'),_0x618f('0x51'),'savename',_0x618f('0x52')],'raw':!![]})[_0x618f('0x22')](handleEntityNotFound(_0x41f0cb,null))[_0x618f('0x22')](function(_0x2ddf21){if(_0x2ddf21){if(!fs[_0x618f('0x53')](path[_0x618f('0x54')](config['root'],_0x618f('0x55'),_0x2ddf21[_0x618f('0x56')]))){throw new db[(_0x618f('0x57'))]['ValidationError'](_0x618f('0x58'));}if(_0x1317ac[_0x618f('0x30')]['exists']){return _0x41f0cb[_0x618f('0x16')](0xc8);}return _0x41f0cb[_0x618f('0x50')](path['join'](config[_0x618f('0x59')],_0x618f('0x55'),_0x2ddf21['savename']),util[_0x618f('0x5a')](_0x618f('0x5b'),_0x2ddf21[_0x618f('0x51')]||_0x2ddf21[_0x618f('0x28')],_0x2ddf21[_0x618f('0x52')][_0x618f('0x5c')]()));}})[_0x618f('0x40')](handleError(_0x41f0cb,null));};
\ No newline at end of file
+var _0x86a2=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','map','type','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','catch','show','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','find','userProfileId','download','output','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','savename','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs'];(function(_0x19ebad,_0x3e594e){var _0x4bc9d1=function(_0x12aaeb){while(--_0x12aaeb){_0x19ebad['push'](_0x19ebad['shift']());}};_0x4bc9d1(++_0x3e594e);}(_0x86a2,0x1c6));var _0x286a=function(_0x495b4f,_0xdb22f2){_0x495b4f=_0x495b4f-0x0;var _0x4a10cb=_0x86a2[_0x495b4f];return _0x4a10cb;};'use strict';var emlformat=require(_0x286a('0x0'));var rimraf=require(_0x286a('0x1'));var zipdir=require(_0x286a('0x2'));var jsonpatch=require(_0x286a('0x3'));var rp=require(_0x286a('0x4'));var moment=require(_0x286a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x286a('0x6'));var util=require(_0x286a('0x7'));var path=require(_0x286a('0x8'));var sox=require('sox');var csv=require(_0x286a('0x9'));var ejs=require(_0x286a('0xa'));var fs=require('fs');var fs_extra=require(_0x286a('0xb'));var _=require(_0x286a('0xc'));var squel=require(_0x286a('0xd'));var crypto=require(_0x286a('0xe'));var jsforce=require(_0x286a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x286a('0x9'));var querystring=require(_0x286a('0x10'));var Papa=require(_0x286a('0x11'));var Redis=require(_0x286a('0x12'));var authService=require(_0x286a('0x13'));var qs=require(_0x286a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x286a('0x15'))(_0x286a('0x16'));var utils=require('../../config/utils');var config=require(_0x286a('0x17'));var licenseUtil=require(_0x286a('0x18'));var db=require(_0x286a('0x19'))['db'];function respondWithStatusCode(_0x3570b9,_0x1a3336){_0x1a3336=_0x1a3336||0xcc;return function(_0xde1f46){if(_0xde1f46){return _0x3570b9[_0x286a('0x1a')](_0x1a3336);}return _0x3570b9[_0x286a('0x1b')](_0x1a3336)['end']();};}function respondWithResult(_0x129735,_0x1df271){_0x1df271=_0x1df271||0xc8;return function(_0xb6a473){if(_0xb6a473){return _0x129735[_0x286a('0x1b')](_0x1df271)[_0x286a('0x1c')](_0xb6a473);}};}function respondWithFilteredResult(_0x434145,_0x134f15){return function(_0x15adc0){if(_0x15adc0){var _0x33461f=typeof _0x134f15['offset']===_0x286a('0x1d')&&typeof _0x134f15[_0x286a('0x1e')]===_0x286a('0x1d');var _0x1b378d=_0x15adc0['count'];var _0x56befb=_0x33461f?0x0:_0x134f15[_0x286a('0x1f')];var _0x44fe0a=_0x33461f?_0x15adc0[_0x286a('0x20')]:_0x134f15[_0x286a('0x1f')]+_0x134f15[_0x286a('0x1e')];var _0x2ed720;if(_0x44fe0a>=_0x1b378d){_0x44fe0a=_0x1b378d;_0x2ed720=0xc8;}else{_0x2ed720=0xce;}_0x434145[_0x286a('0x1b')](_0x2ed720);return _0x434145[_0x286a('0x21')](_0x286a('0x22'),_0x56befb+'-'+_0x44fe0a+'/'+_0x1b378d)[_0x286a('0x1c')](_0x15adc0);}return null;};}function patchUpdates(_0x2e34ad){return function(_0x3e5112){try{jsonpatch[_0x286a('0x23')](_0x3e5112,_0x2e34ad,!![]);}catch(_0x459cff){return BPromise['reject'](_0x459cff);}return _0x3e5112[_0x286a('0x24')]();};}function saveUpdates(_0x4030f8,_0x89aa09){return function(_0x448504){if(_0x448504){return _0x448504[_0x286a('0x25')](_0x4030f8)[_0x286a('0x26')](function(_0x39fa0c){return _0x39fa0c;});}return null;};}function removeEntity(_0x16f299,_0x4521da){return function(_0xf75b5c){if(_0xf75b5c){return _0xf75b5c[_0x286a('0x27')]()[_0x286a('0x26')](function(){var _0x5a470d=_0xf75b5c[_0x286a('0x28')]({'plain':!![]});var _0x282595='ExtractedReports';return db[_0x286a('0x29')][_0x286a('0x27')]({'where':{'type':_0x282595,'resourceId':_0x5a470d['id']}})['then'](function(){return _0xf75b5c;});})[_0x286a('0x26')](function(){_0x16f299[_0x286a('0x1b')](0xcc)[_0x286a('0x2a')]();});}};}function handleEntityNotFound(_0x360da4,_0x400e17){return function(_0x493a7d){if(!_0x493a7d){_0x360da4[_0x286a('0x1a')](0x194);}return _0x493a7d;};}function handleError(_0x3ff122,_0x155f56){_0x155f56=_0x155f56||0x1f4;return function(_0x2d1a45){logger[_0x286a('0x2b')](_0x2d1a45['stack']);if(_0x2d1a45[_0x286a('0x2c')]){delete _0x2d1a45[_0x286a('0x2c')];}_0x3ff122[_0x286a('0x1b')](_0x155f56)[_0x286a('0x2d')](_0x2d1a45);};}exports[_0x286a('0x2e')]=function(_0x12efb2,_0x24a1e7){var _0x5715ad={},_0x41fe62={},_0xdb6784={'count':0x0,'rows':[]};var _0xb0b358=_['map'](db['AnalyticExtractedReport'][_0x286a('0x2f')],function(_0x2d5d61){return{'name':_0x2d5d61['fieldName'],'type':_0x2d5d61['type']['key']};});_0x41fe62['model']=_['map'](_0xb0b358,_0x286a('0x2c'));_0x41fe62[_0x286a('0x30')]=_[_0x286a('0x31')](_0x12efb2['query']);_0x41fe62[_0x286a('0x32')]=_[_0x286a('0x33')](_0x41fe62[_0x286a('0x34')],_0x41fe62['query']);_0x5715ad[_0x286a('0x35')]=_[_0x286a('0x33')](_0x41fe62['model'],qs[_0x286a('0x36')](_0x12efb2[_0x286a('0x30')]['fields']));_0x5715ad[_0x286a('0x35')]=_0x5715ad[_0x286a('0x35')][_0x286a('0x37')]?_0x5715ad[_0x286a('0x35')]:_0x41fe62[_0x286a('0x34')];if(!_0x12efb2[_0x286a('0x30')][_0x286a('0x38')]('nolimit')){_0x5715ad[_0x286a('0x1e')]=qs[_0x286a('0x1e')](_0x12efb2[_0x286a('0x30')][_0x286a('0x1e')]);_0x5715ad['offset']=qs[_0x286a('0x1f')](_0x12efb2[_0x286a('0x30')][_0x286a('0x1f')]);}_0x5715ad['order']=qs['sort'](_0x12efb2[_0x286a('0x30')][_0x286a('0x39')]);_0x5715ad['where']=qs[_0x286a('0x32')](_[_0x286a('0x3a')](_0x12efb2[_0x286a('0x30')],_0x41fe62[_0x286a('0x32')]),_0xb0b358);if(_0x12efb2[_0x286a('0x30')][_0x286a('0x3b')]){_0x5715ad[_0x286a('0x3c')]=_['merge'](_0x5715ad[_0x286a('0x3c')],{'$or':_[_0x286a('0x3d')](_0xb0b358,function(_0x4b7c7b){if(_0x4b7c7b[_0x286a('0x3e')]!==_0x286a('0x3f')){var _0x8a1b3b={};_0x8a1b3b[_0x4b7c7b[_0x286a('0x2c')]]={'$like':'%'+_0x12efb2['query'][_0x286a('0x3b')]+'%'};return _0x8a1b3b;}})});}_0x5715ad=_['merge']({},_0x5715ad,_0x12efb2[_0x286a('0x40')]);var _0x4625e9={'where':_0x5715ad[_0x286a('0x3c')]};return db[_0x286a('0x41')][_0x286a('0x20')](_0x4625e9)[_0x286a('0x26')](function(_0x227504){_0xdb6784[_0x286a('0x20')]=_0x227504;if(_0x12efb2[_0x286a('0x30')][_0x286a('0x42')]){_0x5715ad[_0x286a('0x43')]=[{'all':!![]}];}return db[_0x286a('0x41')][_0x286a('0x44')](_0x5715ad);})[_0x286a('0x26')](function(_0x233de5){_0xdb6784['rows']=_0x233de5;return _0xdb6784;})[_0x286a('0x26')](respondWithFilteredResult(_0x24a1e7,_0x5715ad))[_0x286a('0x45')](handleError(_0x24a1e7,null));};exports[_0x286a('0x46')]=function(_0x5bbf83,_0x2a71dd){var _0x4c6fc8={'raw':!![],'where':{'id':_0x5bbf83[_0x286a('0x47')]['id']}},_0x3fa0fe={};_0x3fa0fe[_0x286a('0x34')]=_[_0x286a('0x31')](db['AnalyticExtractedReport'][_0x286a('0x2f')]);_0x3fa0fe[_0x286a('0x30')]=_[_0x286a('0x31')](_0x5bbf83[_0x286a('0x30')]);_0x3fa0fe[_0x286a('0x32')]=_[_0x286a('0x33')](_0x3fa0fe['model'],_0x3fa0fe[_0x286a('0x30')]);_0x4c6fc8['attributes']=_['intersection'](_0x3fa0fe[_0x286a('0x34')],qs['fields'](_0x5bbf83[_0x286a('0x30')][_0x286a('0x36')]));_0x4c6fc8['attributes']=_0x4c6fc8[_0x286a('0x35')][_0x286a('0x37')]?_0x4c6fc8[_0x286a('0x35')]:_0x3fa0fe['model'];if(_0x5bbf83[_0x286a('0x30')][_0x286a('0x42')]){_0x4c6fc8[_0x286a('0x43')]=[{'all':!![]}];}_0x4c6fc8=_[_0x286a('0x48')]({},_0x4c6fc8,_0x5bbf83[_0x286a('0x40')]);return db['AnalyticExtractedReport']['find'](_0x4c6fc8)['then'](handleEntityNotFound(_0x2a71dd,null))[_0x286a('0x26')](respondWithResult(_0x2a71dd,null))[_0x286a('0x45')](handleError(_0x2a71dd,null));};exports['create']=function(_0x28a90c,_0x1eb461){return db[_0x286a('0x41')][_0x286a('0x49')](_0x28a90c[_0x286a('0x4a')],{})[_0x286a('0x26')](function(_0x2a5fd0){var _0x148be0=_0x28a90c[_0x286a('0x4b')]['get']({'plain':!![]});if(!_0x148be0)throw new Error(_0x286a('0x4c'));if(_0x148be0[_0x286a('0x4d')]===_0x286a('0x4b')){var _0x22e006=_0x2a5fd0[_0x286a('0x28')]({'plain':!![]});var _0x117fbe=_0x286a('0x4e');return db[_0x286a('0x4f')][_0x286a('0x50')]({'where':{'name':_0x117fbe,'userProfileId':_0x148be0[_0x286a('0x51')]},'raw':!![]})[_0x286a('0x26')](function(_0x349fb1){if(_0x349fb1&&_0x349fb1['autoAssociation']===0x0){return db['UserProfileResource'][_0x286a('0x49')]({'name':_0x22e006[_0x286a('0x2c')],'resourceId':_0x22e006['id'],'type':_0x349fb1['name'],'sectionId':_0x349fb1['id']},{})[_0x286a('0x26')](function(){return _0x2a5fd0;});}else{return _0x2a5fd0;}})[_0x286a('0x45')](function(_0x1d469c){logger[_0x286a('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d469c);throw _0x1d469c;});}return _0x2a5fd0;})[_0x286a('0x26')](respondWithResult(_0x1eb461,0xc9))[_0x286a('0x45')](handleError(_0x1eb461,null));};exports[_0x286a('0x25')]=function(_0x356391,_0x3dbcf6){if(_0x356391[_0x286a('0x4a')]['id']){delete _0x356391[_0x286a('0x4a')]['id'];}return db['AnalyticExtractedReport'][_0x286a('0x50')]({'where':{'id':_0x356391[_0x286a('0x47')]['id']}})[_0x286a('0x26')](handleEntityNotFound(_0x3dbcf6,null))['then'](saveUpdates(_0x356391[_0x286a('0x4a')],null))[_0x286a('0x26')](respondWithResult(_0x3dbcf6,null))[_0x286a('0x45')](handleError(_0x3dbcf6,null));};exports[_0x286a('0x27')]=function(_0x37f577,_0x1c7270){return db[_0x286a('0x41')][_0x286a('0x50')]({'where':{'id':_0x37f577[_0x286a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c7270,null))['then'](removeEntity(_0x1c7270,null))[_0x286a('0x45')](handleError(_0x1c7270,null));};exports[_0x286a('0x52')]=function(_0x33f32b,_0x394743,_0x3149c1){return db['AnalyticExtractedReport'][_0x286a('0x50')]({'where':{'id':_0x33f32b[_0x286a('0x47')]['id']},'attributes':['name','basename','savename',_0x286a('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x394743,null))[_0x286a('0x26')](function(_0x599567){if(_0x599567){if(!fs['existsSync'](path['join'](config[_0x286a('0x54')],_0x286a('0x55'),_0x599567['savename']))){throw new db['Sequelize'][(_0x286a('0x56'))](_0x286a('0x57'));}if(_0x33f32b['query'][_0x286a('0x58')]){return _0x394743[_0x286a('0x1a')](0xc8);}return _0x394743[_0x286a('0x52')](path[_0x286a('0x59')](config[_0x286a('0x54')],_0x286a('0x55'),_0x599567[_0x286a('0x5a')]),util[_0x286a('0x5b')](_0x286a('0x5c'),_0x599567['basename']||_0x599567[_0x286a('0x2c')],_0x599567[_0x286a('0x53')]['toLowerCase']()));}})[_0x286a('0x45')](handleError(_0x394743,null));};
\ No newline at end of file