Built motion from commit 06a208af.|2.6.26
[motion2.git] / server / api / action / action.controller.js
index 50421a9..8d078cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bff=['set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x39283e,_0x81a14d){var _0x5f2a54=function(_0xf9d19b){while(--_0xf9d19b){_0x39283e['push'](_0x39283e['shift']());}};_0x5f2a54(++_0x81a14d);}(_0x2bff,0x100));var _0xf2bf=function(_0x4cb51f,_0x30fd19){_0x4cb51f=_0x4cb51f-0x0;var _0x2a9e7c=_0x2bff[_0x4cb51f];return _0x2a9e7c;};'use strict';var emlformat=require(_0xf2bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2bf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2bf('0x2'));var moment=require(_0xf2bf('0x3'));var BPromise=require(_0xf2bf('0x4'));var Mustache=require('mustache');var util=require(_0xf2bf('0x5'));var path=require(_0xf2bf('0x6'));var sox=require(_0xf2bf('0x7'));var csv=require(_0xf2bf('0x8'));var ejs=require(_0xf2bf('0x9'));var fs=require('fs');var fs_extra=require(_0xf2bf('0xa'));var _=require(_0xf2bf('0xb'));var squel=require(_0xf2bf('0xc'));var crypto=require(_0xf2bf('0xd'));var jsforce=require(_0xf2bf('0xe'));var deskjs=require(_0xf2bf('0xf'));var toCsv=require(_0xf2bf('0x8'));var querystring=require(_0xf2bf('0x10'));var Papa=require(_0xf2bf('0x11'));var Redis=require(_0xf2bf('0x12'));var authService=require(_0xf2bf('0x13'));var qs=require(_0xf2bf('0x14'));var as=require(_0xf2bf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2bf('0x16'))(_0xf2bf('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf2bf('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122e0c,_0x560b6c){_0x560b6c=_0x560b6c||0xcc;return function(_0x52cfc7){if(_0x52cfc7){return _0x122e0c[_0xf2bf('0x19')](_0x560b6c);}return _0x122e0c[_0xf2bf('0x1a')](_0x560b6c)[_0xf2bf('0x1b')]();};}function respondWithResult(_0x57917c,_0x56b209){_0x56b209=_0x56b209||0xc8;return function(_0x5d055c){if(_0x5d055c){return _0x57917c[_0xf2bf('0x1a')](_0x56b209)['json'](_0x5d055c);}};}function respondWithFilteredResult(_0x24f1b7,_0xf23c2c){return function(_0x23396d){if(_0x23396d){var _0x389774=typeof _0xf23c2c[_0xf2bf('0x1c')]===_0xf2bf('0x1d')&&typeof _0xf23c2c['limit']==='undefined';var _0x1c0798=_0x23396d['count'];var _0x1104e1=_0x389774?0x0:_0xf23c2c[_0xf2bf('0x1c')];var _0x263a31=_0x389774?_0x23396d[_0xf2bf('0x1e')]:_0xf23c2c['offset']+_0xf23c2c[_0xf2bf('0x1f')];var _0x3aa631;if(_0x263a31>=_0x1c0798){_0x263a31=_0x1c0798;_0x3aa631=0xc8;}else{_0x3aa631=0xce;}_0x24f1b7['status'](_0x3aa631);return _0x24f1b7[_0xf2bf('0x20')](_0xf2bf('0x21'),_0x1104e1+'-'+_0x263a31+'/'+_0x1c0798)[_0xf2bf('0x22')](_0x23396d);}return null;};}function patchUpdates(_0x458099){return function(_0x497438){try{jsonpatch[_0xf2bf('0x23')](_0x497438,_0x458099,!![]);}catch(_0x3b4c51){return BPromise['reject'](_0x3b4c51);}return _0x497438['save']();};}function saveUpdates(_0x55b4e3,_0xaaf6c7){return function(_0x555664){if(_0x555664){return _0x555664[_0xf2bf('0x24')](_0x55b4e3)[_0xf2bf('0x25')](function(_0xfcaf47){return _0xfcaf47;});}return null;};}function removeEntity(_0x25ecab,_0x3c7943){return function(_0x393639){if(_0x393639){return _0x393639[_0xf2bf('0x26')]()[_0xf2bf('0x25')](function(){_0x25ecab[_0xf2bf('0x1a')](0xcc)[_0xf2bf('0x1b')]();});}};}function handleEntityNotFound(_0x2fea14,_0x26d04d){return function(_0x251d7c){if(!_0x251d7c){_0x2fea14[_0xf2bf('0x19')](0x194);}return _0x251d7c;};}function handleError(_0xdc1e90,_0x4d7639){_0x4d7639=_0x4d7639||0x1f4;return function(_0x5377e3){logger[_0xf2bf('0x27')](_0x5377e3[_0xf2bf('0x28')]);if(_0x5377e3[_0xf2bf('0x29')]){delete _0x5377e3[_0xf2bf('0x29')];}_0xdc1e90['status'](_0x4d7639)[_0xf2bf('0x2a')](_0x5377e3);};}exports['update']=function(_0x51579b,_0x2a65b9){if(_0x51579b[_0xf2bf('0x2b')]['id']){delete _0x51579b[_0xf2bf('0x2b')]['id'];}return db[_0xf2bf('0x2c')][_0xf2bf('0x2d')]({'where':{'id':_0x51579b[_0xf2bf('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2a65b9,null))['then'](saveUpdates(_0x51579b[_0xf2bf('0x2b')],null))[_0xf2bf('0x25')](respondWithResult(_0x2a65b9,null))[_0xf2bf('0x2f')](handleError(_0x2a65b9,null));};exports[_0xf2bf('0x26')]=function(_0x5762f3,_0x44f860){return db['Action']['find']({'where':{'id':_0x5762f3[_0xf2bf('0x2e')]['id']}})[_0xf2bf('0x25')](handleEntityNotFound(_0x44f860,null))[_0xf2bf('0x25')](removeEntity(_0x44f860,null))[_0xf2bf('0x2f')](handleError(_0x44f860,null));};
\ No newline at end of file
+var _0x17ae=['destroy','stack','name','send','find','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','limit','status','set','Content-Range','apply','save','update','then'];(function(_0x234a15,_0x2758ce){var _0x39dcad=function(_0x2cdbcb){while(--_0x2cdbcb){_0x234a15['push'](_0x234a15['shift']());}};_0x39dcad(++_0x2758ce);}(_0x17ae,0x1ca));var _0xe17a=function(_0x1709a3,_0x2de081){_0x1709a3=_0x1709a3-0x0;var _0x1c141d=_0x17ae[_0x1709a3];return _0x1c141d;};'use strict';var emlformat=require(_0xe17a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe17a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe17a('0x2'));var moment=require(_0xe17a('0x3'));var BPromise=require(_0xe17a('0x4'));var Mustache=require(_0xe17a('0x5'));var util=require('util');var path=require(_0xe17a('0x6'));var sox=require(_0xe17a('0x7'));var csv=require(_0xe17a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe17a('0x9'));var _=require(_0xe17a('0xa'));var squel=require(_0xe17a('0xb'));var crypto=require(_0xe17a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe17a('0xd'));var toCsv=require(_0xe17a('0x8'));var querystring=require(_0xe17a('0xe'));var Papa=require(_0xe17a('0xf'));var Redis=require('ioredis');var authService=require(_0xe17a('0x10'));var qs=require(_0xe17a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe17a('0x12'));var config=require(_0xe17a('0x13'));var licenseUtil=require(_0xe17a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d12f2,_0x2af7ef){_0x2af7ef=_0x2af7ef||0xcc;return function(_0x39d668){if(_0x39d668){return _0x5d12f2[_0xe17a('0x15')](_0x2af7ef);}return _0x5d12f2['status'](_0x2af7ef)[_0xe17a('0x16')]();};}function respondWithResult(_0x4c8122,_0x3869a3){_0x3869a3=_0x3869a3||0xc8;return function(_0x23fba3){if(_0x23fba3){return _0x4c8122['status'](_0x3869a3)[_0xe17a('0x17')](_0x23fba3);}};}function respondWithFilteredResult(_0x1cd455,_0x4627fe){return function(_0x3d873f){if(_0x3d873f){var _0x456632=typeof _0x4627fe['offset']===_0xe17a('0x18')&&typeof _0x4627fe['limit']===_0xe17a('0x18');var _0x598bd6=_0x3d873f['count'];var _0x2ca913=_0x456632?0x0:_0x4627fe['offset'];var _0x2b3efc=_0x456632?_0x3d873f[_0xe17a('0x19')]:_0x4627fe['offset']+_0x4627fe[_0xe17a('0x1a')];var _0x3041f0;if(_0x2b3efc>=_0x598bd6){_0x2b3efc=_0x598bd6;_0x3041f0=0xc8;}else{_0x3041f0=0xce;}_0x1cd455[_0xe17a('0x1b')](_0x3041f0);return _0x1cd455[_0xe17a('0x1c')](_0xe17a('0x1d'),_0x2ca913+'-'+_0x2b3efc+'/'+_0x598bd6)[_0xe17a('0x17')](_0x3d873f);}return null;};}function patchUpdates(_0x2a30ed){return function(_0xed12e3){try{jsonpatch[_0xe17a('0x1e')](_0xed12e3,_0x2a30ed,!![]);}catch(_0x2704ec){return BPromise['reject'](_0x2704ec);}return _0xed12e3[_0xe17a('0x1f')]();};}function saveUpdates(_0x52fc8e,_0x5a4052){return function(_0x23711c){if(_0x23711c){return _0x23711c[_0xe17a('0x20')](_0x52fc8e)[_0xe17a('0x21')](function(_0x3e48de){return _0x3e48de;});}return null;};}function removeEntity(_0x2b0f2d,_0x397340){return function(_0x1e7db0){if(_0x1e7db0){return _0x1e7db0[_0xe17a('0x22')]()[_0xe17a('0x21')](function(){_0x2b0f2d[_0xe17a('0x1b')](0xcc)[_0xe17a('0x16')]();});}};}function handleEntityNotFound(_0x39e5fa,_0x418c30){return function(_0x41a179){if(!_0x41a179){_0x39e5fa[_0xe17a('0x15')](0x194);}return _0x41a179;};}function handleError(_0x4cfeeb,_0x1019f5){_0x1019f5=_0x1019f5||0x1f4;return function(_0x81e6c){logger['error'](_0x81e6c[_0xe17a('0x23')]);if(_0x81e6c['name']){delete _0x81e6c[_0xe17a('0x24')];}_0x4cfeeb[_0xe17a('0x1b')](_0x1019f5)[_0xe17a('0x25')](_0x81e6c);};}exports[_0xe17a('0x20')]=function(_0x420b94,_0x49a4b1){if(_0x420b94['body']['id']){delete _0x420b94['body']['id'];}return db['Action'][_0xe17a('0x26')]({'where':{'id':_0x420b94['params']['id']}})[_0xe17a('0x21')](handleEntityNotFound(_0x49a4b1,null))[_0xe17a('0x21')](saveUpdates(_0x420b94[_0xe17a('0x27')],null))[_0xe17a('0x21')](respondWithResult(_0x49a4b1,null))[_0xe17a('0x28')](handleError(_0x49a4b1,null));};exports[_0xe17a('0x22')]=function(_0x1bcfd3,_0x29b52e){return db['Action'][_0xe17a('0x26')]({'where':{'id':_0x1bcfd3['params']['id']}})[_0xe17a('0x21')](handleEntityNotFound(_0x29b52e,null))[_0xe17a('0x21')](removeEntity(_0x29b52e,null))[_0xe17a('0x28')](handleError(_0x29b52e,null));};
\ No newline at end of file