Built motion from commit (unavailable).|2.5.3
[motion2.git] / server / api / mailApplication / mailApplication.controller.js
index 08df0f2..d1f7d68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc9d2=['count','offset','limit','set','json','reject','update','then','sendStatus','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','body','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','status'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc9d2,0x198));var _0x2c9d=function(_0x42ad6d,_0x35713f){_0x42ad6d=_0x42ad6d-0x0;var _0x4c2274=_0xc9d2[_0x42ad6d];return _0x4c2274;};'use strict';var pdf=require(_0x2c9d('0x0'));var emlformat=require(_0x2c9d('0x1'));var rimraf=require(_0x2c9d('0x2'));var zipdir=require(_0x2c9d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c9d('0x4'));var moment=require(_0x2c9d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c9d('0x6'));var util=require(_0x2c9d('0x7'));var path=require(_0x2c9d('0x8'));var sox=require(_0x2c9d('0x9'));var csv=require(_0x2c9d('0xa'));var ejs=require(_0x2c9d('0xb'));var fs=require('fs');var _=require(_0x2c9d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c9d('0xd'));var toCsv=require(_0x2c9d('0xa'));var querystring=require('querystring');var Papa=require(_0x2c9d('0xe'));var Redis=require('ioredis');var authService=require(_0x2c9d('0xf'));var qs=require(_0x2c9d('0x10'));var as=require(_0x2c9d('0x11'));var hardwareService=require(_0x2c9d('0x12'));var logger=require(_0x2c9d('0x13'))('api');var utils=require(_0x2c9d('0x14'));var config=require(_0x2c9d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1adc9f,_0x3a6241){_0x3a6241=_0x3a6241||0xcc;return function(_0x5f3a6c){if(_0x5f3a6c){return _0x1adc9f['sendStatus'](_0x3a6241);}return _0x1adc9f['status'](_0x3a6241)[_0x2c9d('0x16')]();};}function respondWithResult(_0x2f58ab,_0x552f8a){_0x552f8a=_0x552f8a||0xc8;return function(_0x32504b){if(_0x32504b){return _0x2f58ab[_0x2c9d('0x17')](_0x552f8a)['json'](_0x32504b);}};}function respondWithFilteredResult(_0x4728a5,_0x1a4f4f){return function(_0x38e6cb){if(_0x38e6cb){var _0x36758c=_0x38e6cb[_0x2c9d('0x18')],_0x18371e=_0x1a4f4f[_0x2c9d('0x19')],_0x525f49=_0x1a4f4f[_0x2c9d('0x19')]+_0x1a4f4f[_0x2c9d('0x1a')],_0x50a914;if(_0x525f49>=_0x36758c){_0x525f49=_0x36758c;_0x50a914=0xc8;}else{_0x50a914=0xce;}_0x4728a5[_0x2c9d('0x17')](_0x50a914);return _0x4728a5[_0x2c9d('0x1b')]('Content-Range',_0x18371e+'-'+_0x525f49+'/'+_0x36758c)[_0x2c9d('0x1c')](_0x38e6cb);}return null;};}function patchUpdates(_0x6e6801){return function(_0x570206){try{jsonpatch['apply'](_0x570206,_0x6e6801,!![]);}catch(_0x1fccde){return BPromise[_0x2c9d('0x1d')](_0x1fccde);}return _0x570206['save']();};}function saveUpdates(_0x39ec8f,_0x295903){return function(_0x44bd34){if(_0x44bd34){return _0x44bd34[_0x2c9d('0x1e')](_0x39ec8f)[_0x2c9d('0x1f')](function(_0x26f2c2){return _0x26f2c2;});}return null;};}function removeEntity(_0x1ac300,_0x522d83){return function(_0x25d896){if(_0x25d896){return _0x25d896['destroy']()[_0x2c9d('0x1f')](function(){_0x1ac300[_0x2c9d('0x17')](0xcc)[_0x2c9d('0x16')]();});}};}function handleEntityNotFound(_0x385961,_0x1c31ad){return function(_0x3804cd){if(!_0x3804cd){_0x385961[_0x2c9d('0x20')](0x194);}return _0x3804cd;};}function handleError(_0x483c99,_0xa0566c){_0xa0566c=_0xa0566c||0x1f4;return function(_0x54f384){logger[_0x2c9d('0x21')](_0x54f384[_0x2c9d('0x22')]);if(_0x54f384[_0x2c9d('0x23')]){delete _0x54f384[_0x2c9d('0x23')];}_0x483c99[_0x2c9d('0x17')](_0xa0566c)[_0x2c9d('0x24')](_0x54f384);};}exports[_0x2c9d('0x25')]=function(_0x57c4a4,_0x1b8b8d){var _0x279cb5={'raw':!![],'where':{'id':_0x57c4a4[_0x2c9d('0x26')]['id']}},_0x12dc0d={};_0x12dc0d[_0x2c9d('0x27')]=_[_0x2c9d('0x28')](db[_0x2c9d('0x29')]['rawAttributes']);_0x12dc0d[_0x2c9d('0x2a')]=_[_0x2c9d('0x28')](_0x57c4a4['query']);_0x12dc0d[_0x2c9d('0x2b')]=_[_0x2c9d('0x2c')](_0x12dc0d[_0x2c9d('0x27')],_0x12dc0d[_0x2c9d('0x2a')]);_0x279cb5['attributes']=_[_0x2c9d('0x2c')](_0x12dc0d[_0x2c9d('0x27')],qs[_0x2c9d('0x2d')](_0x57c4a4[_0x2c9d('0x2a')]['fields']));_0x279cb5[_0x2c9d('0x2e')]=_0x279cb5[_0x2c9d('0x2e')][_0x2c9d('0x2f')]?_0x279cb5[_0x2c9d('0x2e')]:_0x12dc0d[_0x2c9d('0x27')];if(_0x57c4a4['query'][_0x2c9d('0x30')]){_0x279cb5['include']=[{'all':!![]}];}_0x279cb5=_[_0x2c9d('0x31')]({},_0x279cb5,_0x57c4a4[_0x2c9d('0x32')]);return db['MailApplication'][_0x2c9d('0x33')](_0x279cb5)[_0x2c9d('0x1f')](handleEntityNotFound(_0x1b8b8d,null))[_0x2c9d('0x1f')](respondWithResult(_0x1b8b8d,null))['catch'](handleError(_0x1b8b8d,null));};exports[_0x2c9d('0x1e')]=function(_0x4f75d8,_0x23b2a6){if(_0x4f75d8[_0x2c9d('0x34')]['id']){delete _0x4f75d8[_0x2c9d('0x34')]['id'];}return db[_0x2c9d('0x29')][_0x2c9d('0x33')]({'where':{'id':_0x4f75d8[_0x2c9d('0x26')]['id']}})['then'](handleEntityNotFound(_0x23b2a6,null))[_0x2c9d('0x1f')](saveUpdates(_0x4f75d8[_0x2c9d('0x34')],null))['then'](respondWithResult(_0x23b2a6,null))[_0x2c9d('0x35')](handleError(_0x23b2a6,null));};exports['destroy']=function(_0x303f25,_0x2037f0){return db[_0x2c9d('0x29')]['find']({'where':{'id':_0x303f25[_0x2c9d('0x26')]['id']}})[_0x2c9d('0x1f')](handleEntityNotFound(_0x2037f0,null))[_0x2c9d('0x1f')](removeEntity(_0x2037f0,null))[_0x2c9d('0x35')](handleError(_0x2037f0,null));};
\ No newline at end of file
+var _0x7e32=['limit','set','apply','reject','save','destroy','error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','length','includeAll','merge','find','then','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset'];(function(_0x36756d,_0x193c83){var _0x2bdd5a=function(_0x540a1e){while(--_0x540a1e){_0x36756d['push'](_0x36756d['shift']());}};_0x2bdd5a(++_0x193c83);}(_0x7e32,0xf0));var _0x27e3=function(_0x55fc61,_0x5b1ca6){_0x55fc61=_0x55fc61-0x0;var _0x3d862f=_0x7e32[_0x55fc61];return _0x3d862f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x27e3('0x0'));var rimraf=require(_0x27e3('0x1'));var zipdir=require(_0x27e3('0x2'));var jsonpatch=require(_0x27e3('0x3'));var rp=require(_0x27e3('0x4'));var moment=require(_0x27e3('0x5'));var BPromise=require(_0x27e3('0x6'));var Mustache=require('mustache');var util=require(_0x27e3('0x7'));var path=require(_0x27e3('0x8'));var sox=require(_0x27e3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x27e3('0xa'));var crypto=require('crypto');var jsforce=require(_0x27e3('0xb'));var deskjs=require(_0x27e3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x27e3('0xd'));var Redis=require(_0x27e3('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x27e3('0xf'));var hardwareService=require(_0x27e3('0x10'));var logger=require(_0x27e3('0x11'))('api');var utils=require(_0x27e3('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x836456,_0x460d70){_0x460d70=_0x460d70||0xcc;return function(_0x2db7fa){if(_0x2db7fa){return _0x836456[_0x27e3('0x13')](_0x460d70);}return _0x836456[_0x27e3('0x14')](_0x460d70)[_0x27e3('0x15')]();};}function respondWithResult(_0x16f54d,_0x1f0e0d){_0x1f0e0d=_0x1f0e0d||0xc8;return function(_0x7cdcb9){if(_0x7cdcb9){return _0x16f54d[_0x27e3('0x14')](_0x1f0e0d)[_0x27e3('0x16')](_0x7cdcb9);}};}function respondWithFilteredResult(_0x2e739d,_0x51b1fa){return function(_0x34e602){if(_0x34e602){var _0xd331fe=_0x34e602[_0x27e3('0x17')],_0x52ace4=_0x51b1fa[_0x27e3('0x18')],_0x3c8dc2=_0x51b1fa['offset']+_0x51b1fa[_0x27e3('0x19')],_0xccffcb;if(_0x3c8dc2>=_0xd331fe){_0x3c8dc2=_0xd331fe;_0xccffcb=0xc8;}else{_0xccffcb=0xce;}_0x2e739d[_0x27e3('0x14')](_0xccffcb);return _0x2e739d[_0x27e3('0x1a')]('Content-Range',_0x52ace4+'-'+_0x3c8dc2+'/'+_0xd331fe)[_0x27e3('0x16')](_0x34e602);}return null;};}function patchUpdates(_0x25e5c4){return function(_0x28db24){try{jsonpatch[_0x27e3('0x1b')](_0x28db24,_0x25e5c4,!![]);}catch(_0x272297){return BPromise[_0x27e3('0x1c')](_0x272297);}return _0x28db24[_0x27e3('0x1d')]();};}function saveUpdates(_0x62ad1,_0x1d1869){return function(_0x391442){if(_0x391442){return _0x391442['update'](_0x62ad1)['then'](function(_0x355e15){return _0x355e15;});}return null;};}function removeEntity(_0x3b9f28,_0x5afdfe){return function(_0x57f30f){if(_0x57f30f){return _0x57f30f[_0x27e3('0x1e')]()['then'](function(){_0x3b9f28['status'](0xcc)[_0x27e3('0x15')]();});}};}function handleEntityNotFound(_0x4b6f18,_0x3d0c90){return function(_0x54bc81){if(!_0x54bc81){_0x4b6f18[_0x27e3('0x13')](0x194);}return _0x54bc81;};}function handleError(_0x2a824c,_0x16cbc6){_0x16cbc6=_0x16cbc6||0x1f4;return function(_0x1e3e0b){logger[_0x27e3('0x1f')](_0x1e3e0b[_0x27e3('0x20')]);if(_0x1e3e0b['name']){delete _0x1e3e0b[_0x27e3('0x21')];}_0x2a824c[_0x27e3('0x14')](_0x16cbc6)[_0x27e3('0x22')](_0x1e3e0b);};}exports[_0x27e3('0x23')]=function(_0x3fd918,_0x410e91){var _0x468b6d={'raw':!![],'where':{'id':_0x3fd918[_0x27e3('0x24')]['id']}},_0x461912={};_0x461912[_0x27e3('0x25')]=_[_0x27e3('0x26')](db[_0x27e3('0x27')][_0x27e3('0x28')]);_0x461912[_0x27e3('0x29')]=_[_0x27e3('0x26')](_0x3fd918[_0x27e3('0x29')]);_0x461912[_0x27e3('0x2a')]=_[_0x27e3('0x2b')](_0x461912[_0x27e3('0x25')],_0x461912[_0x27e3('0x29')]);_0x468b6d[_0x27e3('0x2c')]=_[_0x27e3('0x2b')](_0x461912[_0x27e3('0x25')],qs['fields'](_0x3fd918['query']['fields']));_0x468b6d[_0x27e3('0x2c')]=_0x468b6d['attributes'][_0x27e3('0x2d')]?_0x468b6d['attributes']:_0x461912['model'];if(_0x3fd918['query'][_0x27e3('0x2e')]){_0x468b6d['include']=[{'all':!![]}];}_0x468b6d=_[_0x27e3('0x2f')]({},_0x468b6d,_0x3fd918['options']);return db[_0x27e3('0x27')][_0x27e3('0x30')](_0x468b6d)['then'](handleEntityNotFound(_0x410e91,null))[_0x27e3('0x31')](respondWithResult(_0x410e91,null))[_0x27e3('0x32')](handleError(_0x410e91,null));};exports[_0x27e3('0x33')]=function(_0x4ded74,_0x1f718c){if(_0x4ded74['body']['id']){delete _0x4ded74[_0x27e3('0x34')]['id'];}return db[_0x27e3('0x27')][_0x27e3('0x30')]({'where':{'id':_0x4ded74[_0x27e3('0x24')]['id']}})[_0x27e3('0x31')](handleEntityNotFound(_0x1f718c,null))['then'](saveUpdates(_0x4ded74['body'],null))[_0x27e3('0x31')](respondWithResult(_0x1f718c,null))[_0x27e3('0x32')](handleError(_0x1f718c,null));};exports[_0x27e3('0x1e')]=function(_0x54c71d,_0x51842){return db[_0x27e3('0x27')][_0x27e3('0x30')]({'where':{'id':_0x54c71d[_0x27e3('0x24')]['id']}})[_0x27e3('0x31')](handleEntityNotFound(_0x51842,null))['then'](removeEntity(_0x51842,null))[_0x27e3('0x32')](handleError(_0x51842,null));};
\ No newline at end of file