Built motion from commit a679711e.|2.6.15
[motion2.git] / server / api / action / action.controller.js
index db10b06..b1f3520 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63d9=['../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','update','then','end','stack','name','send','body','find','params','destroy','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api'];(function(_0x4bdfc6,_0x4c2991){var _0x5091d0=function(_0x16cdc1){while(--_0x16cdc1){_0x4bdfc6['push'](_0x4bdfc6['shift']());}};_0x5091d0(++_0x4c2991);}(_0x63d9,0xe2));var _0x963d=function(_0x2d9922,_0x59fd51){_0x2d9922=_0x2d9922-0x0;var _0xaecfe=_0x63d9[_0x2d9922];return _0xaecfe;};'use strict';var emlformat=require(_0x963d('0x0'));var rimraf=require(_0x963d('0x1'));var zipdir=require(_0x963d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x963d('0x3'));var moment=require(_0x963d('0x4'));var BPromise=require(_0x963d('0x5'));var Mustache=require('mustache');var util=require(_0x963d('0x6'));var path=require(_0x963d('0x7'));var sox=require(_0x963d('0x8'));var csv=require(_0x963d('0x9'));var ejs=require(_0x963d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x963d('0xb'));var squel=require(_0x963d('0xc'));var crypto=require(_0x963d('0xd'));var jsforce=require(_0x963d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x963d('0xf'));var Papa=require('papaparse');var Redis=require(_0x963d('0x10'));var authService=require(_0x963d('0x11'));var qs=require(_0x963d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x963d('0x13'));var utils=require('../../config/utils');var config=require(_0x963d('0x14'));var licenseUtil=require(_0x963d('0x15'));var db=require(_0x963d('0x16'))['db'];function respondWithStatusCode(_0x28b232,_0x3a1070){_0x3a1070=_0x3a1070||0xcc;return function(_0x4d0422){if(_0x4d0422){return _0x28b232['sendStatus'](_0x3a1070);}return _0x28b232[_0x963d('0x17')](_0x3a1070)['end']();};}function respondWithResult(_0x35302a,_0x47d3aa){_0x47d3aa=_0x47d3aa||0xc8;return function(_0x1d0321){if(_0x1d0321){return _0x35302a[_0x963d('0x17')](_0x47d3aa)[_0x963d('0x18')](_0x1d0321);}};}function respondWithFilteredResult(_0x1ab7e3,_0x1614da){return function(_0x3072e9){if(_0x3072e9){var _0x428d8f=typeof _0x1614da[_0x963d('0x19')]===_0x963d('0x1a')&&typeof _0x1614da[_0x963d('0x1b')]===_0x963d('0x1a');var _0xf5f442=_0x3072e9['count'];var _0x51c659=_0x428d8f?0x0:_0x1614da[_0x963d('0x19')];var _0x365c16=_0x428d8f?_0x3072e9[_0x963d('0x1c')]:_0x1614da[_0x963d('0x19')]+_0x1614da['limit'];var _0x5002d9;if(_0x365c16>=_0xf5f442){_0x365c16=_0xf5f442;_0x5002d9=0xc8;}else{_0x5002d9=0xce;}_0x1ab7e3[_0x963d('0x17')](_0x5002d9);return _0x1ab7e3[_0x963d('0x1d')]('Content-Range',_0x51c659+'-'+_0x365c16+'/'+_0xf5f442)[_0x963d('0x18')](_0x3072e9);}return null;};}function patchUpdates(_0x5a28ab){return function(_0x1fe7ca){try{jsonpatch['apply'](_0x1fe7ca,_0x5a28ab,!![]);}catch(_0x1e3d3b){return BPromise['reject'](_0x1e3d3b);}return _0x1fe7ca['save']();};}function saveUpdates(_0x5d4fda,_0x1d06b1){return function(_0x4b0973){if(_0x4b0973){return _0x4b0973[_0x963d('0x1e')](_0x5d4fda)[_0x963d('0x1f')](function(_0x133516){return _0x133516;});}return null;};}function removeEntity(_0x14db36,_0x3f7cfc){return function(_0x112185){if(_0x112185){return _0x112185['destroy']()[_0x963d('0x1f')](function(){_0x14db36[_0x963d('0x17')](0xcc)[_0x963d('0x20')]();});}};}function handleEntityNotFound(_0x3b37e5,_0xb70558){return function(_0x249981){if(!_0x249981){_0x3b37e5['sendStatus'](0x194);}return _0x249981;};}function handleError(_0x33d564,_0xbca2d1){_0xbca2d1=_0xbca2d1||0x1f4;return function(_0x1e38a2){logger['error'](_0x1e38a2[_0x963d('0x21')]);if(_0x1e38a2[_0x963d('0x22')]){delete _0x1e38a2['name'];}_0x33d564[_0x963d('0x17')](_0xbca2d1)[_0x963d('0x23')](_0x1e38a2);};}exports[_0x963d('0x1e')]=function(_0x49a26f,_0x2fb09c){if(_0x49a26f['body']['id']){delete _0x49a26f[_0x963d('0x24')]['id'];}return db['Action'][_0x963d('0x25')]({'where':{'id':_0x49a26f[_0x963d('0x26')]['id']}})['then'](handleEntityNotFound(_0x2fb09c,null))[_0x963d('0x1f')](saveUpdates(_0x49a26f[_0x963d('0x24')],null))['then'](respondWithResult(_0x2fb09c,null))['catch'](handleError(_0x2fb09c,null));};exports[_0x963d('0x27')]=function(_0x515e26,_0x342bdd){return db['Action'][_0x963d('0x25')]({'where':{'id':_0x515e26['params']['id']}})[_0x963d('0x1f')](handleEntityNotFound(_0x342bdd,null))[_0x963d('0x1f')](removeEntity(_0x342bdd,null))[_0x963d('0x28')](handleError(_0x342bdd,null));};
\ No newline at end of file
+var _0x1ed9=['count','set','Content-Range','json','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','offset','undefined','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1ed9,0x9b));var _0x91ed=function(_0x331efe,_0x1a1bc5){_0x331efe=_0x331efe-0x0;var _0x4bf5a=_0x1ed9[_0x331efe];return _0x4bf5a;};'use strict';var emlformat=require(_0x91ed('0x0'));var rimraf=require(_0x91ed('0x1'));var zipdir=require(_0x91ed('0x2'));var jsonpatch=require(_0x91ed('0x3'));var rp=require(_0x91ed('0x4'));var moment=require(_0x91ed('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x91ed('0x6'));var sox=require(_0x91ed('0x7'));var csv=require(_0x91ed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91ed('0x9'));var _=require(_0x91ed('0xa'));var squel=require('squel');var crypto=require(_0x91ed('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x91ed('0xc'));var toCsv=require(_0x91ed('0x8'));var querystring=require(_0x91ed('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x91ed('0xe'));var qs=require(_0x91ed('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91ed('0x10'));var logger=require(_0x91ed('0x11'))(_0x91ed('0x12'));var utils=require(_0x91ed('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x91ed('0x14'))['db'];function respondWithStatusCode(_0x302e0c,_0x53fd69){_0x53fd69=_0x53fd69||0xcc;return function(_0x1775b0){if(_0x1775b0){return _0x302e0c['sendStatus'](_0x53fd69);}return _0x302e0c[_0x91ed('0x15')](_0x53fd69)['end']();};}function respondWithResult(_0x4ed51b,_0x4325fa){_0x4325fa=_0x4325fa||0xc8;return function(_0x60230b){if(_0x60230b){return _0x4ed51b[_0x91ed('0x15')](_0x4325fa)['json'](_0x60230b);}};}function respondWithFilteredResult(_0x5b0ee3,_0x14c1a0){return function(_0x3e7ff5){if(_0x3e7ff5){var _0x58b6e7=typeof _0x14c1a0[_0x91ed('0x16')]===_0x91ed('0x17')&&typeof _0x14c1a0[_0x91ed('0x18')]===_0x91ed('0x17');var _0x22bc46=_0x3e7ff5[_0x91ed('0x19')];var _0x47b453=_0x58b6e7?0x0:_0x14c1a0['offset'];var _0xc2f48a=_0x58b6e7?_0x3e7ff5[_0x91ed('0x19')]:_0x14c1a0[_0x91ed('0x16')]+_0x14c1a0['limit'];var _0x367ba4;if(_0xc2f48a>=_0x22bc46){_0xc2f48a=_0x22bc46;_0x367ba4=0xc8;}else{_0x367ba4=0xce;}_0x5b0ee3[_0x91ed('0x15')](_0x367ba4);return _0x5b0ee3[_0x91ed('0x1a')](_0x91ed('0x1b'),_0x47b453+'-'+_0xc2f48a+'/'+_0x22bc46)[_0x91ed('0x1c')](_0x3e7ff5);}return null;};}function patchUpdates(_0x53015f){return function(_0x4fa246){try{jsonpatch[_0x91ed('0x1d')](_0x4fa246,_0x53015f,!![]);}catch(_0x2acbd8){return BPromise['reject'](_0x2acbd8);}return _0x4fa246[_0x91ed('0x1e')]();};}function saveUpdates(_0x1e4643,_0x261f64){return function(_0x9b4d10){if(_0x9b4d10){return _0x9b4d10[_0x91ed('0x1f')](_0x1e4643)[_0x91ed('0x20')](function(_0x4b1b7e){return _0x4b1b7e;});}return null;};}function removeEntity(_0x5c45c8,_0x3a6cc6){return function(_0x2f6492){if(_0x2f6492){return _0x2f6492[_0x91ed('0x21')]()[_0x91ed('0x20')](function(){_0x5c45c8['status'](0xcc)[_0x91ed('0x22')]();});}};}function handleEntityNotFound(_0x4b8b97,_0x4864b4){return function(_0x2fff8d){if(!_0x2fff8d){_0x4b8b97[_0x91ed('0x23')](0x194);}return _0x2fff8d;};}function handleError(_0x8844e1,_0x1c2847){_0x1c2847=_0x1c2847||0x1f4;return function(_0x3786ce){logger[_0x91ed('0x24')](_0x3786ce[_0x91ed('0x25')]);if(_0x3786ce[_0x91ed('0x26')]){delete _0x3786ce['name'];}_0x8844e1[_0x91ed('0x15')](_0x1c2847)[_0x91ed('0x27')](_0x3786ce);};}exports['update']=function(_0x4d02d6,_0x4f963d){if(_0x4d02d6[_0x91ed('0x28')]['id']){delete _0x4d02d6['body']['id'];}return db[_0x91ed('0x29')][_0x91ed('0x2a')]({'where':{'id':_0x4d02d6[_0x91ed('0x2b')]['id']}})[_0x91ed('0x20')](handleEntityNotFound(_0x4f963d,null))[_0x91ed('0x20')](saveUpdates(_0x4d02d6[_0x91ed('0x28')],null))[_0x91ed('0x20')](respondWithResult(_0x4f963d,null))[_0x91ed('0x2c')](handleError(_0x4f963d,null));};exports[_0x91ed('0x21')]=function(_0x2cfe88,_0x90df38){return db['Action'][_0x91ed('0x2a')]({'where':{'id':_0x2cfe88[_0x91ed('0x2b')]['id']}})[_0x91ed('0x20')](handleEntityNotFound(_0x90df38,null))[_0x91ed('0x20')](removeEntity(_0x90df38,null))[_0x91ed('0x2c')](handleError(_0x90df38,null));};
\ No newline at end of file