Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index f155ae9..45848a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2853=['limit','Content-Range','json','save','destroy','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','params','keys','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset'];(function(_0x4bed89,_0x423fef){var _0x359a70=function(_0xf4626f){while(--_0xf4626f){_0x4bed89['push'](_0x4bed89['shift']());}};_0x359a70(++_0x423fef);}(_0x2853,0x148));var _0x3285=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x2853[_0x42f009];return _0x22a1e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3285('0x0'));var rimraf=require(_0x3285('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3285('0x2'));var rp=require(_0x3285('0x3'));var moment=require(_0x3285('0x4'));var BPromise=require(_0x3285('0x5'));var Mustache=require(_0x3285('0x6'));var util=require(_0x3285('0x7'));var path=require(_0x3285('0x8'));var sox=require(_0x3285('0x9'));var csv=require('to-csv');var ejs=require(_0x3285('0xa'));var fs=require('fs');var _=require(_0x3285('0xb'));var squel=require(_0x3285('0xc'));var crypto=require(_0x3285('0xd'));var jsforce=require(_0x3285('0xe'));var deskjs=require(_0x3285('0xf'));var toCsv=require(_0x3285('0x10'));var querystring=require(_0x3285('0x11'));var Papa=require(_0x3285('0x12'));var Redis=require(_0x3285('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3285('0x14'));var as=require(_0x3285('0x15'));var hardwareService=require(_0x3285('0x16'));var logger=require(_0x3285('0x17'))(_0x3285('0x18'));var utils=require(_0x3285('0x19'));var config=require(_0x3285('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3285('0x1b'))['db'];function respondWithStatusCode(_0x4f376c,_0x4250a5){_0x4250a5=_0x4250a5||0xcc;return function(_0x185e81){if(_0x185e81){return _0x4f376c['sendStatus'](_0x4250a5);}return _0x4f376c['status'](_0x4250a5)[_0x3285('0x1c')]();};}function respondWithResult(_0x418f65,_0x422903){_0x422903=_0x422903||0xc8;return function(_0x120570){if(_0x120570){return _0x418f65[_0x3285('0x1d')](_0x422903)['json'](_0x120570);}};}function respondWithFilteredResult(_0x531137,_0x462eb5){return function(_0x450f6f){if(_0x450f6f){var _0x53ad19=_0x450f6f[_0x3285('0x1e')],_0x20f1c1=_0x462eb5[_0x3285('0x1f')],_0x12b5d5=_0x462eb5['offset']+_0x462eb5[_0x3285('0x20')],_0x4f4917;if(_0x12b5d5>=_0x53ad19){_0x12b5d5=_0x53ad19;_0x4f4917=0xc8;}else{_0x4f4917=0xce;}_0x531137['status'](_0x4f4917);return _0x531137['set'](_0x3285('0x21'),_0x20f1c1+'-'+_0x12b5d5+'/'+_0x53ad19)[_0x3285('0x22')](_0x450f6f);}return null;};}function patchUpdates(_0x1ddb7b){return function(_0x4f6855){try{jsonpatch['apply'](_0x4f6855,_0x1ddb7b,!![]);}catch(_0x23334e){return BPromise['reject'](_0x23334e);}return _0x4f6855[_0x3285('0x23')]();};}function saveUpdates(_0x206ed1,_0x6f663c){return function(_0x219381){if(_0x219381){return _0x219381['update'](_0x206ed1)['then'](function(_0x391cbd){return _0x391cbd;});}return null;};}function removeEntity(_0x1d976f,_0x4ecba5){return function(_0x3cd110){if(_0x3cd110){return _0x3cd110[_0x3285('0x24')]()['then'](function(){_0x1d976f[_0x3285('0x1d')](0xcc)[_0x3285('0x1c')]();});}};}function handleEntityNotFound(_0x12e175,_0x36d25a){return function(_0x5c4ced){if(!_0x5c4ced){_0x12e175['sendStatus'](0x194);}return _0x5c4ced;};}function handleError(_0x40b06b,_0x75557f){_0x75557f=_0x75557f||0x1f4;return function(_0x1852e1){logger['error'](_0x1852e1[_0x3285('0x25')]);if(_0x1852e1[_0x3285('0x26')]){delete _0x1852e1[_0x3285('0x26')];}_0x40b06b[_0x3285('0x1d')](_0x75557f)[_0x3285('0x27')](_0x1852e1);};}exports[_0x3285('0x28')]=function(_0x1ca802,_0x47d477){var _0x553370={},_0x32072d={},_0x1e735f={'count':0x0,'rows':[]};var _0x505044=_['map'](db[_0x3285('0x29')][_0x3285('0x2a')],function(_0x55ca81){return{'name':_0x55ca81[_0x3285('0x2b')],'type':_0x55ca81['type'][_0x3285('0x2c')]};});_0x32072d[_0x3285('0x2d')]=_['map'](_0x505044,_0x3285('0x26'));_0x32072d['query']=_['keys'](_0x1ca802[_0x3285('0x2e')]);_0x32072d['filters']=_[_0x3285('0x2f')](_0x32072d[_0x3285('0x2d')],_0x32072d['query']);_0x553370[_0x3285('0x30')]=_['intersection'](_0x32072d[_0x3285('0x2d')],qs['fields'](_0x1ca802[_0x3285('0x2e')][_0x3285('0x31')]));_0x553370[_0x3285('0x30')]=_0x553370[_0x3285('0x30')][_0x3285('0x32')]?_0x553370[_0x3285('0x30')]:_0x32072d[_0x3285('0x2d')];if(!_0x1ca802[_0x3285('0x2e')]['hasOwnProperty'](_0x3285('0x33'))){_0x553370[_0x3285('0x20')]=qs[_0x3285('0x20')](_0x1ca802[_0x3285('0x2e')][_0x3285('0x20')]);_0x553370[_0x3285('0x1f')]=qs['offset'](_0x1ca802[_0x3285('0x2e')][_0x3285('0x1f')]);}_0x553370[_0x3285('0x34')]=qs[_0x3285('0x35')](_0x1ca802['query'][_0x3285('0x35')]);_0x553370[_0x3285('0x36')]=qs[_0x3285('0x37')](_['pick'](_0x1ca802['query'],_0x32072d[_0x3285('0x37')]),_0x505044);if(_0x1ca802[_0x3285('0x2e')][_0x3285('0x38')]){_0x553370[_0x3285('0x36')]=_[_0x3285('0x39')](_0x553370[_0x3285('0x36')],{'$or':_['map'](_0x505044,function(_0x16a1d7){if(_0x16a1d7[_0x3285('0x3a')]!=='VIRTUAL'){var _0x459f81={};_0x459f81[_0x16a1d7['name']]={'$like':'%'+_0x1ca802[_0x3285('0x2e')]['filter']+'%'};return _0x459f81;}})});}_0x553370=_['merge']({},_0x553370,_0x1ca802[_0x3285('0x3b')]);var _0x19aaca={'where':_0x553370['where']};return db[_0x3285('0x29')][_0x3285('0x1e')](_0x19aaca)[_0x3285('0x3c')](function(_0xd60b1f){_0x1e735f[_0x3285('0x1e')]=_0xd60b1f;if(_0x1ca802[_0x3285('0x2e')][_0x3285('0x3d')]){_0x553370[_0x3285('0x3e')]=[{'all':!![]}];}return db[_0x3285('0x29')][_0x3285('0x3f')](_0x553370);})[_0x3285('0x3c')](function(_0x5bf72e){_0x1e735f[_0x3285('0x40')]=_0x5bf72e;return _0x1e735f;})[_0x3285('0x3c')](respondWithFilteredResult(_0x47d477,_0x553370))[_0x3285('0x41')](handleError(_0x47d477,null));};exports['show']=function(_0x4534ca,_0x43fddd){var _0x32217d={'raw':!![],'where':{'id':_0x4534ca[_0x3285('0x42')]['id']}},_0x1f316d={};_0x1f316d[_0x3285('0x2d')]=_[_0x3285('0x43')](db[_0x3285('0x29')][_0x3285('0x2a')]);_0x1f316d[_0x3285('0x2e')]=_[_0x3285('0x43')](_0x4534ca[_0x3285('0x2e')]);_0x1f316d[_0x3285('0x37')]=_['intersection'](_0x1f316d[_0x3285('0x2d')],_0x1f316d[_0x3285('0x2e')]);_0x32217d['attributes']=_[_0x3285('0x2f')](_0x1f316d[_0x3285('0x2d')],qs['fields'](_0x4534ca[_0x3285('0x2e')][_0x3285('0x31')]));_0x32217d[_0x3285('0x30')]=_0x32217d[_0x3285('0x30')]['length']?_0x32217d[_0x3285('0x30')]:_0x1f316d[_0x3285('0x2d')];if(_0x4534ca[_0x3285('0x2e')]['includeAll']){_0x32217d[_0x3285('0x3e')]=[{'all':!![]}];}_0x32217d=_['merge']({},_0x32217d,_0x4534ca[_0x3285('0x3b')]);return db[_0x3285('0x29')]['find'](_0x32217d)[_0x3285('0x3c')](handleEntityNotFound(_0x43fddd,null))[_0x3285('0x3c')](respondWithResult(_0x43fddd,null))[_0x3285('0x41')](handleError(_0x43fddd,null));};exports[_0x3285('0x44')]=function(_0x7fcd8e,_0x479d60){return db[_0x3285('0x29')][_0x3285('0x44')](_0x7fcd8e['body'],{})[_0x3285('0x3c')](respondWithResult(_0x479d60,0xc9))[_0x3285('0x41')](handleError(_0x479d60,null));};exports[_0x3285('0x45')]=function(_0x51cfba,_0x45fed6){return db['CmHopperHistory'][_0x3285('0x45')]()[_0x3285('0x3c')](respondWithResult(_0x45fed6,null))['catch'](handleError(_0x45fed6,null));};exports['update']=function(_0x1bde56,_0x4a2c11){if(_0x1bde56[_0x3285('0x46')][_0x3285('0x47')]){delete _0x1bde56[_0x3285('0x46')][_0x3285('0x47')];}return db[_0x3285('0x29')]['find']({'where':{'uniqueid':_0x1bde56[_0x3285('0x42')]['id']}})[_0x3285('0x3c')](handleEntityNotFound(_0x4a2c11,null))[_0x3285('0x3c')](saveUpdates(_0x1bde56[_0x3285('0x46')],null))['then'](respondWithResult(_0x4a2c11,null))[_0x3285('0x41')](handleError(_0x4a2c11,null));};
\ No newline at end of file
+var _0xcfd5=['crypto','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','intersection','options','find','body','catch','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4f39de,_0x595d15){var _0xe8eeb9=function(_0x4cd423){while(--_0x4cd423){_0x4f39de['push'](_0x4f39de['shift']());}};_0xe8eeb9(++_0x595d15);}(_0xcfd5,0x112));var _0x5cfd=function(_0xde9c14,_0x5947d4){_0xde9c14=_0xde9c14-0x0;var _0x14fedd=_0xcfd5[_0xde9c14];return _0x14fedd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cfd('0x0'));var zipdir=require(_0x5cfd('0x1'));var jsonpatch=require(_0x5cfd('0x2'));var rp=require(_0x5cfd('0x3'));var moment=require(_0x5cfd('0x4'));var BPromise=require(_0x5cfd('0x5'));var Mustache=require('mustache');var util=require(_0x5cfd('0x6'));var path=require(_0x5cfd('0x7'));var sox=require(_0x5cfd('0x8'));var csv=require(_0x5cfd('0x9'));var ejs=require(_0x5cfd('0xa'));var fs=require('fs');var fs_extra=require(_0x5cfd('0xb'));var _=require(_0x5cfd('0xc'));var squel=require(_0x5cfd('0xd'));var crypto=require(_0x5cfd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5cfd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5cfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5cfd('0x10'));var hardwareService=require(_0x5cfd('0x11'));var logger=require(_0x5cfd('0x12'))(_0x5cfd('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5cfd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c0309,_0x14d3bf){_0x14d3bf=_0x14d3bf||0xcc;return function(_0x54d648){if(_0x54d648){return _0x4c0309[_0x5cfd('0x15')](_0x14d3bf);}return _0x4c0309[_0x5cfd('0x16')](_0x14d3bf)[_0x5cfd('0x17')]();};}function respondWithResult(_0x56b4d4,_0x1f218a){_0x1f218a=_0x1f218a||0xc8;return function(_0x38959b){if(_0x38959b){return _0x56b4d4[_0x5cfd('0x16')](_0x1f218a)[_0x5cfd('0x18')](_0x38959b);}};}function respondWithFilteredResult(_0x46b050,_0x1da81e){return function(_0x10da32){if(_0x10da32){var _0x10d1fe=typeof _0x1da81e['offset']===_0x5cfd('0x19')&&typeof _0x1da81e[_0x5cfd('0x1a')]===_0x5cfd('0x19');var _0x5a78ff=_0x10da32[_0x5cfd('0x1b')];var _0x53754d=_0x10d1fe?0x0:_0x1da81e[_0x5cfd('0x1c')];var _0xb25381=_0x10d1fe?_0x10da32['count']:_0x1da81e['offset']+_0x1da81e[_0x5cfd('0x1a')];var _0x2a2798;if(_0xb25381>=_0x5a78ff){_0xb25381=_0x5a78ff;_0x2a2798=0xc8;}else{_0x2a2798=0xce;}_0x46b050[_0x5cfd('0x16')](_0x2a2798);return _0x46b050[_0x5cfd('0x1d')](_0x5cfd('0x1e'),_0x53754d+'-'+_0xb25381+'/'+_0x5a78ff)[_0x5cfd('0x18')](_0x10da32);}return null;};}function patchUpdates(_0x385a49){return function(_0x34245d){try{jsonpatch[_0x5cfd('0x1f')](_0x34245d,_0x385a49,!![]);}catch(_0x43a142){return BPromise['reject'](_0x43a142);}return _0x34245d[_0x5cfd('0x20')]();};}function saveUpdates(_0x3b0e13,_0x470f29){return function(_0x1eb528){if(_0x1eb528){return _0x1eb528[_0x5cfd('0x21')](_0x3b0e13)[_0x5cfd('0x22')](function(_0x46fe71){return _0x46fe71;});}return null;};}function removeEntity(_0x1c111a,_0x5a914c){return function(_0x2be2d1){if(_0x2be2d1){return _0x2be2d1['destroy']()[_0x5cfd('0x22')](function(){_0x1c111a[_0x5cfd('0x16')](0xcc)[_0x5cfd('0x17')]();});}};}function handleEntityNotFound(_0x5c847f,_0x358f9c){return function(_0x1efd35){if(!_0x1efd35){_0x5c847f[_0x5cfd('0x15')](0x194);}return _0x1efd35;};}function handleError(_0x5cf553,_0x5633db){_0x5633db=_0x5633db||0x1f4;return function(_0x3dbe62){logger[_0x5cfd('0x23')](_0x3dbe62[_0x5cfd('0x24')]);if(_0x3dbe62[_0x5cfd('0x25')]){delete _0x3dbe62[_0x5cfd('0x25')];}_0x5cf553[_0x5cfd('0x16')](_0x5633db)[_0x5cfd('0x26')](_0x3dbe62);};}exports[_0x5cfd('0x27')]=function(_0x410ae7,_0x239a96){var _0x24b586={},_0x12b719={},_0x2f1b50={'count':0x0,'rows':[]};var _0x8b7fa0=_[_0x5cfd('0x28')](db[_0x5cfd('0x29')][_0x5cfd('0x2a')],function(_0x63d80f){return{'name':_0x63d80f[_0x5cfd('0x2b')],'type':_0x63d80f[_0x5cfd('0x2c')][_0x5cfd('0x2d')]};});_0x12b719[_0x5cfd('0x2e')]=_[_0x5cfd('0x28')](_0x8b7fa0,'name');_0x12b719[_0x5cfd('0x2f')]=_[_0x5cfd('0x30')](_0x410ae7[_0x5cfd('0x2f')]);_0x12b719[_0x5cfd('0x31')]=_['intersection'](_0x12b719['model'],_0x12b719[_0x5cfd('0x2f')]);_0x24b586['attributes']=_['intersection'](_0x12b719[_0x5cfd('0x2e')],qs[_0x5cfd('0x32')](_0x410ae7[_0x5cfd('0x2f')]['fields']));_0x24b586[_0x5cfd('0x33')]=_0x24b586[_0x5cfd('0x33')][_0x5cfd('0x34')]?_0x24b586[_0x5cfd('0x33')]:_0x12b719['model'];if(!_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x35')]('nolimit')){_0x24b586['limit']=qs[_0x5cfd('0x1a')](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x1a')]);_0x24b586[_0x5cfd('0x1c')]=qs['offset'](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x1c')]);}_0x24b586['order']=qs[_0x5cfd('0x36')](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x36')]);_0x24b586[_0x5cfd('0x37')]=qs[_0x5cfd('0x31')](_[_0x5cfd('0x38')](_0x410ae7[_0x5cfd('0x2f')],_0x12b719[_0x5cfd('0x31')]),_0x8b7fa0);if(_0x410ae7[_0x5cfd('0x2f')]['filter']){_0x24b586['where']=_[_0x5cfd('0x39')](_0x24b586['where'],{'$or':_[_0x5cfd('0x28')](_0x8b7fa0,function(_0x28e9ee){if(_0x28e9ee[_0x5cfd('0x2c')]!==_0x5cfd('0x3a')){var _0x447184={};_0x447184[_0x28e9ee['name']]={'$like':'%'+_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x3b')]+'%'};return _0x447184;}})});}_0x24b586=_[_0x5cfd('0x39')]({},_0x24b586,_0x410ae7['options']);var _0x51218d={'where':_0x24b586[_0x5cfd('0x37')]};return db[_0x5cfd('0x29')][_0x5cfd('0x1b')](_0x51218d)[_0x5cfd('0x22')](function(_0x3d6bba){_0x2f1b50['count']=_0x3d6bba;if(_0x410ae7['query'][_0x5cfd('0x3c')]){_0x24b586[_0x5cfd('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5cfd('0x3e')](_0x24b586);})[_0x5cfd('0x22')](function(_0x59eae3){_0x2f1b50[_0x5cfd('0x3f')]=_0x59eae3;return _0x2f1b50;})['then'](respondWithFilteredResult(_0x239a96,_0x24b586))['catch'](handleError(_0x239a96,null));};exports['show']=function(_0x3785,_0x1ab837){var _0x1ee2ad={'raw':!![],'where':{'id':_0x3785[_0x5cfd('0x40')]['id']}},_0x2edf9e={};_0x2edf9e['model']=_[_0x5cfd('0x30')](db['CmHopperHistory']['rawAttributes']);_0x2edf9e[_0x5cfd('0x2f')]=_[_0x5cfd('0x30')](_0x3785[_0x5cfd('0x2f')]);_0x2edf9e[_0x5cfd('0x31')]=_[_0x5cfd('0x41')](_0x2edf9e['model'],_0x2edf9e[_0x5cfd('0x2f')]);_0x1ee2ad[_0x5cfd('0x33')]=_[_0x5cfd('0x41')](_0x2edf9e[_0x5cfd('0x2e')],qs[_0x5cfd('0x32')](_0x3785[_0x5cfd('0x2f')][_0x5cfd('0x32')]));_0x1ee2ad[_0x5cfd('0x33')]=_0x1ee2ad[_0x5cfd('0x33')][_0x5cfd('0x34')]?_0x1ee2ad['attributes']:_0x2edf9e[_0x5cfd('0x2e')];if(_0x3785[_0x5cfd('0x2f')][_0x5cfd('0x3c')]){_0x1ee2ad[_0x5cfd('0x3d')]=[{'all':!![]}];}_0x1ee2ad=_['merge']({},_0x1ee2ad,_0x3785[_0x5cfd('0x42')]);return db['CmHopperHistory'][_0x5cfd('0x43')](_0x1ee2ad)['then'](handleEntityNotFound(_0x1ab837,null))['then'](respondWithResult(_0x1ab837,null))['catch'](handleError(_0x1ab837,null));};exports['create']=function(_0x212ad4,_0x421c57){return db['CmHopperHistory']['create'](_0x212ad4[_0x5cfd('0x44')],{})[_0x5cfd('0x22')](respondWithResult(_0x421c57,0xc9))[_0x5cfd('0x45')](handleError(_0x421c57,null));};exports[_0x5cfd('0x46')]=function(_0x29476c,_0x3b021e){return db[_0x5cfd('0x29')][_0x5cfd('0x46')]()[_0x5cfd('0x22')](respondWithResult(_0x3b021e,null))[_0x5cfd('0x45')](handleError(_0x3b021e,null));};exports[_0x5cfd('0x21')]=function(_0x320078,_0x2d968b){if(_0x320078[_0x5cfd('0x44')][_0x5cfd('0x47')]){delete _0x320078['body']['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x320078[_0x5cfd('0x40')]['id']}})[_0x5cfd('0x22')](handleEntityNotFound(_0x2d968b,null))['then'](saveUpdates(_0x320078[_0x5cfd('0x44')],null))[_0x5cfd('0x22')](respondWithResult(_0x2d968b,null))[_0x5cfd('0x45')](handleError(_0x2d968b,null));};
\ No newline at end of file