Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / action / action.controller.js
index 8ae7718..0022507 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b0e=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','error','name','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1874f7,_0x5636fe){var _0x3e68ce=function(_0x384390){while(--_0x384390){_0x1874f7['push'](_0x1874f7['shift']());}};_0x3e68ce(++_0x5636fe);}(_0x9b0e,0x177));var _0xe9b0=function(_0x1620c9,_0x3b43be){_0x1620c9=_0x1620c9-0x0;var _0x5604c8=_0x9b0e[_0x1620c9];return _0x5604c8;};'use strict';var emlformat=require(_0xe9b0('0x0'));var rimraf=require(_0xe9b0('0x1'));var zipdir=require(_0xe9b0('0x2'));var jsonpatch=require(_0xe9b0('0x3'));var rp=require(_0xe9b0('0x4'));var moment=require(_0xe9b0('0x5'));var BPromise=require(_0xe9b0('0x6'));var Mustache=require(_0xe9b0('0x7'));var util=require(_0xe9b0('0x8'));var path=require(_0xe9b0('0x9'));var sox=require(_0xe9b0('0xa'));var csv=require(_0xe9b0('0xb'));var ejs=require(_0xe9b0('0xc'));var fs=require('fs');var fs_extra=require(_0xe9b0('0xd'));var _=require(_0xe9b0('0xe'));var squel=require(_0xe9b0('0xf'));var crypto=require('crypto');var jsforce=require(_0xe9b0('0x10'));var deskjs=require(_0xe9b0('0x11'));var toCsv=require(_0xe9b0('0xb'));var querystring=require(_0xe9b0('0x12'));var Papa=require(_0xe9b0('0x13'));var Redis=require(_0xe9b0('0x14'));var authService=require(_0xe9b0('0x15'));var qs=require(_0xe9b0('0x16'));var as=require(_0xe9b0('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9b0('0x18'))('api');var utils=require(_0xe9b0('0x19'));var config=require(_0xe9b0('0x1a'));var licenseUtil=require(_0xe9b0('0x1b'));var db=require(_0xe9b0('0x1c'))['db'];function respondWithStatusCode(_0x1ccae7,_0x1dd547){_0x1dd547=_0x1dd547||0xcc;return function(_0x5ba669){if(_0x5ba669){return _0x1ccae7[_0xe9b0('0x1d')](_0x1dd547);}return _0x1ccae7[_0xe9b0('0x1e')](_0x1dd547)['end']();};}function respondWithResult(_0x354293,_0x2fa135){_0x2fa135=_0x2fa135||0xc8;return function(_0x1e1f7d){if(_0x1e1f7d){return _0x354293[_0xe9b0('0x1e')](_0x2fa135)['json'](_0x1e1f7d);}};}function respondWithFilteredResult(_0x607dca,_0x502dc4){return function(_0x201cfa){if(_0x201cfa){var _0x2e509e=typeof _0x502dc4[_0xe9b0('0x1f')]==='undefined'&&typeof _0x502dc4[_0xe9b0('0x20')]===_0xe9b0('0x21');var _0x327fd2=_0x201cfa[_0xe9b0('0x22')];var _0x3a0c9c=_0x2e509e?0x0:_0x502dc4[_0xe9b0('0x1f')];var _0x28fccc=_0x2e509e?_0x201cfa['count']:_0x502dc4['offset']+_0x502dc4[_0xe9b0('0x20')];var _0x431e7f;if(_0x28fccc>=_0x327fd2){_0x28fccc=_0x327fd2;_0x431e7f=0xc8;}else{_0x431e7f=0xce;}_0x607dca['status'](_0x431e7f);return _0x607dca[_0xe9b0('0x23')](_0xe9b0('0x24'),_0x3a0c9c+'-'+_0x28fccc+'/'+_0x327fd2)[_0xe9b0('0x25')](_0x201cfa);}return null;};}function patchUpdates(_0xb70a7d){return function(_0x127621){try{jsonpatch['apply'](_0x127621,_0xb70a7d,!![]);}catch(_0x45c32e){return BPromise[_0xe9b0('0x26')](_0x45c32e);}return _0x127621[_0xe9b0('0x27')]();};}function saveUpdates(_0x594db3,_0x556d5b){return function(_0x59508c){if(_0x59508c){return _0x59508c['update'](_0x594db3)[_0xe9b0('0x28')](function(_0x53d035){return _0x53d035;});}return null;};}function removeEntity(_0x2928ed,_0x14a48e){return function(_0x15f469){if(_0x15f469){return _0x15f469[_0xe9b0('0x29')]()[_0xe9b0('0x28')](function(){_0x2928ed[_0xe9b0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29775e,_0x499a25){return function(_0x581ab0){if(!_0x581ab0){_0x29775e['sendStatus'](0x194);}return _0x581ab0;};}function handleError(_0x5a928d,_0x4a4418){_0x4a4418=_0x4a4418||0x1f4;return function(_0x13f2f3){logger[_0xe9b0('0x2a')](_0x13f2f3['stack']);if(_0x13f2f3['name']){delete _0x13f2f3[_0xe9b0('0x2b')];}_0x5a928d[_0xe9b0('0x1e')](_0x4a4418)['send'](_0x13f2f3);};}exports[_0xe9b0('0x2c')]=function(_0xc4154f,_0x3b9ff2){if(_0xc4154f[_0xe9b0('0x2d')]['id']){delete _0xc4154f[_0xe9b0('0x2d')]['id'];}return db[_0xe9b0('0x2e')][_0xe9b0('0x2f')]({'where':{'id':_0xc4154f[_0xe9b0('0x30')]['id']}})[_0xe9b0('0x28')](handleEntityNotFound(_0x3b9ff2,null))[_0xe9b0('0x28')](saveUpdates(_0xc4154f[_0xe9b0('0x2d')],null))[_0xe9b0('0x28')](respondWithResult(_0x3b9ff2,null))[_0xe9b0('0x31')](handleError(_0x3b9ff2,null));};exports[_0xe9b0('0x29')]=function(_0x2ff4b1,_0xfc870b){return db[_0xe9b0('0x2e')][_0xe9b0('0x2f')]({'where':{'id':_0x2ff4b1['params']['id']}})[_0xe9b0('0x28')](handleEntityNotFound(_0xfc870b,null))[_0xe9b0('0x28')](removeEntity(_0xfc870b,null))[_0xe9b0('0x31')](handleError(_0xfc870b,null));};
\ No newline at end of file
+var _0x09a4=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','body','Action','params','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x50a330,_0x2e003c){var _0x475636=function(_0x1ce9ab){while(--_0x1ce9ab){_0x50a330['push'](_0x50a330['shift']());}};_0x475636(++_0x2e003c);}(_0x09a4,0x101));var _0x409a=function(_0x7555db,_0x28062d){_0x7555db=_0x7555db-0x0;var _0x2a2f0b=_0x09a4[_0x7555db];return _0x2a2f0b;};'use strict';var emlformat=require(_0x409a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x409a('0x1'));var jsonpatch=require(_0x409a('0x2'));var rp=require(_0x409a('0x3'));var moment=require(_0x409a('0x4'));var BPromise=require(_0x409a('0x5'));var Mustache=require(_0x409a('0x6'));var util=require(_0x409a('0x7'));var path=require(_0x409a('0x8'));var sox=require(_0x409a('0x9'));var csv=require(_0x409a('0xa'));var ejs=require(_0x409a('0xb'));var fs=require('fs');var fs_extra=require(_0x409a('0xc'));var _=require(_0x409a('0xd'));var squel=require(_0x409a('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x409a('0xa'));var querystring=require(_0x409a('0xf'));var Papa=require(_0x409a('0x10'));var Redis=require('ioredis');var authService=require(_0x409a('0x11'));var qs=require(_0x409a('0x12'));var as=require(_0x409a('0x13'));var hardwareService=require(_0x409a('0x14'));var logger=require(_0x409a('0x15'))('api');var utils=require(_0x409a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x409a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a776b,_0xe5bdc6){_0xe5bdc6=_0xe5bdc6||0xcc;return function(_0xdbc164){if(_0xdbc164){return _0x5a776b[_0x409a('0x18')](_0xe5bdc6);}return _0x5a776b[_0x409a('0x19')](_0xe5bdc6)[_0x409a('0x1a')]();};}function respondWithResult(_0x106ee2,_0x56ee6b){_0x56ee6b=_0x56ee6b||0xc8;return function(_0x2c23b8){if(_0x2c23b8){return _0x106ee2[_0x409a('0x19')](_0x56ee6b)['json'](_0x2c23b8);}};}function respondWithFilteredResult(_0x13c49d,_0x1f3d8d){return function(_0x8bc622){if(_0x8bc622){var _0x40cd47=typeof _0x1f3d8d['offset']===_0x409a('0x1b')&&typeof _0x1f3d8d[_0x409a('0x1c')]===_0x409a('0x1b');var _0x2f259e=_0x8bc622[_0x409a('0x1d')];var _0x197512=_0x40cd47?0x0:_0x1f3d8d[_0x409a('0x1e')];var _0x493cac=_0x40cd47?_0x8bc622['count']:_0x1f3d8d[_0x409a('0x1e')]+_0x1f3d8d['limit'];var _0x508ab4;if(_0x493cac>=_0x2f259e){_0x493cac=_0x2f259e;_0x508ab4=0xc8;}else{_0x508ab4=0xce;}_0x13c49d[_0x409a('0x19')](_0x508ab4);return _0x13c49d[_0x409a('0x1f')](_0x409a('0x20'),_0x197512+'-'+_0x493cac+'/'+_0x2f259e)[_0x409a('0x21')](_0x8bc622);}return null;};}function patchUpdates(_0x91a761){return function(_0x13b45e){try{jsonpatch[_0x409a('0x22')](_0x13b45e,_0x91a761,!![]);}catch(_0x563471){return BPromise[_0x409a('0x23')](_0x563471);}return _0x13b45e[_0x409a('0x24')]();};}function saveUpdates(_0x2a8595,_0x1a0c97){return function(_0x3fe16b){if(_0x3fe16b){return _0x3fe16b[_0x409a('0x25')](_0x2a8595)[_0x409a('0x26')](function(_0x5dd2f4){return _0x5dd2f4;});}return null;};}function removeEntity(_0x39f0ec,_0x41c25e){return function(_0x180c36){if(_0x180c36){return _0x180c36[_0x409a('0x27')]()['then'](function(){_0x39f0ec['status'](0xcc)[_0x409a('0x1a')]();});}};}function handleEntityNotFound(_0x3203e1,_0x3d9ca1){return function(_0x4df9f0){if(!_0x4df9f0){_0x3203e1['sendStatus'](0x194);}return _0x4df9f0;};}function handleError(_0x27a0fd,_0x366dc8){_0x366dc8=_0x366dc8||0x1f4;return function(_0x56ce68){logger[_0x409a('0x28')](_0x56ce68[_0x409a('0x29')]);if(_0x56ce68[_0x409a('0x2a')]){delete _0x56ce68['name'];}_0x27a0fd[_0x409a('0x19')](_0x366dc8)['send'](_0x56ce68);};}exports[_0x409a('0x25')]=function(_0x1b10d7,_0x5a4298){if(_0x1b10d7[_0x409a('0x2b')]['id']){delete _0x1b10d7[_0x409a('0x2b')]['id'];}return db[_0x409a('0x2c')]['find']({'where':{'id':_0x1b10d7[_0x409a('0x2d')]['id']}})[_0x409a('0x26')](handleEntityNotFound(_0x5a4298,null))['then'](saveUpdates(_0x1b10d7['body'],null))[_0x409a('0x26')](respondWithResult(_0x5a4298,null))[_0x409a('0x2e')](handleError(_0x5a4298,null));};exports['destroy']=function(_0x5b6ed9,_0x25e7d7){return db[_0x409a('0x2c')][_0x409a('0x2f')]({'where':{'id':_0x5b6ed9[_0x409a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x25e7d7,null))[_0x409a('0x26')](removeEntity(_0x25e7d7,null))['catch'](handleError(_0x25e7d7,null));};
\ No newline at end of file