Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / analyticMetric / analyticMetric.controller.js
index f86971b..4073806 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe04a=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','get','Metrics','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','user','role','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring'];(function(_0x117fc0,_0x260bc0){var _0x2b034a=function(_0xc2d5b1){while(--_0xc2d5b1){_0x117fc0['push'](_0x117fc0['shift']());}};_0x2b034a(++_0x260bc0);}(_0xe04a,0x98));var _0xae04=function(_0x17cab6,_0x17aacc){_0x17cab6=_0x17cab6-0x0;var _0x513a04=_0xe04a[_0x17cab6];return _0x513a04;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xae04('0x0'));var zipdir=require(_0xae04('0x1'));var jsonpatch=require(_0xae04('0x2'));var rp=require('request-promise');var moment=require(_0xae04('0x3'));var BPromise=require(_0xae04('0x4'));var Mustache=require('mustache');var util=require(_0xae04('0x5'));var path=require(_0xae04('0x6'));var sox=require(_0xae04('0x7'));var csv=require(_0xae04('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae04('0x9'));var squel=require(_0xae04('0xa'));var crypto=require(_0xae04('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xae04('0xc'));var toCsv=require(_0xae04('0x8'));var querystring=require(_0xae04('0xd'));var Papa=require(_0xae04('0xe'));var Redis=require(_0xae04('0xf'));var authService=require(_0xae04('0x10'));var qs=require(_0xae04('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae04('0x12'));var logger=require(_0xae04('0x13'))(_0xae04('0x14'));var utils=require(_0xae04('0x15'));var config=require(_0xae04('0x16'));var licenseUtil=require(_0xae04('0x17'));var db=require(_0xae04('0x18'))['db'];function respondWithStatusCode(_0x28c022,_0x2a51a8){_0x2a51a8=_0x2a51a8||0xcc;return function(_0xc789b0){if(_0xc789b0){return _0x28c022[_0xae04('0x19')](_0x2a51a8);}return _0x28c022[_0xae04('0x1a')](_0x2a51a8)['end']();};}function respondWithResult(_0x5f4822,_0x5dc647){_0x5dc647=_0x5dc647||0xc8;return function(_0x172580){if(_0x172580){return _0x5f4822['status'](_0x5dc647)[_0xae04('0x1b')](_0x172580);}};}function respondWithFilteredResult(_0x1bcbc0,_0x2b177d){return function(_0x9c79c7){if(_0x9c79c7){var _0x33b282=_0x9c79c7[_0xae04('0x1c')],_0x4ad6b1=_0x2b177d['offset'],_0x3bca9f=_0x2b177d[_0xae04('0x1d')]+_0x2b177d[_0xae04('0x1e')],_0x290cd8;if(_0x3bca9f>=_0x33b282){_0x3bca9f=_0x33b282;_0x290cd8=0xc8;}else{_0x290cd8=0xce;}_0x1bcbc0[_0xae04('0x1a')](_0x290cd8);return _0x1bcbc0[_0xae04('0x1f')]('Content-Range',_0x4ad6b1+'-'+_0x3bca9f+'/'+_0x33b282)['json'](_0x9c79c7);}return null;};}function patchUpdates(_0x530887){return function(_0x2420a9){try{jsonpatch['apply'](_0x2420a9,_0x530887,!![]);}catch(_0x3c55b7){return BPromise[_0xae04('0x20')](_0x3c55b7);}return _0x2420a9[_0xae04('0x21')]();};}function saveUpdates(_0x57d4b7,_0x26d600){return function(_0x379ac0){if(_0x379ac0){return _0x379ac0[_0xae04('0x22')](_0x57d4b7)[_0xae04('0x23')](function(_0x3113c5){return _0x3113c5;});}return null;};}function removeEntity(_0x1479f6,_0x4af82a){return function(_0x21a566){if(_0x21a566){return _0x21a566['destroy']()[_0xae04('0x23')](function(){var _0x211e1e=_0x21a566[_0xae04('0x24')]({'plain':!![]});var _0x53a957=_0xae04('0x25');return db[_0xae04('0x26')][_0xae04('0x27')]({'where':{'type':_0x53a957,'resourceId':_0x211e1e['id']}})[_0xae04('0x23')](function(){return _0x21a566;});})[_0xae04('0x23')](function(){_0x1479f6['status'](0xcc)[_0xae04('0x28')]();});}};}function handleEntityNotFound(_0x5b82e1,_0x40b1b6){return function(_0x24246b){if(!_0x24246b){_0x5b82e1[_0xae04('0x19')](0x194);}return _0x24246b;};}function handleError(_0x414e7f,_0x3c664c){_0x3c664c=_0x3c664c||0x1f4;return function(_0xaddead){logger[_0xae04('0x29')](_0xaddead['stack']);if(_0xaddead[_0xae04('0x2a')]){delete _0xaddead[_0xae04('0x2a')];}_0x414e7f[_0xae04('0x1a')](_0x3c664c)[_0xae04('0x2b')](_0xaddead);};}exports[_0xae04('0x2c')]=function(_0xeef7c1,_0x146fea){var _0x978a30={},_0x4b2651={},_0x4adf0c={'count':0x0,'rows':[]};var _0x5821c0=_[_0xae04('0x2d')](db[_0xae04('0x2e')][_0xae04('0x2f')],function(_0xf10914){return{'name':_0xf10914[_0xae04('0x30')],'type':_0xf10914[_0xae04('0x31')][_0xae04('0x32')]};});_0x4b2651['model']=_[_0xae04('0x2d')](_0x5821c0,_0xae04('0x2a'));_0x4b2651[_0xae04('0x33')]=_[_0xae04('0x34')](_0xeef7c1[_0xae04('0x33')]);_0x4b2651[_0xae04('0x35')]=_[_0xae04('0x36')](_0x4b2651[_0xae04('0x37')],_0x4b2651[_0xae04('0x33')]);_0x978a30[_0xae04('0x38')]=_['intersection'](_0x4b2651['model'],qs[_0xae04('0x39')](_0xeef7c1[_0xae04('0x33')][_0xae04('0x39')]));_0x978a30[_0xae04('0x38')]=_0x978a30['attributes'][_0xae04('0x3a')]?_0x978a30['attributes']:_0x4b2651['model'];if(!_0xeef7c1['query'][_0xae04('0x3b')](_0xae04('0x3c'))){_0x978a30[_0xae04('0x1e')]=qs[_0xae04('0x1e')](_0xeef7c1[_0xae04('0x33')][_0xae04('0x1e')]);_0x978a30[_0xae04('0x1d')]=qs[_0xae04('0x1d')](_0xeef7c1['query'][_0xae04('0x1d')]);}_0x978a30[_0xae04('0x3d')]=qs[_0xae04('0x3e')](_0xeef7c1[_0xae04('0x33')]['sort']);_0x978a30[_0xae04('0x3f')]=qs[_0xae04('0x35')](_[_0xae04('0x40')](_0xeef7c1['query'],_0x4b2651[_0xae04('0x35')]),_0x5821c0);if(_0xeef7c1[_0xae04('0x33')][_0xae04('0x41')]){_0x978a30[_0xae04('0x3f')]=_[_0xae04('0x42')](_0x978a30[_0xae04('0x3f')],{'$or':_[_0xae04('0x2d')](_0x5821c0,function(_0x4db347){if(_0x4db347[_0xae04('0x31')]!==_0xae04('0x43')){var _0x119fba={};_0x119fba[_0x4db347[_0xae04('0x2a')]]={'$like':'%'+_0xeef7c1['query'][_0xae04('0x41')]+'%'};return _0x119fba;}})});}_0x978a30=_[_0xae04('0x42')]({},_0x978a30,_0xeef7c1[_0xae04('0x44')]);var _0x41e47d={'where':_0x978a30['where']};return db[_0xae04('0x2e')][_0xae04('0x1c')](_0x41e47d)[_0xae04('0x23')](function(_0x10d219){_0x4adf0c[_0xae04('0x1c')]=_0x10d219;if(_0xeef7c1['query'][_0xae04('0x45')]){_0x978a30[_0xae04('0x46')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xae04('0x47')](_0x978a30);})[_0xae04('0x23')](function(_0x393f02){_0x4adf0c[_0xae04('0x48')]=_0x393f02;return _0x4adf0c;})['then'](respondWithFilteredResult(_0x146fea,_0x978a30))['catch'](handleError(_0x146fea,null));};exports[_0xae04('0x49')]=function(_0x2a77c6,_0x263fa0){var _0x137beb={'raw':!![],'where':{'id':_0x2a77c6[_0xae04('0x4a')]['id']}},_0x1a1a8e={};_0x1a1a8e[_0xae04('0x37')]=_[_0xae04('0x34')](db[_0xae04('0x2e')][_0xae04('0x2f')]);_0x1a1a8e[_0xae04('0x33')]=_[_0xae04('0x34')](_0x2a77c6[_0xae04('0x33')]);_0x1a1a8e[_0xae04('0x35')]=_['intersection'](_0x1a1a8e[_0xae04('0x37')],_0x1a1a8e[_0xae04('0x33')]);_0x137beb[_0xae04('0x38')]=_[_0xae04('0x36')](_0x1a1a8e[_0xae04('0x37')],qs[_0xae04('0x39')](_0x2a77c6['query'][_0xae04('0x39')]));_0x137beb[_0xae04('0x38')]=_0x137beb[_0xae04('0x38')][_0xae04('0x3a')]?_0x137beb['attributes']:_0x1a1a8e[_0xae04('0x37')];if(_0x2a77c6[_0xae04('0x33')][_0xae04('0x45')]){_0x137beb[_0xae04('0x46')]=[{'all':!![]}];}_0x137beb=_[_0xae04('0x42')]({},_0x137beb,_0x2a77c6[_0xae04('0x44')]);return db[_0xae04('0x2e')]['find'](_0x137beb)[_0xae04('0x23')](handleEntityNotFound(_0x263fa0,null))[_0xae04('0x23')](respondWithResult(_0x263fa0,null))['catch'](handleError(_0x263fa0,null));};exports['create']=function(_0x2f5fb2,_0x280387){return db[_0xae04('0x2e')][_0xae04('0x4b')](_0x2f5fb2[_0xae04('0x4c')],{})['then'](function(_0x1025c3){var _0x3666be=_0x2f5fb2[_0xae04('0x4d')]['get']({'plain':!![]});if(!_0x3666be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3666be[_0xae04('0x4e')]===_0xae04('0x4d')){var _0x1b5118=_0x1025c3[_0xae04('0x24')]({'plain':!![]});var _0x3abe35='Metrics';return db['UserProfileSection'][_0xae04('0x4f')]({'where':{'name':_0x3abe35,'userProfileId':_0x3666be['userProfileId']},'raw':!![]})['then'](function(_0x4cf43a){if(_0x4cf43a&&_0x4cf43a[_0xae04('0x50')]===0x0){return db['UserProfileResource'][_0xae04('0x4b')]({'name':_0x1b5118['name'],'resourceId':_0x1b5118['id'],'type':_0x4cf43a[_0xae04('0x2a')],'sectionId':_0x4cf43a['id']},{})[_0xae04('0x23')](function(){return _0x1025c3;});}else{return _0x1025c3;}})[_0xae04('0x51')](function(_0x473fc3){logger['error'](_0xae04('0x52'),_0x473fc3);throw _0x473fc3;});}return _0x1025c3;})[_0xae04('0x23')](respondWithResult(_0x280387,0xc9))[_0xae04('0x51')](handleError(_0x280387,null));};exports[_0xae04('0x22')]=function(_0x24e019,_0x15e160){if(_0x24e019[_0xae04('0x4c')]['id']){delete _0x24e019['body']['id'];}return db[_0xae04('0x2e')][_0xae04('0x4f')]({'where':{'id':_0x24e019['params']['id']}})['then'](handleEntityNotFound(_0x15e160,null))[_0xae04('0x23')](saveUpdates(_0x24e019[_0xae04('0x4c')],null))[_0xae04('0x23')](respondWithResult(_0x15e160,null))['catch'](handleError(_0x15e160,null));};exports[_0xae04('0x27')]=function(_0x2619da,_0x45d6d5){return db[_0xae04('0x2e')][_0xae04('0x4f')]({'where':{'id':_0x2619da[_0xae04('0x4a')]['id']}})[_0xae04('0x23')](handleEntityNotFound(_0x45d6d5,null))['then'](removeEntity(_0x45d6d5,null))[_0xae04('0x51')](handleError(_0x45d6d5,null));};
\ No newline at end of file
+var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x4b3152,_0x2ffdf6){var _0x47c35c=function(_0x3efaba){while(--_0x3efaba){_0x4b3152['push'](_0x4b3152['shift']());}};_0x47c35c(++_0x2ffdf6);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0xe5b3[_0x4e697a];return _0x88850c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));};
\ No newline at end of file