Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / action / action.controller.js
index b2e3d1a..0022507 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f68=['sox','to-csv','ejs','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','end','stack','name','send','update','body','find','params','catch','Action','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util'];(function(_0x145bfe,_0xcfba1){var _0x2c03ca=function(_0x2b5f4c){while(--_0x2b5f4c){_0x145bfe['push'](_0x145bfe['shift']());}};_0x2c03ca(++_0xcfba1);}(_0x5f68,0x189));var _0x85f6=function(_0x422db0,_0x33be5b){_0x422db0=_0x422db0-0x0;var _0x355e09=_0x5f68[_0x422db0];return _0x355e09;};'use strict';var pdf=require(_0x85f6('0x0'));var emlformat=require(_0x85f6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x85f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85f6('0x3'));var moment=require('moment');var BPromise=require(_0x85f6('0x4'));var Mustache=require(_0x85f6('0x5'));var util=require(_0x85f6('0x6'));var path=require('path');var sox=require(_0x85f6('0x7'));var csv=require(_0x85f6('0x8'));var ejs=require(_0x85f6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x85f6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x85f6('0x8'));var querystring=require(_0x85f6('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x85f6('0xc'));var as=require(_0x85f6('0xd'));var hardwareService=require(_0x85f6('0xe'));var logger=require('../../config/logger')(_0x85f6('0xf'));var utils=require(_0x85f6('0x10'));var config=require(_0x85f6('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d743f,_0xbdf8cb){_0xbdf8cb=_0xbdf8cb||0xcc;return function(_0x146c39){if(_0x146c39){return _0x1d743f[_0x85f6('0x12')](_0xbdf8cb);}return _0x1d743f[_0x85f6('0x13')](_0xbdf8cb)['end']();};}function respondWithResult(_0x2b66c2,_0x58e8bb){_0x58e8bb=_0x58e8bb||0xc8;return function(_0x4a0fbd){if(_0x4a0fbd){return _0x2b66c2[_0x85f6('0x13')](_0x58e8bb)[_0x85f6('0x14')](_0x4a0fbd);}};}function respondWithFilteredResult(_0x56c3b1,_0x3c3945){return function(_0x2b4d29){if(_0x2b4d29){var _0x59068d=_0x2b4d29[_0x85f6('0x15')],_0x4e3f0c=_0x3c3945[_0x85f6('0x16')],_0x5a041e=_0x3c3945['offset']+_0x3c3945[_0x85f6('0x17')],_0x1639e6;if(_0x5a041e>=_0x59068d){_0x5a041e=_0x59068d;_0x1639e6=0xc8;}else{_0x1639e6=0xce;}_0x56c3b1[_0x85f6('0x13')](_0x1639e6);return _0x56c3b1[_0x85f6('0x18')](_0x85f6('0x19'),_0x4e3f0c+'-'+_0x5a041e+'/'+_0x59068d)[_0x85f6('0x14')](_0x2b4d29);}return null;};}function patchUpdates(_0x5eb057){return function(_0x5c1c7a){try{jsonpatch[_0x85f6('0x1a')](_0x5c1c7a,_0x5eb057,!![]);}catch(_0x1e1d3c){return BPromise[_0x85f6('0x1b')](_0x1e1d3c);}return _0x5c1c7a['save']();};}function saveUpdates(_0x58abde,_0x3cb6b9){return function(_0x8fe98d){if(_0x8fe98d){return _0x8fe98d['update'](_0x58abde)['then'](function(_0x5b28d8){return _0x5b28d8;});}return null;};}function removeEntity(_0x4a917d,_0x356b73){return function(_0x21f616){if(_0x21f616){return _0x21f616[_0x85f6('0x1c')]()[_0x85f6('0x1d')](function(){_0x4a917d[_0x85f6('0x13')](0xcc)[_0x85f6('0x1e')]();});}};}function handleEntityNotFound(_0x1fb5fb,_0x2dd816){return function(_0x50f87f){if(!_0x50f87f){_0x1fb5fb[_0x85f6('0x12')](0x194);}return _0x50f87f;};}function handleError(_0x199407,_0x5a1bf8){_0x5a1bf8=_0x5a1bf8||0x1f4;return function(_0x481ad0){logger['error'](_0x481ad0[_0x85f6('0x1f')]);if(_0x481ad0[_0x85f6('0x20')]){delete _0x481ad0[_0x85f6('0x20')];}_0x199407[_0x85f6('0x13')](_0x5a1bf8)[_0x85f6('0x21')](_0x481ad0);};}exports[_0x85f6('0x22')]=function(_0x50471f,_0x2bf0d7){if(_0x50471f[_0x85f6('0x23')]['id']){delete _0x50471f[_0x85f6('0x23')]['id'];}return db['Action'][_0x85f6('0x24')]({'where':{'id':_0x50471f[_0x85f6('0x25')]['id']}})[_0x85f6('0x1d')](handleEntityNotFound(_0x2bf0d7,null))[_0x85f6('0x1d')](saveUpdates(_0x50471f[_0x85f6('0x23')],null))[_0x85f6('0x1d')](respondWithResult(_0x2bf0d7,null))[_0x85f6('0x26')](handleError(_0x2bf0d7,null));};exports[_0x85f6('0x1c')]=function(_0x95f606,_0x5cecb4){return db[_0x85f6('0x27')][_0x85f6('0x24')]({'where':{'id':_0x95f606[_0x85f6('0x25')]['id']}})[_0x85f6('0x1d')](handleEntityNotFound(_0x5cecb4,null))[_0x85f6('0x1d')](removeEntity(_0x5cecb4,null))[_0x85f6('0x26')](handleError(_0x5cecb4,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