Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / server / api / mailApplication / mailApplication.controller.js
index ed3e3ad..808db06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf590=['../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','name','send','show','params','model','keys','rawAttributes','filters','attributes','intersection','fields','query','include','options','MailApplication','find','body','catch','html-pdf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x4c2364,_0x13aeb){var _0x213753=function(_0x370738){while(--_0x370738){_0x4c2364['push'](_0x4c2364['shift']());}};_0x213753(++_0x13aeb);}(_0xf590,0x171));var _0x0f59=function(_0x5992b4,_0x414e4d){_0x5992b4=_0x5992b4-0x0;var _0x3df19c=_0xf590[_0x5992b4];return _0x3df19c;};'use strict';var pdf=require(_0x0f59('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f59('0x1'));var rp=require(_0x0f59('0x2'));var moment=require('moment');var BPromise=require(_0x0f59('0x3'));var Mustache=require(_0x0f59('0x4'));var util=require('util');var path=require(_0x0f59('0x5'));var sox=require(_0x0f59('0x6'));var csv=require(_0x0f59('0x7'));var ejs=require(_0x0f59('0x8'));var fs=require('fs');var _=require(_0x0f59('0x9'));var squel=require(_0x0f59('0xa'));var crypto=require(_0x0f59('0xb'));var jsforce=require(_0x0f59('0xc'));var deskjs=require(_0x0f59('0xd'));var toCsv=require(_0x0f59('0x7'));var querystring=require('querystring');var Papa=require(_0x0f59('0xe'));var Redis=require(_0x0f59('0xf'));var authService=require(_0x0f59('0x10'));var qs=require(_0x0f59('0x11'));var as=require(_0x0f59('0x12'));var hardwareService=require(_0x0f59('0x13'));var logger=require(_0x0f59('0x14'))(_0x0f59('0x15'));var utils=require('../../config/utils');var config=require(_0x0f59('0x16'));var licenseUtil=require(_0x0f59('0x17'));var db=require(_0x0f59('0x18'))['db'];function respondWithStatusCode(_0x858707,_0x536c26){_0x536c26=_0x536c26||0xcc;return function(_0x586cfb){if(_0x586cfb){return _0x858707[_0x0f59('0x19')](_0x536c26);}return _0x858707[_0x0f59('0x1a')](_0x536c26)[_0x0f59('0x1b')]();};}function respondWithResult(_0x2e021e,_0x35e8af){_0x35e8af=_0x35e8af||0xc8;return function(_0x66c220){if(_0x66c220){return _0x2e021e[_0x0f59('0x1a')](_0x35e8af)['json'](_0x66c220);}};}function respondWithFilteredResult(_0x2096e8,_0x419e7e){return function(_0x24ed79){if(_0x24ed79){var _0x1b7adb=_0x24ed79[_0x0f59('0x1c')],_0xde9cd9=_0x419e7e[_0x0f59('0x1d')],_0x153271=_0x419e7e[_0x0f59('0x1d')]+_0x419e7e[_0x0f59('0x1e')],_0x2cfd90;if(_0x153271>=_0x1b7adb){_0x153271=_0x1b7adb;_0x2cfd90=0xc8;}else{_0x2cfd90=0xce;}_0x2096e8[_0x0f59('0x1a')](_0x2cfd90);return _0x2096e8[_0x0f59('0x1f')](_0x0f59('0x20'),_0xde9cd9+'-'+_0x153271+'/'+_0x1b7adb)[_0x0f59('0x21')](_0x24ed79);}return null;};}function patchUpdates(_0x1c1291){return function(_0x352220){try{jsonpatch[_0x0f59('0x22')](_0x352220,_0x1c1291,!![]);}catch(_0x2d33b9){return BPromise['reject'](_0x2d33b9);}return _0x352220['save']();};}function saveUpdates(_0x558627,_0x3db04f){return function(_0x20cc7b){if(_0x20cc7b){return _0x20cc7b[_0x0f59('0x23')](_0x558627)[_0x0f59('0x24')](function(_0x80d320){return _0x80d320;});}return null;};}function removeEntity(_0x669bde,_0x1dcca5){return function(_0x3bc9c4){if(_0x3bc9c4){return _0x3bc9c4[_0x0f59('0x25')]()[_0x0f59('0x24')](function(){_0x669bde[_0x0f59('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a3ec,_0x25780e){return function(_0x573d73){if(!_0x573d73){_0x44a3ec[_0x0f59('0x19')](0x194);}return _0x573d73;};}function handleError(_0x46cf5d,_0x17b270){_0x17b270=_0x17b270||0x1f4;return function(_0x53b9cb){logger['error'](_0x53b9cb['stack']);if(_0x53b9cb[_0x0f59('0x26')]){delete _0x53b9cb['name'];}_0x46cf5d[_0x0f59('0x1a')](_0x17b270)[_0x0f59('0x27')](_0x53b9cb);};}exports[_0x0f59('0x28')]=function(_0x23e35f,_0x26c6e8){var _0x3ff64d={'raw':!![],'where':{'id':_0x23e35f[_0x0f59('0x29')]['id']}},_0x54b3ed={};_0x54b3ed[_0x0f59('0x2a')]=_[_0x0f59('0x2b')](db['MailApplication'][_0x0f59('0x2c')]);_0x54b3ed['query']=_[_0x0f59('0x2b')](_0x23e35f['query']);_0x54b3ed[_0x0f59('0x2d')]=_['intersection'](_0x54b3ed[_0x0f59('0x2a')],_0x54b3ed['query']);_0x3ff64d[_0x0f59('0x2e')]=_[_0x0f59('0x2f')](_0x54b3ed[_0x0f59('0x2a')],qs[_0x0f59('0x30')](_0x23e35f['query'][_0x0f59('0x30')]));_0x3ff64d[_0x0f59('0x2e')]=_0x3ff64d[_0x0f59('0x2e')]['length']?_0x3ff64d[_0x0f59('0x2e')]:_0x54b3ed[_0x0f59('0x2a')];if(_0x23e35f[_0x0f59('0x31')]['includeAll']){_0x3ff64d[_0x0f59('0x32')]=[{'all':!![]}];}_0x3ff64d=_['merge']({},_0x3ff64d,_0x23e35f[_0x0f59('0x33')]);return db[_0x0f59('0x34')][_0x0f59('0x35')](_0x3ff64d)[_0x0f59('0x24')](handleEntityNotFound(_0x26c6e8,null))[_0x0f59('0x24')](respondWithResult(_0x26c6e8,null))['catch'](handleError(_0x26c6e8,null));};exports[_0x0f59('0x23')]=function(_0x3817b7,_0x43ad02){if(_0x3817b7[_0x0f59('0x36')]['id']){delete _0x3817b7['body']['id'];}return db[_0x0f59('0x34')][_0x0f59('0x35')]({'where':{'id':_0x3817b7[_0x0f59('0x29')]['id']}})['then'](handleEntityNotFound(_0x43ad02,null))[_0x0f59('0x24')](saveUpdates(_0x3817b7[_0x0f59('0x36')],null))[_0x0f59('0x24')](respondWithResult(_0x43ad02,null))[_0x0f59('0x37')](handleError(_0x43ad02,null));};exports[_0x0f59('0x25')]=function(_0x414b76,_0xf56497){return db[_0x0f59('0x34')][_0x0f59('0x35')]({'where':{'id':_0x414b76[_0x0f59('0x29')]['id']}})['then'](handleEntityNotFound(_0xf56497,null))[_0x0f59('0x24')](removeEntity(_0xf56497,null))['catch'](handleError(_0xf56497,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