Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / server / api / mailApplication / mailApplication.controller.js
index 95ce307..808db06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3200=['status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4ab924,_0x4d3e3e){var _0x79986d=function(_0x47e3f4){while(--_0x47e3f4){_0x4ab924['push'](_0x4ab924['shift']());}};_0x79986d(++_0x4d3e3e);}(_0x3200,0x1dc));var _0x0320=function(_0x4ff139,_0x720a85){_0x4ff139=_0x4ff139-0x0;var _0x439e26=_0x3200[_0x4ff139];return _0x439e26;};'use strict';var pdf=require(_0x0320('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0320('0x1'));var zipdir=require(_0x0320('0x2'));var jsonpatch=require(_0x0320('0x3'));var rp=require(_0x0320('0x4'));var moment=require('moment');var BPromise=require(_0x0320('0x5'));var Mustache=require(_0x0320('0x6'));var util=require(_0x0320('0x7'));var path=require(_0x0320('0x8'));var sox=require(_0x0320('0x9'));var csv=require(_0x0320('0xa'));var ejs=require(_0x0320('0xb'));var fs=require('fs');var _=require(_0x0320('0xc'));var squel=require('squel');var crypto=require(_0x0320('0xd'));var jsforce=require(_0x0320('0xe'));var deskjs=require(_0x0320('0xf'));var toCsv=require(_0x0320('0xa'));var querystring=require(_0x0320('0x10'));var Papa=require(_0x0320('0x11'));var Redis=require(_0x0320('0x12'));var authService=require(_0x0320('0x13'));var qs=require(_0x0320('0x14'));var as=require(_0x0320('0x15'));var hardwareService=require(_0x0320('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x0320('0x17'));var config=require(_0x0320('0x18'));var licenseUtil=require(_0x0320('0x19'));var db=require(_0x0320('0x1a'))['db'];function respondWithStatusCode(_0x1bce45,_0x1faf31){_0x1faf31=_0x1faf31||0xcc;return function(_0x72cf70){if(_0x72cf70){return _0x1bce45[_0x0320('0x1b')](_0x1faf31);}return _0x1bce45[_0x0320('0x1c')](_0x1faf31)[_0x0320('0x1d')]();};}function respondWithResult(_0x38dfc5,_0x31fb55){_0x31fb55=_0x31fb55||0xc8;return function(_0x1b878b){if(_0x1b878b){return _0x38dfc5['status'](_0x31fb55)[_0x0320('0x1e')](_0x1b878b);}};}function respondWithFilteredResult(_0x4a7966,_0x5d9c71){return function(_0x4a7d28){if(_0x4a7d28){var _0x318d56=_0x4a7d28[_0x0320('0x1f')],_0x38a6a2=_0x5d9c71['offset'],_0x2f23d6=_0x5d9c71[_0x0320('0x20')]+_0x5d9c71[_0x0320('0x21')],_0x2d76d2;if(_0x2f23d6>=_0x318d56){_0x2f23d6=_0x318d56;_0x2d76d2=0xc8;}else{_0x2d76d2=0xce;}_0x4a7966['status'](_0x2d76d2);return _0x4a7966[_0x0320('0x22')]('Content-Range',_0x38a6a2+'-'+_0x2f23d6+'/'+_0x318d56)[_0x0320('0x1e')](_0x4a7d28);}return null;};}function patchUpdates(_0x5bb971){return function(_0x5e9779){try{jsonpatch[_0x0320('0x23')](_0x5e9779,_0x5bb971,!![]);}catch(_0xaa7406){return BPromise[_0x0320('0x24')](_0xaa7406);}return _0x5e9779[_0x0320('0x25')]();};}function saveUpdates(_0x330e31,_0x15799c){return function(_0x4beac4){if(_0x4beac4){return _0x4beac4[_0x0320('0x26')](_0x330e31)['then'](function(_0x13ec73){return _0x13ec73;});}return null;};}function removeEntity(_0x4b6485,_0x446d23){return function(_0x10c882){if(_0x10c882){return _0x10c882[_0x0320('0x27')]()[_0x0320('0x28')](function(){_0x4b6485[_0x0320('0x1c')](0xcc)[_0x0320('0x1d')]();});}};}function handleEntityNotFound(_0x4e7ffa,_0x2d11aa){return function(_0x5d61f2){if(!_0x5d61f2){_0x4e7ffa[_0x0320('0x1b')](0x194);}return _0x5d61f2;};}function handleError(_0x2d3c55,_0xa1c5a){_0xa1c5a=_0xa1c5a||0x1f4;return function(_0x1f952a){logger[_0x0320('0x29')](_0x1f952a[_0x0320('0x2a')]);if(_0x1f952a[_0x0320('0x2b')]){delete _0x1f952a[_0x0320('0x2b')];}_0x2d3c55[_0x0320('0x1c')](_0xa1c5a)[_0x0320('0x2c')](_0x1f952a);};}exports[_0x0320('0x2d')]=function(_0x2c7db5,_0x578cd6){var _0xdb4db5={'raw':!![],'where':{'id':_0x2c7db5[_0x0320('0x2e')]['id']}},_0x746f6f={};_0x746f6f[_0x0320('0x2f')]=_[_0x0320('0x30')](db[_0x0320('0x31')][_0x0320('0x32')]);_0x746f6f[_0x0320('0x33')]=_[_0x0320('0x30')](_0x2c7db5[_0x0320('0x33')]);_0x746f6f[_0x0320('0x34')]=_[_0x0320('0x35')](_0x746f6f[_0x0320('0x2f')],_0x746f6f[_0x0320('0x33')]);_0xdb4db5[_0x0320('0x36')]=_['intersection'](_0x746f6f[_0x0320('0x2f')],qs[_0x0320('0x37')](_0x2c7db5['query'][_0x0320('0x37')]));_0xdb4db5['attributes']=_0xdb4db5['attributes'][_0x0320('0x38')]?_0xdb4db5['attributes']:_0x746f6f[_0x0320('0x2f')];if(_0x2c7db5['query'][_0x0320('0x39')]){_0xdb4db5[_0x0320('0x3a')]=[{'all':!![]}];}_0xdb4db5=_[_0x0320('0x3b')]({},_0xdb4db5,_0x2c7db5[_0x0320('0x3c')]);return db[_0x0320('0x31')]['find'](_0xdb4db5)['then'](handleEntityNotFound(_0x578cd6,null))[_0x0320('0x28')](respondWithResult(_0x578cd6,null))[_0x0320('0x3d')](handleError(_0x578cd6,null));};exports['update']=function(_0x2c6854,_0xd025a9){if(_0x2c6854[_0x0320('0x3e')]['id']){delete _0x2c6854['body']['id'];}return db['MailApplication']['find']({'where':{'id':_0x2c6854[_0x0320('0x2e')]['id']}})[_0x0320('0x28')](handleEntityNotFound(_0xd025a9,null))['then'](saveUpdates(_0x2c6854['body'],null))[_0x0320('0x28')](respondWithResult(_0xd025a9,null))[_0x0320('0x3d')](handleError(_0xd025a9,null));};exports[_0x0320('0x27')]=function(_0x3a0421,_0x2b778d){return db[_0x0320('0x31')]['find']({'where':{'id':_0x3a0421[_0x0320('0x2e')]['id']}})[_0x0320('0x28')](handleEntityNotFound(_0x2b778d,null))[_0x0320('0x28')](removeEntity(_0x2b778d,null))[_0x0320('0x3d')](handleError(_0x2b778d,null));};
\ No newline at end of file
+var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x155d18,_0x5b4da9){var _0x3cfdc6=function(_0x15e47a){while(--_0x15e47a){_0x155d18['push'](_0x155d18['shift']());}};_0x3cfdc6(++_0x5b4da9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x58dea6,_0xbd27e9){_0x58dea6=_0x58dea6-0x0;var _0x11f25c=_0xf4eb[_0x58dea6];return _0x11f25c;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));};
\ No newline at end of file