Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / action / action.controller.js
index f4ab8fb..09aca17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06ae=['limit','set','apply','reject','update','then','destroy','sendStatus','error','name','send','body','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe06a('0x0'));var rimraf=require(_0xe06a('0x1'));var zipdir=require(_0xe06a('0x2'));var jsonpatch=require(_0xe06a('0x3'));var rp=require(_0xe06a('0x4'));var moment=require(_0xe06a('0x5'));var BPromise=require(_0xe06a('0x6'));var Mustache=require(_0xe06a('0x7'));var util=require(_0xe06a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe06a('0x9'));var fs=require('fs');var _=require(_0xe06a('0xa'));var squel=require(_0xe06a('0xb'));var crypto=require(_0xe06a('0xc'));var jsforce=require(_0xe06a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe06a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe06a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe06a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe06a('0x11'))(_0xe06a('0x12'));var utils=require('../../config/utils');var config=require(_0xe06a('0x13'));var licenseUtil=require(_0xe06a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb402c7,_0x87ff63){_0x87ff63=_0x87ff63||0xcc;return function(_0x3aaf53){if(_0x3aaf53){return _0xb402c7['sendStatus'](_0x87ff63);}return _0xb402c7[_0xe06a('0x15')](_0x87ff63)[_0xe06a('0x16')]();};}function respondWithResult(_0x359273,_0xf8a9a7){_0xf8a9a7=_0xf8a9a7||0xc8;return function(_0x335c0d){if(_0x335c0d){return _0x359273['status'](_0xf8a9a7)[_0xe06a('0x17')](_0x335c0d);}};}function respondWithFilteredResult(_0x1080da,_0x171b77){return function(_0xe471a9){if(_0xe471a9){var _0x4d0e41=_0xe471a9['count'],_0x403a92=_0x171b77['offset'],_0x57b590=_0x171b77['offset']+_0x171b77[_0xe06a('0x18')],_0xa9b1af;if(_0x57b590>=_0x4d0e41){_0x57b590=_0x4d0e41;_0xa9b1af=0xc8;}else{_0xa9b1af=0xce;}_0x1080da[_0xe06a('0x15')](_0xa9b1af);return _0x1080da[_0xe06a('0x19')]('Content-Range',_0x403a92+'-'+_0x57b590+'/'+_0x4d0e41)[_0xe06a('0x17')](_0xe471a9);}return null;};}function patchUpdates(_0x6483d4){return function(_0x5806b6){try{jsonpatch[_0xe06a('0x1a')](_0x5806b6,_0x6483d4,!![]);}catch(_0x5382a6){return BPromise[_0xe06a('0x1b')](_0x5382a6);}return _0x5806b6['save']();};}function saveUpdates(_0x550ff8,_0x70d702){return function(_0x99dcd5){if(_0x99dcd5){return _0x99dcd5[_0xe06a('0x1c')](_0x550ff8)[_0xe06a('0x1d')](function(_0xf8921e){return _0xf8921e;});}return null;};}function removeEntity(_0xd2adcd,_0x2ab25f){return function(_0x2c30c7){if(_0x2c30c7){return _0x2c30c7[_0xe06a('0x1e')]()[_0xe06a('0x1d')](function(){_0xd2adcd['status'](0xcc)[_0xe06a('0x16')]();});}};}function handleEntityNotFound(_0x31c2cb,_0xf13325){return function(_0x82ba72){if(!_0x82ba72){_0x31c2cb[_0xe06a('0x1f')](0x194);}return _0x82ba72;};}function handleError(_0x2c96bd,_0x3f468e){_0x3f468e=_0x3f468e||0x1f4;return function(_0x19a7e0){logger[_0xe06a('0x20')](_0x19a7e0['stack']);if(_0x19a7e0['name']){delete _0x19a7e0[_0xe06a('0x21')];}_0x2c96bd['status'](_0x3f468e)[_0xe06a('0x22')](_0x19a7e0);};}exports['update']=function(_0x4afa75,_0x5e0b56){if(_0x4afa75[_0xe06a('0x23')]['id']){delete _0x4afa75[_0xe06a('0x23')]['id'];}return db['Action'][_0xe06a('0x24')]({'where':{'id':_0x4afa75[_0xe06a('0x25')]['id']}})[_0xe06a('0x1d')](handleEntityNotFound(_0x5e0b56,null))[_0xe06a('0x1d')](saveUpdates(_0x4afa75[_0xe06a('0x23')],null))[_0xe06a('0x1d')](respondWithResult(_0x5e0b56,null))[_0xe06a('0x26')](handleError(_0x5e0b56,null));};exports[_0xe06a('0x1e')]=function(_0x1ce29f,_0x50aded){return db['Action'][_0xe06a('0x24')]({'where':{'id':_0x1ce29f[_0xe06a('0x25')]['id']}})[_0xe06a('0x1d')](handleEntityNotFound(_0x50aded,null))[_0xe06a('0x1d')](removeEntity(_0x50aded,null))['catch'](handleError(_0x50aded,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