Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / action / action.controller.js
index 1184513..09aca17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3848=['body','find','destroy','Action','catch','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','status','sendStatus','error','stack','name','send'];(function(_0xc95fe9,_0x36bcb1){var _0x3761dd=function(_0x574a8c){while(--_0x574a8c){_0xc95fe9['push'](_0xc95fe9['shift']());}};_0x3761dd(++_0x36bcb1);}(_0x3848,0x107));var _0x8384=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x3848[_0x45b1ba];return _0x145ddb;};'use strict';var emlformat=require(_0x8384('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8384('0x1'));var moment=require(_0x8384('0x2'));var BPromise=require(_0x8384('0x3'));var Mustache=require(_0x8384('0x4'));var util=require(_0x8384('0x5'));var path=require(_0x8384('0x6'));var sox=require(_0x8384('0x7'));var csv=require(_0x8384('0x8'));var ejs=require(_0x8384('0x9'));var fs=require('fs');var fs_extra=require(_0x8384('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8384('0xb'));var jsforce=require(_0x8384('0xc'));var deskjs=require(_0x8384('0xd'));var toCsv=require(_0x8384('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8384('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8384('0xf'));var as=require(_0x8384('0x10'));var hardwareService=require(_0x8384('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8384('0x12'));var licenseUtil=require(_0x8384('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cb052,_0x5e44f4){_0x5e44f4=_0x5e44f4||0xcc;return function(_0x8fdc6c){if(_0x8fdc6c){return _0x4cb052['sendStatus'](_0x5e44f4);}return _0x4cb052['status'](_0x5e44f4)[_0x8384('0x14')]();};}function respondWithResult(_0x4e3a9c,_0x234664){_0x234664=_0x234664||0xc8;return function(_0x1cb854){if(_0x1cb854){return _0x4e3a9c['status'](_0x234664)[_0x8384('0x15')](_0x1cb854);}};}function respondWithFilteredResult(_0x2de13a,_0x7822b1){return function(_0x1ac7b3){if(_0x1ac7b3){var _0x23cf88=typeof _0x7822b1[_0x8384('0x16')]==='undefined'&&typeof _0x7822b1['limit']==='undefined';var _0x57aa11=_0x1ac7b3[_0x8384('0x17')];var _0x558e9d=_0x23cf88?0x0:_0x7822b1['offset'];var _0x561e63=_0x23cf88?_0x1ac7b3['count']:_0x7822b1[_0x8384('0x16')]+_0x7822b1[_0x8384('0x18')];var _0x526177;if(_0x561e63>=_0x57aa11){_0x561e63=_0x57aa11;_0x526177=0xc8;}else{_0x526177=0xce;}_0x2de13a['status'](_0x526177);return _0x2de13a[_0x8384('0x19')](_0x8384('0x1a'),_0x558e9d+'-'+_0x561e63+'/'+_0x57aa11)[_0x8384('0x15')](_0x1ac7b3);}return null;};}function patchUpdates(_0x4e6b4d){return function(_0x2ba538){try{jsonpatch[_0x8384('0x1b')](_0x2ba538,_0x4e6b4d,!![]);}catch(_0x5e4e40){return BPromise[_0x8384('0x1c')](_0x5e4e40);}return _0x2ba538[_0x8384('0x1d')]();};}function saveUpdates(_0x51330f,_0x307a2a){return function(_0x4d7c16){if(_0x4d7c16){return _0x4d7c16[_0x8384('0x1e')](_0x51330f)['then'](function(_0x52aa9a){return _0x52aa9a;});}return null;};}function removeEntity(_0x40feaa,_0xe132e9){return function(_0x3dcdfa){if(_0x3dcdfa){return _0x3dcdfa['destroy']()[_0x8384('0x1f')](function(){_0x40feaa[_0x8384('0x20')](0xcc)[_0x8384('0x14')]();});}};}function handleEntityNotFound(_0x519a44,_0x24c72f){return function(_0x419d84){if(!_0x419d84){_0x519a44[_0x8384('0x21')](0x194);}return _0x419d84;};}function handleError(_0x3a1367,_0x59a754){_0x59a754=_0x59a754||0x1f4;return function(_0x3a10be){logger[_0x8384('0x22')](_0x3a10be[_0x8384('0x23')]);if(_0x3a10be[_0x8384('0x24')]){delete _0x3a10be[_0x8384('0x24')];}_0x3a1367[_0x8384('0x20')](_0x59a754)[_0x8384('0x25')](_0x3a10be);};}exports['update']=function(_0x52fb5f,_0x12ef93){if(_0x52fb5f[_0x8384('0x26')]['id']){delete _0x52fb5f[_0x8384('0x26')]['id'];}return db['Action'][_0x8384('0x27')]({'where':{'id':_0x52fb5f['params']['id']}})[_0x8384('0x1f')](handleEntityNotFound(_0x12ef93,null))[_0x8384('0x1f')](saveUpdates(_0x52fb5f[_0x8384('0x26')],null))['then'](respondWithResult(_0x12ef93,null))['catch'](handleError(_0x12ef93,null));};exports[_0x8384('0x28')]=function(_0x1ae6e0,_0x5d63b0){return db[_0x8384('0x29')][_0x8384('0x27')]({'where':{'id':_0x1ae6e0['params']['id']}})['then'](handleEntityNotFound(_0x5d63b0,null))[_0x8384('0x1f')](removeEntity(_0x5d63b0,null))[_0x8384('0x2a')](handleError(_0x5d63b0,null));};
\ No newline at end of file
+var _0x3f97=['send','body','params','destroy','Action','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','then','error','stack','name'];(function(_0x503e78,_0x411076){var _0x591b4a=function(_0x1dc3dc){while(--_0x1dc3dc){_0x503e78['push'](_0x503e78['shift']());}};_0x591b4a(++_0x411076);}(_0x3f97,0x1f1));var _0x73f9=function(_0x1b0875,_0x2c460f){_0x1b0875=_0x1b0875-0x0;var _0x5e6a1e=_0x3f97[_0x1b0875];return _0x5e6a1e;};'use strict';var emlformat=require(_0x73f9('0x0'));var rimraf=require(_0x73f9('0x1'));var zipdir=require(_0x73f9('0x2'));var jsonpatch=require(_0x73f9('0x3'));var rp=require(_0x73f9('0x4'));var moment=require(_0x73f9('0x5'));var BPromise=require(_0x73f9('0x6'));var Mustache=require(_0x73f9('0x7'));var util=require('util');var path=require(_0x73f9('0x8'));var sox=require(_0x73f9('0x9'));var csv=require(_0x73f9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73f9('0xb'));var _=require(_0x73f9('0xc'));var squel=require(_0x73f9('0xd'));var crypto=require(_0x73f9('0xe'));var jsforce=require(_0x73f9('0xf'));var deskjs=require(_0x73f9('0x10'));var toCsv=require(_0x73f9('0xa'));var querystring=require('querystring');var Papa=require(_0x73f9('0x11'));var Redis=require(_0x73f9('0x12'));var authService=require(_0x73f9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x73f9('0x14'));var hardwareService=require(_0x73f9('0x15'));var logger=require(_0x73f9('0x16'))(_0x73f9('0x17'));var utils=require(_0x73f9('0x18'));var config=require(_0x73f9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x73f9('0x1a'))['db'];function respondWithStatusCode(_0x2e153e,_0x4c983e){_0x4c983e=_0x4c983e||0xcc;return function(_0xc09ca8){if(_0xc09ca8){return _0x2e153e[_0x73f9('0x1b')](_0x4c983e);}return _0x2e153e[_0x73f9('0x1c')](_0x4c983e)[_0x73f9('0x1d')]();};}function respondWithResult(_0x5b975e,_0x30ec24){_0x30ec24=_0x30ec24||0xc8;return function(_0x13dc6c){if(_0x13dc6c){return _0x5b975e[_0x73f9('0x1c')](_0x30ec24)[_0x73f9('0x1e')](_0x13dc6c);}};}function respondWithFilteredResult(_0x436236,_0x56b498){return function(_0x868cd1){if(_0x868cd1){var _0x345214=typeof _0x56b498[_0x73f9('0x1f')]===_0x73f9('0x20')&&typeof _0x56b498[_0x73f9('0x21')]===_0x73f9('0x20');var _0x34fb96=_0x868cd1['count'];var _0x3497cc=_0x345214?0x0:_0x56b498[_0x73f9('0x1f')];var _0x3872cf=_0x345214?_0x868cd1['count']:_0x56b498['offset']+_0x56b498[_0x73f9('0x21')];var _0x2e8943;if(_0x3872cf>=_0x34fb96){_0x3872cf=_0x34fb96;_0x2e8943=0xc8;}else{_0x2e8943=0xce;}_0x436236[_0x73f9('0x1c')](_0x2e8943);return _0x436236['set'](_0x73f9('0x22'),_0x3497cc+'-'+_0x3872cf+'/'+_0x34fb96)['json'](_0x868cd1);}return null;};}function patchUpdates(_0x29442f){return function(_0x597c18){try{jsonpatch['apply'](_0x597c18,_0x29442f,!![]);}catch(_0x18a762){return BPromise[_0x73f9('0x23')](_0x18a762);}return _0x597c18[_0x73f9('0x24')]();};}function saveUpdates(_0x500a22,_0x31e03e){return function(_0x1c6d30){if(_0x1c6d30){return _0x1c6d30[_0x73f9('0x25')](_0x500a22)[_0x73f9('0x26')](function(_0x13bdc9){return _0x13bdc9;});}return null;};}function removeEntity(_0x39cc88,_0x1999ed){return function(_0x281c54){if(_0x281c54){return _0x281c54['destroy']()['then'](function(){_0x39cc88[_0x73f9('0x1c')](0xcc)[_0x73f9('0x1d')]();});}};}function handleEntityNotFound(_0x2ceddc,_0x1cb64f){return function(_0xce79b1){if(!_0xce79b1){_0x2ceddc[_0x73f9('0x1b')](0x194);}return _0xce79b1;};}function handleError(_0x13f1fe,_0x4f9d73){_0x4f9d73=_0x4f9d73||0x1f4;return function(_0x555d98){logger[_0x73f9('0x27')](_0x555d98[_0x73f9('0x28')]);if(_0x555d98[_0x73f9('0x29')]){delete _0x555d98['name'];}_0x13f1fe[_0x73f9('0x1c')](_0x4f9d73)[_0x73f9('0x2a')](_0x555d98);};}exports['update']=function(_0x3be7fb,_0x2d8cda){if(_0x3be7fb[_0x73f9('0x2b')]['id']){delete _0x3be7fb[_0x73f9('0x2b')]['id'];}return db['Action']['find']({'where':{'id':_0x3be7fb[_0x73f9('0x2c')]['id']}})[_0x73f9('0x26')](handleEntityNotFound(_0x2d8cda,null))[_0x73f9('0x26')](saveUpdates(_0x3be7fb[_0x73f9('0x2b')],null))[_0x73f9('0x26')](respondWithResult(_0x2d8cda,null))['catch'](handleError(_0x2d8cda,null));};exports[_0x73f9('0x2d')]=function(_0x267842,_0x574337){return db[_0x73f9('0x2e')][_0x73f9('0x2f')]({'where':{'id':_0x267842[_0x73f9('0x2c')]['id']}})[_0x73f9('0x26')](handleEntityNotFound(_0x574337,null))['then'](removeEntity(_0x574337,null))[_0x73f9('0x30')](handleError(_0x574337,null));};
\ No newline at end of file