Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / server / api / mailApplication / mailApplication.controller.js
index 74b676c..808db06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a89=['name','send','show','params','model','keys','MailApplication','query','filters','attributes','fields','includeAll','include','options','find','catch','body','destroy','rimraf','zip-dir','fast-json-patch','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','stack'];(function(_0x12f6b6,_0x252bb9){var _0x4b8194=function(_0x1bb8d){while(--_0x1bb8d){_0x12f6b6['push'](_0x12f6b6['shift']());}};_0x4b8194(++_0x252bb9);}(_0x0a89,0xab));var _0x90a8=function(_0x2091fd,_0x54cb51){_0x2091fd=_0x2091fd-0x0;var _0x1169e6=_0x0a89[_0x2091fd];return _0x1169e6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x90a8('0x0'));var zipdir=require(_0x90a8('0x1'));var jsonpatch=require(_0x90a8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x90a8('0x3'));var path=require('path');var sox=require(_0x90a8('0x4'));var csv=require(_0x90a8('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x90a8('0x6'));var squel=require('squel');var crypto=require(_0x90a8('0x7'));var jsforce=require(_0x90a8('0x8'));var deskjs=require(_0x90a8('0x9'));var toCsv=require(_0x90a8('0x5'));var querystring=require(_0x90a8('0xa'));var Papa=require(_0x90a8('0xb'));var Redis=require(_0x90a8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x90a8('0xd'));var as=require(_0x90a8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90a8('0xf'))(_0x90a8('0x10'));var utils=require(_0x90a8('0x11'));var config=require(_0x90a8('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43c59e,_0x1ad3f8){_0x1ad3f8=_0x1ad3f8||0xcc;return function(_0x5d5c3a){if(_0x5d5c3a){return _0x43c59e['sendStatus'](_0x1ad3f8);}return _0x43c59e['status'](_0x1ad3f8)[_0x90a8('0x13')]();};}function respondWithResult(_0x832319,_0x50f23f){_0x50f23f=_0x50f23f||0xc8;return function(_0x1d024f){if(_0x1d024f){return _0x832319[_0x90a8('0x14')](_0x50f23f)['json'](_0x1d024f);}};}function respondWithFilteredResult(_0x43f41d,_0x57e207){return function(_0x356f9b){if(_0x356f9b){var _0x1cc9c3=_0x356f9b[_0x90a8('0x15')],_0x3df2e3=_0x57e207['offset'],_0x31e8cd=_0x57e207[_0x90a8('0x16')]+_0x57e207['limit'],_0x374706;if(_0x31e8cd>=_0x1cc9c3){_0x31e8cd=_0x1cc9c3;_0x374706=0xc8;}else{_0x374706=0xce;}_0x43f41d[_0x90a8('0x14')](_0x374706);return _0x43f41d[_0x90a8('0x17')](_0x90a8('0x18'),_0x3df2e3+'-'+_0x31e8cd+'/'+_0x1cc9c3)[_0x90a8('0x19')](_0x356f9b);}return null;};}function patchUpdates(_0x22bfeb){return function(_0x35864e){try{jsonpatch[_0x90a8('0x1a')](_0x35864e,_0x22bfeb,!![]);}catch(_0x19df9b){return BPromise[_0x90a8('0x1b')](_0x19df9b);}return _0x35864e[_0x90a8('0x1c')]();};}function saveUpdates(_0x117563,_0x3911e9){return function(_0x155cb8){if(_0x155cb8){return _0x155cb8[_0x90a8('0x1d')](_0x117563)['then'](function(_0x405d9a){return _0x405d9a;});}return null;};}function removeEntity(_0x1a4725,_0x65facf){return function(_0xbf165f){if(_0xbf165f){return _0xbf165f['destroy']()[_0x90a8('0x1e')](function(){_0x1a4725['status'](0xcc)[_0x90a8('0x13')]();});}};}function handleEntityNotFound(_0x313eac,_0xbf06a4){return function(_0x4ab35b){if(!_0x4ab35b){_0x313eac[_0x90a8('0x1f')](0x194);}return _0x4ab35b;};}function handleError(_0x5d5d68,_0x281c29){_0x281c29=_0x281c29||0x1f4;return function(_0x296afc){logger['error'](_0x296afc[_0x90a8('0x20')]);if(_0x296afc['name']){delete _0x296afc[_0x90a8('0x21')];}_0x5d5d68[_0x90a8('0x14')](_0x281c29)[_0x90a8('0x22')](_0x296afc);};}exports[_0x90a8('0x23')]=function(_0x1495c5,_0x523b4d){var _0x190f76={'raw':!![],'where':{'id':_0x1495c5[_0x90a8('0x24')]['id']}},_0x59062b={};_0x59062b[_0x90a8('0x25')]=_[_0x90a8('0x26')](db[_0x90a8('0x27')]['rawAttributes']);_0x59062b[_0x90a8('0x28')]=_['keys'](_0x1495c5['query']);_0x59062b[_0x90a8('0x29')]=_['intersection'](_0x59062b[_0x90a8('0x25')],_0x59062b[_0x90a8('0x28')]);_0x190f76[_0x90a8('0x2a')]=_['intersection'](_0x59062b['model'],qs[_0x90a8('0x2b')](_0x1495c5[_0x90a8('0x28')][_0x90a8('0x2b')]));_0x190f76[_0x90a8('0x2a')]=_0x190f76[_0x90a8('0x2a')]['length']?_0x190f76['attributes']:_0x59062b[_0x90a8('0x25')];if(_0x1495c5[_0x90a8('0x28')][_0x90a8('0x2c')]){_0x190f76[_0x90a8('0x2d')]=[{'all':!![]}];}_0x190f76=_['merge']({},_0x190f76,_0x1495c5[_0x90a8('0x2e')]);return db[_0x90a8('0x27')][_0x90a8('0x2f')](_0x190f76)[_0x90a8('0x1e')](handleEntityNotFound(_0x523b4d,null))[_0x90a8('0x1e')](respondWithResult(_0x523b4d,null))[_0x90a8('0x30')](handleError(_0x523b4d,null));};exports[_0x90a8('0x1d')]=function(_0x554b9e,_0x51cb29){if(_0x554b9e[_0x90a8('0x31')]['id']){delete _0x554b9e['body']['id'];}return db[_0x90a8('0x27')][_0x90a8('0x2f')]({'where':{'id':_0x554b9e[_0x90a8('0x24')]['id']}})[_0x90a8('0x1e')](handleEntityNotFound(_0x51cb29,null))['then'](saveUpdates(_0x554b9e[_0x90a8('0x31')],null))['then'](respondWithResult(_0x51cb29,null))[_0x90a8('0x30')](handleError(_0x51cb29,null));};exports[_0x90a8('0x32')]=function(_0x482b5f,_0x65d736){return db[_0x90a8('0x27')][_0x90a8('0x2f')]({'where':{'id':_0x482b5f['params']['id']}})[_0x90a8('0x1e')](handleEntityNotFound(_0x65d736,null))[_0x90a8('0x1e')](removeEntity(_0x65d736,null))['catch'](handleError(_0x65d736,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