Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.controller.js
index b8a120b..4102bab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca66=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','findAll','rows','catch','show','params','find','create','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xca66,0x8b));var _0x6ca6=function(_0x168386,_0x5789b4){_0x168386=_0x168386-0x0;var _0x2a6a9b=_0xca66[_0x168386];return _0x2a6a9b;};'use strict';var pdf=require(_0x6ca6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ca6('0x1'));var jsonpatch=require(_0x6ca6('0x2'));var rp=require(_0x6ca6('0x3'));var moment=require('moment');var BPromise=require(_0x6ca6('0x4'));var Mustache=require('mustache');var util=require(_0x6ca6('0x5'));var path=require('path');var sox=require(_0x6ca6('0x6'));var csv=require(_0x6ca6('0x7'));var ejs=require(_0x6ca6('0x8'));var fs=require('fs');var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x7'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=_0x36ff3e[_0x6ca6('0x1b')],_0x260b56=_0x5785b1[_0x6ca6('0x1c')],_0x3f03e6=_0x5785b1['offset']+_0x5785b1[_0x6ca6('0x1d')],_0x2c4a5c;if(_0x3f03e6>=_0x19e94f){_0x3f03e6=_0x19e94f;_0x2c4a5c=0xc8;}else{_0x2c4a5c=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x2c4a5c);return _0x52c59a[_0x6ca6('0x1e')](_0x6ca6('0x1f'),_0x260b56+'-'+_0x3f03e6+'/'+_0x19e94f)[_0x6ca6('0x20')](_0x36ff3e);}return null;};}function patchUpdates(_0x2b0a8c){return function(_0x16a3d7){try{jsonpatch[_0x6ca6('0x21')](_0x16a3d7,_0x2b0a8c,!![]);}catch(_0x3a4aa1){return BPromise[_0x6ca6('0x22')](_0x3a4aa1);}return _0x16a3d7[_0x6ca6('0x23')]();};}function saveUpdates(_0x4c3be9,_0x28a982){return function(_0x254afe){if(_0x254afe){return _0x254afe[_0x6ca6('0x24')](_0x4c3be9)[_0x6ca6('0x25')](function(_0x3a24aa){return _0x3a24aa;});}return null;};}function removeEntity(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x26')]()['then'](function(){var _0x4927c1=_0xfb962d[_0x6ca6('0x27')]({'plain':!![]});var _0x216701=_0x6ca6('0x28');return db[_0x6ca6('0x29')][_0x6ca6('0x26')]({'where':{'type':_0x216701,'resourceId':_0x4927c1['id']}})['then'](function(){return _0xfb962d;});})[_0x6ca6('0x25')](function(){_0x438694[_0x6ca6('0x19')](0xcc)[_0x6ca6('0x1a')]();});}};}function handleEntityNotFound(_0x2d8c64,_0x3971a2){return function(_0x29f37e){if(!_0x29f37e){_0x2d8c64[_0x6ca6('0x2a')](0x194);}return _0x29f37e;};}function handleError(_0x2a1e2d,_0x516daf){_0x516daf=_0x516daf||0x1f4;return function(_0x55b07f){logger[_0x6ca6('0x2b')](_0x55b07f[_0x6ca6('0x2c')]);if(_0x55b07f[_0x6ca6('0x2d')]){delete _0x55b07f[_0x6ca6('0x2d')];}_0x2a1e2d['status'](_0x516daf)['send'](_0x55b07f);};}exports[_0x6ca6('0x2e')]=function(_0x47cf48,_0x4ab84c){var _0x141e78={},_0xefd407={},_0x4a15cb={'count':0x0,'rows':[]};var _0x50aa5a=_[_0x6ca6('0x2f')](db[_0x6ca6('0x30')][_0x6ca6('0x31')],function(_0x484411){return{'name':_0x484411[_0x6ca6('0x32')],'type':_0x484411[_0x6ca6('0x33')][_0x6ca6('0x34')]};});_0xefd407[_0x6ca6('0x35')]=_['map'](_0x50aa5a,_0x6ca6('0x2d'));_0xefd407[_0x6ca6('0x36')]=_[_0x6ca6('0x37')](_0x47cf48[_0x6ca6('0x36')]);_0xefd407['filters']=_['intersection'](_0xefd407['model'],_0xefd407['query']);_0x141e78['attributes']=_[_0x6ca6('0x38')](_0xefd407[_0x6ca6('0x35')],qs[_0x6ca6('0x39')](_0x47cf48['query'][_0x6ca6('0x39')]));_0x141e78[_0x6ca6('0x3a')]=_0x141e78[_0x6ca6('0x3a')][_0x6ca6('0x3b')]?_0x141e78['attributes']:_0xefd407[_0x6ca6('0x35')];if(!_0x47cf48[_0x6ca6('0x36')][_0x6ca6('0x3c')](_0x6ca6('0x3d'))){_0x141e78['limit']=qs[_0x6ca6('0x1d')](_0x47cf48['query'][_0x6ca6('0x1d')]);_0x141e78['offset']=qs['offset'](_0x47cf48[_0x6ca6('0x36')][_0x6ca6('0x1c')]);}_0x141e78[_0x6ca6('0x3e')]=qs[_0x6ca6('0x3f')](_0x47cf48['query']['sort']);_0x141e78[_0x6ca6('0x40')]=qs[_0x6ca6('0x41')](_['pick'](_0x47cf48[_0x6ca6('0x36')],_0xefd407['filters']),_0x50aa5a);if(_0x47cf48[_0x6ca6('0x36')]['filter']){_0x141e78[_0x6ca6('0x40')]=_[_0x6ca6('0x42')](_0x141e78[_0x6ca6('0x40')],{'$or':_[_0x6ca6('0x2f')](_0x50aa5a,function(_0x33b5e6){if(_0x33b5e6[_0x6ca6('0x33')]!==_0x6ca6('0x43')){var _0x204f4e={};_0x204f4e[_0x33b5e6['name']]={'$like':'%'+_0x47cf48[_0x6ca6('0x36')]['filter']+'%'};return _0x204f4e;}})});}_0x141e78=_['merge']({},_0x141e78,_0x47cf48[_0x6ca6('0x44')]);var _0x306eda={'where':_0x141e78['where']};return db[_0x6ca6('0x30')]['count'](_0x306eda)[_0x6ca6('0x25')](function(_0x90eab7){_0x4a15cb[_0x6ca6('0x1b')]=_0x90eab7;if(_0x47cf48[_0x6ca6('0x36')]['includeAll']){_0x141e78['include']=[{'all':!![]}];}return db[_0x6ca6('0x30')][_0x6ca6('0x45')](_0x141e78);})[_0x6ca6('0x25')](function(_0x3423e2){_0x4a15cb[_0x6ca6('0x46')]=_0x3423e2;return _0x4a15cb;})['then'](respondWithFilteredResult(_0x4ab84c,_0x141e78))[_0x6ca6('0x47')](handleError(_0x4ab84c,null));};exports[_0x6ca6('0x48')]=function(_0x5bed6e,_0x317b5e){var _0x3b60db={'raw':!![],'where':{'id':_0x5bed6e[_0x6ca6('0x49')]['id']}},_0x323051={};_0x323051[_0x6ca6('0x35')]=_[_0x6ca6('0x37')](db[_0x6ca6('0x30')][_0x6ca6('0x31')]);_0x323051[_0x6ca6('0x36')]=_['keys'](_0x5bed6e[_0x6ca6('0x36')]);_0x323051[_0x6ca6('0x41')]=_[_0x6ca6('0x38')](_0x323051[_0x6ca6('0x35')],_0x323051[_0x6ca6('0x36')]);_0x3b60db[_0x6ca6('0x3a')]=_[_0x6ca6('0x38')](_0x323051[_0x6ca6('0x35')],qs['fields'](_0x5bed6e['query'][_0x6ca6('0x39')]));_0x3b60db[_0x6ca6('0x3a')]=_0x3b60db[_0x6ca6('0x3a')][_0x6ca6('0x3b')]?_0x3b60db[_0x6ca6('0x3a')]:_0x323051[_0x6ca6('0x35')];if(_0x5bed6e[_0x6ca6('0x36')]['includeAll']){_0x3b60db['include']=[{'all':!![]}];}_0x3b60db=_[_0x6ca6('0x42')]({},_0x3b60db,_0x5bed6e[_0x6ca6('0x44')]);return db['AnalyticExtractedReport'][_0x6ca6('0x4a')](_0x3b60db)[_0x6ca6('0x25')](handleEntityNotFound(_0x317b5e,null))[_0x6ca6('0x25')](respondWithResult(_0x317b5e,null))[_0x6ca6('0x47')](handleError(_0x317b5e,null));};exports[_0x6ca6('0x4b')]=function(_0x3c76f7,_0x13efc1){return db['AnalyticExtractedReport'][_0x6ca6('0x4b')](_0x3c76f7[_0x6ca6('0x4c')],{})[_0x6ca6('0x25')](function(_0x4fde51){var _0x408df3=_0x3c76f7['user'][_0x6ca6('0x27')]({'plain':!![]});if(!_0x408df3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x408df3['role']==='user'){var _0x199489=_0x4fde51[_0x6ca6('0x27')]({'plain':!![]});var _0x2177c4='ExtractedReports';return db[_0x6ca6('0x4d')]['find']({'where':{'name':_0x2177c4,'userProfileId':_0x408df3[_0x6ca6('0x4e')]},'raw':!![]})[_0x6ca6('0x25')](function(_0xe0b775){if(_0xe0b775&&_0xe0b775[_0x6ca6('0x4f')]===0x0){return db[_0x6ca6('0x29')][_0x6ca6('0x4b')]({'name':_0x199489[_0x6ca6('0x2d')],'resourceId':_0x199489['id'],'type':_0xe0b775[_0x6ca6('0x2d')],'sectionId':_0xe0b775['id']},{})[_0x6ca6('0x25')](function(){return _0x4fde51;});}else{return _0x4fde51;}})[_0x6ca6('0x47')](function(_0x321f41){logger['error'](_0x6ca6('0x50'),_0x321f41);throw _0x321f41;});}return _0x4fde51;})[_0x6ca6('0x25')](respondWithResult(_0x13efc1,0xc9))[_0x6ca6('0x47')](handleError(_0x13efc1,null));};exports[_0x6ca6('0x24')]=function(_0x11fda2,_0x594209){if(_0x11fda2[_0x6ca6('0x4c')]['id']){delete _0x11fda2[_0x6ca6('0x4c')]['id'];}return db[_0x6ca6('0x30')]['find']({'where':{'id':_0x11fda2['params']['id']}})['then'](handleEntityNotFound(_0x594209,null))['then'](saveUpdates(_0x11fda2[_0x6ca6('0x4c')],null))[_0x6ca6('0x25')](respondWithResult(_0x594209,null))[_0x6ca6('0x47')](handleError(_0x594209,null));};exports['destroy']=function(_0x4d3aa0,_0x387adf){return db[_0x6ca6('0x30')][_0x6ca6('0x4a')]({'where':{'id':_0x4d3aa0['params']['id']}})[_0x6ca6('0x25')](handleEntityNotFound(_0x387adf,null))['then'](removeEntity(_0x387adf,null))[_0x6ca6('0x47')](handleError(_0x387adf,null));};exports[_0x6ca6('0x51')]=function(_0x20c63d,_0x16af08,_0x511eb1){return db[_0x6ca6('0x30')]['find']({'where':{'id':_0x20c63d['params']['id']},'attributes':[_0x6ca6('0x2d'),_0x6ca6('0x52'),_0x6ca6('0x53'),_0x6ca6('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x16af08,null))[_0x6ca6('0x25')](function(_0x1c12ae){if(_0x1c12ae){if(!fs[_0x6ca6('0x55')](path[_0x6ca6('0x56')](config[_0x6ca6('0x57')],_0x6ca6('0x58'),_0x1c12ae[_0x6ca6('0x53')]))){throw new db[(_0x6ca6('0x59'))][(_0x6ca6('0x5a'))](_0x6ca6('0x5b'));}if(_0x20c63d[_0x6ca6('0x36')][_0x6ca6('0x5c')]){return _0x16af08[_0x6ca6('0x2a')](0xc8);}return _0x16af08[_0x6ca6('0x51')](path[_0x6ca6('0x56')](config[_0x6ca6('0x57')],'server/files/reports',_0x1c12ae[_0x6ca6('0x53')]),util[_0x6ca6('0x5d')](_0x6ca6('0x5e'),_0x1c12ae[_0x6ca6('0x52')]||_0x1c12ae[_0x6ca6('0x2d')],_0x1c12ae[_0x6ca6('0x54')][_0x6ca6('0x5f')]()));}})[_0x6ca6('0x47')](handleError(_0x16af08,null));};
\ No newline at end of file
+var _0xe302=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','destroy','sendStatus','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','attributes','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','toLowerCase','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto'];(function(_0xf02672,_0x267824){var _0x2ca884=function(_0x25bbf2){while(--_0x25bbf2){_0xf02672['push'](_0xf02672['shift']());}};_0x2ca884(++_0x267824);}(_0xe302,0x1d3));var _0x2e30=function(_0x385f75,_0x7cf37a){_0x385f75=_0x385f75-0x0;var _0x199e11=_0xe302[_0x385f75];return _0x199e11;};'use strict';var pdf=require(_0x2e30('0x0'));var emlformat=require(_0x2e30('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2e30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e30('0x3'));var moment=require(_0x2e30('0x4'));var BPromise=require(_0x2e30('0x5'));var Mustache=require(_0x2e30('0x6'));var util=require(_0x2e30('0x7'));var path=require(_0x2e30('0x8'));var sox=require(_0x2e30('0x9'));var csv=require(_0x2e30('0xa'));var ejs=require(_0x2e30('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e30('0xc'));var jsforce=require(_0x2e30('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2e30('0xa'));var querystring=require(_0x2e30('0xe'));var Papa=require(_0x2e30('0xf'));var Redis=require(_0x2e30('0x10'));var authService=require(_0x2e30('0x11'));var qs=require(_0x2e30('0x12'));var as=require(_0x2e30('0x13'));var hardwareService=require(_0x2e30('0x14'));var logger=require('../../config/logger')(_0x2e30('0x15'));var utils=require(_0x2e30('0x16'));var config=require(_0x2e30('0x17'));var licenseUtil=require(_0x2e30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d4a3e,_0xffed91){_0xffed91=_0xffed91||0xcc;return function(_0x1881a8){if(_0x1881a8){return _0x1d4a3e['sendStatus'](_0xffed91);}return _0x1d4a3e[_0x2e30('0x19')](_0xffed91)[_0x2e30('0x1a')]();};}function respondWithResult(_0x1e44d5,_0x376f93){_0x376f93=_0x376f93||0xc8;return function(_0x10578f){if(_0x10578f){return _0x1e44d5[_0x2e30('0x19')](_0x376f93)[_0x2e30('0x1b')](_0x10578f);}};}function respondWithFilteredResult(_0x5b5a7e,_0x2825cc){return function(_0x4e164f){if(_0x4e164f){var _0x348592=_0x4e164f[_0x2e30('0x1c')],_0x571864=_0x2825cc[_0x2e30('0x1d')],_0x30f5b9=_0x2825cc[_0x2e30('0x1d')]+_0x2825cc[_0x2e30('0x1e')],_0x16e994;if(_0x30f5b9>=_0x348592){_0x30f5b9=_0x348592;_0x16e994=0xc8;}else{_0x16e994=0xce;}_0x5b5a7e[_0x2e30('0x19')](_0x16e994);return _0x5b5a7e[_0x2e30('0x1f')](_0x2e30('0x20'),_0x571864+'-'+_0x30f5b9+'/'+_0x348592)[_0x2e30('0x1b')](_0x4e164f);}return null;};}function patchUpdates(_0x539113){return function(_0xc75026){try{jsonpatch[_0x2e30('0x21')](_0xc75026,_0x539113,!![]);}catch(_0x5a461a){return BPromise['reject'](_0x5a461a);}return _0xc75026[_0x2e30('0x22')]();};}function saveUpdates(_0x3a44cf,_0xa9dc39){return function(_0x5ebae6){if(_0x5ebae6){return _0x5ebae6[_0x2e30('0x23')](_0x3a44cf)[_0x2e30('0x24')](function(_0x5206e3){return _0x5206e3;});}return null;};}function removeEntity(_0x42f3dc,_0x325e57){return function(_0x456536){if(_0x456536){return _0x456536['destroy']()[_0x2e30('0x24')](function(){var _0xfc00da=_0x456536[_0x2e30('0x25')]({'plain':!![]});var _0x411e0f='ExtractedReports';return db['UserProfileResource'][_0x2e30('0x26')]({'where':{'type':_0x411e0f,'resourceId':_0xfc00da['id']}})[_0x2e30('0x24')](function(){return _0x456536;});})[_0x2e30('0x24')](function(){_0x42f3dc[_0x2e30('0x19')](0xcc)[_0x2e30('0x1a')]();});}};}function handleEntityNotFound(_0x53281f,_0xf87336){return function(_0x357e30){if(!_0x357e30){_0x53281f[_0x2e30('0x27')](0x194);}return _0x357e30;};}function handleError(_0x12caf7,_0x2efa9a){_0x2efa9a=_0x2efa9a||0x1f4;return function(_0x3bb592){logger['error'](_0x3bb592[_0x2e30('0x28')]);if(_0x3bb592[_0x2e30('0x29')]){delete _0x3bb592[_0x2e30('0x29')];}_0x12caf7[_0x2e30('0x19')](_0x2efa9a)['send'](_0x3bb592);};}exports[_0x2e30('0x2a')]=function(_0x5a8575,_0x491f76){var _0x544150={},_0x2a61fd={},_0x323983={'count':0x0,'rows':[]};var _0x40abc7=_[_0x2e30('0x2b')](db[_0x2e30('0x2c')][_0x2e30('0x2d')],function(_0x39c2f2){return{'name':_0x39c2f2[_0x2e30('0x2e')],'type':_0x39c2f2[_0x2e30('0x2f')][_0x2e30('0x30')]};});_0x2a61fd[_0x2e30('0x31')]=_[_0x2e30('0x2b')](_0x40abc7,_0x2e30('0x29'));_0x2a61fd[_0x2e30('0x32')]=_[_0x2e30('0x33')](_0x5a8575[_0x2e30('0x32')]);_0x2a61fd['filters']=_[_0x2e30('0x34')](_0x2a61fd[_0x2e30('0x31')],_0x2a61fd['query']);_0x544150['attributes']=_[_0x2e30('0x34')](_0x2a61fd['model'],qs['fields'](_0x5a8575[_0x2e30('0x32')][_0x2e30('0x35')]));_0x544150['attributes']=_0x544150['attributes'][_0x2e30('0x36')]?_0x544150['attributes']:_0x2a61fd['model'];if(!_0x5a8575[_0x2e30('0x32')][_0x2e30('0x37')]('nolimit')){_0x544150[_0x2e30('0x1e')]=qs[_0x2e30('0x1e')](_0x5a8575[_0x2e30('0x32')]['limit']);_0x544150['offset']=qs[_0x2e30('0x1d')](_0x5a8575['query'][_0x2e30('0x1d')]);}_0x544150[_0x2e30('0x38')]=qs[_0x2e30('0x39')](_0x5a8575[_0x2e30('0x32')]['sort']);_0x544150[_0x2e30('0x3a')]=qs[_0x2e30('0x3b')](_['pick'](_0x5a8575[_0x2e30('0x32')],_0x2a61fd['filters']),_0x40abc7);if(_0x5a8575[_0x2e30('0x32')]['filter']){_0x544150[_0x2e30('0x3a')]=_[_0x2e30('0x3c')](_0x544150['where'],{'$or':_[_0x2e30('0x2b')](_0x40abc7,function(_0x2c41ba){if(_0x2c41ba['type']!==_0x2e30('0x3d')){var _0x4a9953={};_0x4a9953[_0x2c41ba[_0x2e30('0x29')]]={'$like':'%'+_0x5a8575[_0x2e30('0x32')][_0x2e30('0x3e')]+'%'};return _0x4a9953;}})});}_0x544150=_[_0x2e30('0x3c')]({},_0x544150,_0x5a8575['options']);var _0x6f766c={'where':_0x544150[_0x2e30('0x3a')]};return db[_0x2e30('0x2c')][_0x2e30('0x1c')](_0x6f766c)[_0x2e30('0x24')](function(_0x37f542){_0x323983['count']=_0x37f542;if(_0x5a8575[_0x2e30('0x32')][_0x2e30('0x3f')]){_0x544150[_0x2e30('0x40')]=[{'all':!![]}];}return db[_0x2e30('0x2c')]['findAll'](_0x544150);})[_0x2e30('0x24')](function(_0x6c42e4){_0x323983[_0x2e30('0x41')]=_0x6c42e4;return _0x323983;})[_0x2e30('0x24')](respondWithFilteredResult(_0x491f76,_0x544150))[_0x2e30('0x42')](handleError(_0x491f76,null));};exports[_0x2e30('0x43')]=function(_0x283381,_0x1cfaee){var _0x351526={'raw':!![],'where':{'id':_0x283381['params']['id']}},_0xda176d={};_0xda176d[_0x2e30('0x31')]=_[_0x2e30('0x33')](db[_0x2e30('0x2c')][_0x2e30('0x2d')]);_0xda176d[_0x2e30('0x32')]=_[_0x2e30('0x33')](_0x283381[_0x2e30('0x32')]);_0xda176d[_0x2e30('0x3b')]=_[_0x2e30('0x34')](_0xda176d['model'],_0xda176d['query']);_0x351526[_0x2e30('0x44')]=_[_0x2e30('0x34')](_0xda176d[_0x2e30('0x31')],qs[_0x2e30('0x35')](_0x283381[_0x2e30('0x32')]['fields']));_0x351526[_0x2e30('0x44')]=_0x351526[_0x2e30('0x44')]['length']?_0x351526[_0x2e30('0x44')]:_0xda176d['model'];if(_0x283381['query'][_0x2e30('0x3f')]){_0x351526[_0x2e30('0x40')]=[{'all':!![]}];}_0x351526=_[_0x2e30('0x3c')]({},_0x351526,_0x283381[_0x2e30('0x45')]);return db[_0x2e30('0x2c')]['find'](_0x351526)['then'](handleEntityNotFound(_0x1cfaee,null))[_0x2e30('0x24')](respondWithResult(_0x1cfaee,null))[_0x2e30('0x42')](handleError(_0x1cfaee,null));};exports['create']=function(_0x238136,_0x2a0354){return db[_0x2e30('0x2c')][_0x2e30('0x46')](_0x238136['body'],{})[_0x2e30('0x24')](function(_0xca7b9c){var _0x426b2d=_0x238136[_0x2e30('0x47')]['get']({'plain':!![]});if(!_0x426b2d)throw new Error(_0x2e30('0x48'));if(_0x426b2d[_0x2e30('0x49')]===_0x2e30('0x47')){var _0x4c4d46=_0xca7b9c[_0x2e30('0x25')]({'plain':!![]});var _0x28be5f=_0x2e30('0x4a');return db[_0x2e30('0x4b')][_0x2e30('0x4c')]({'where':{'name':_0x28be5f,'userProfileId':_0x426b2d[_0x2e30('0x4d')]},'raw':!![]})[_0x2e30('0x24')](function(_0x52bd68){if(_0x52bd68&&_0x52bd68[_0x2e30('0x4e')]===0x0){return db[_0x2e30('0x4f')]['create']({'name':_0x4c4d46['name'],'resourceId':_0x4c4d46['id'],'type':_0x52bd68['name'],'sectionId':_0x52bd68['id']},{})[_0x2e30('0x24')](function(){return _0xca7b9c;});}else{return _0xca7b9c;}})[_0x2e30('0x42')](function(_0x43b414){logger[_0x2e30('0x50')](_0x2e30('0x51'),_0x43b414);throw _0x43b414;});}return _0xca7b9c;})[_0x2e30('0x24')](respondWithResult(_0x2a0354,0xc9))[_0x2e30('0x42')](handleError(_0x2a0354,null));};exports[_0x2e30('0x23')]=function(_0x1706d6,_0x50330b){if(_0x1706d6[_0x2e30('0x52')]['id']){delete _0x1706d6[_0x2e30('0x52')]['id'];}return db[_0x2e30('0x2c')][_0x2e30('0x4c')]({'where':{'id':_0x1706d6[_0x2e30('0x53')]['id']}})[_0x2e30('0x24')](handleEntityNotFound(_0x50330b,null))['then'](saveUpdates(_0x1706d6[_0x2e30('0x52')],null))[_0x2e30('0x24')](respondWithResult(_0x50330b,null))[_0x2e30('0x42')](handleError(_0x50330b,null));};exports[_0x2e30('0x26')]=function(_0x226c5a,_0x1d9cb9){return db[_0x2e30('0x2c')][_0x2e30('0x4c')]({'where':{'id':_0x226c5a[_0x2e30('0x53')]['id']}})['then'](handleEntityNotFound(_0x1d9cb9,null))['then'](removeEntity(_0x1d9cb9,null))[_0x2e30('0x42')](handleError(_0x1d9cb9,null));};exports['download']=function(_0x45fb14,_0x213674,_0x13eff4){return db[_0x2e30('0x2c')][_0x2e30('0x4c')]({'where':{'id':_0x45fb14['params']['id']},'attributes':[_0x2e30('0x29'),_0x2e30('0x54'),_0x2e30('0x55'),_0x2e30('0x56')],'raw':!![]})[_0x2e30('0x24')](handleEntityNotFound(_0x213674,null))['then'](function(_0x2aebf1){if(_0x2aebf1){if(!fs[_0x2e30('0x57')](path[_0x2e30('0x58')](config[_0x2e30('0x59')],_0x2e30('0x5a'),_0x2aebf1[_0x2e30('0x55')]))){throw new db['Sequelize'][(_0x2e30('0x5b'))](_0x2e30('0x5c'));}if(_0x45fb14[_0x2e30('0x32')]['exists']){return _0x213674[_0x2e30('0x27')](0xc8);}return _0x213674[_0x2e30('0x5d')](path[_0x2e30('0x58')](config[_0x2e30('0x59')],_0x2e30('0x5a'),_0x2aebf1[_0x2e30('0x55')]),util[_0x2e30('0x5e')]('%s.%s',_0x2aebf1[_0x2e30('0x54')]||_0x2aebf1[_0x2e30('0x29')],_0x2aebf1[_0x2e30('0x56')][_0x2e30('0x5f')]()));}})[_0x2e30('0x42')](handleError(_0x213674,null));};
\ No newline at end of file