Built motion from commit (unavailable).|2.5.17
[motion2.git] / server / api / mailTransferReport / mailTransferReport.controller.js
index 9fbde33..fd929ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x078f=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','offset','sort','where','VIRTUAL','filter','merge','options','count','rows','catch','filters','fields','include','create','body','params','destroy','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x81c338,_0x1c6a45){var _0xa0ac34=function(_0x32d3ab){while(--_0x32d3ab){_0x81c338['push'](_0x81c338['shift']());}};_0xa0ac34(++_0x1c6a45);}(_0x078f,0x1b4));var _0xf078=function(_0x231f39,_0x594778){_0x231f39=_0x231f39-0x0;var _0x5ce7c7=_0x078f[_0x231f39];return _0x5ce7c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf078('0x0'));var rimraf=require(_0xf078('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf078('0x2'));var rp=require(_0xf078('0x3'));var moment=require(_0xf078('0x4'));var BPromise=require(_0xf078('0x5'));var Mustache=require('mustache');var util=require(_0xf078('0x6'));var path=require(_0xf078('0x7'));var sox=require(_0xf078('0x8'));var csv=require(_0xf078('0x9'));var ejs=require(_0xf078('0xa'));var fs=require('fs');var _=require(_0xf078('0xb'));var squel=require(_0xf078('0xc'));var crypto=require(_0xf078('0xd'));var jsforce=require(_0xf078('0xe'));var deskjs=require(_0xf078('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf078('0x10'));var Papa=require('papaparse');var Redis=require(_0xf078('0x11'));var authService=require(_0xf078('0x12'));var qs=require(_0xf078('0x13'));var as=require(_0xf078('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf078('0x15'))('api');var utils=require(_0xf078('0x16'));var config=require(_0xf078('0x17'));var licenseUtil=require(_0xf078('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53b412,_0x101b47){_0x101b47=_0x101b47||0xcc;return function(_0x2e3616){if(_0x2e3616){return _0x53b412[_0xf078('0x19')](_0x101b47);}return _0x53b412['status'](_0x101b47)[_0xf078('0x1a')]();};}function respondWithResult(_0x38c994,_0x56d8e8){_0x56d8e8=_0x56d8e8||0xc8;return function(_0x27acc4){if(_0x27acc4){return _0x38c994[_0xf078('0x1b')](_0x56d8e8)[_0xf078('0x1c')](_0x27acc4);}};}function respondWithFilteredResult(_0x2ca3d3,_0x3f8dde){return function(_0x56b9b7){if(_0x56b9b7){var _0x54282d=_0x56b9b7['count'],_0x5f0bc7=_0x3f8dde['offset'],_0xcce72b=_0x3f8dde['offset']+_0x3f8dde[_0xf078('0x1d')],_0xd5ec14;if(_0xcce72b>=_0x54282d){_0xcce72b=_0x54282d;_0xd5ec14=0xc8;}else{_0xd5ec14=0xce;}_0x2ca3d3[_0xf078('0x1b')](_0xd5ec14);return _0x2ca3d3[_0xf078('0x1e')](_0xf078('0x1f'),_0x5f0bc7+'-'+_0xcce72b+'/'+_0x54282d)[_0xf078('0x1c')](_0x56b9b7);}return null;};}function patchUpdates(_0x2d682f){return function(_0x5b475c){try{jsonpatch[_0xf078('0x20')](_0x5b475c,_0x2d682f,!![]);}catch(_0x4854dc){return BPromise[_0xf078('0x21')](_0x4854dc);}return _0x5b475c[_0xf078('0x22')]();};}function saveUpdates(_0x235286,_0x4271a3){return function(_0x479385){if(_0x479385){return _0x479385[_0xf078('0x23')](_0x235286)[_0xf078('0x24')](function(_0x2648c0){return _0x2648c0;});}return null;};}function removeEntity(_0xd79bf5,_0x2ab3c3){return function(_0x3c4feb){if(_0x3c4feb){return _0x3c4feb['destroy']()[_0xf078('0x24')](function(){_0xd79bf5[_0xf078('0x1b')](0xcc)[_0xf078('0x1a')]();});}};}function handleEntityNotFound(_0x1fd58c,_0xa9b15c){return function(_0x4276f8){if(!_0x4276f8){_0x1fd58c['sendStatus'](0x194);}return _0x4276f8;};}function handleError(_0x54ba61,_0x11b6ed){_0x11b6ed=_0x11b6ed||0x1f4;return function(_0x221940){logger[_0xf078('0x25')](_0x221940[_0xf078('0x26')]);if(_0x221940[_0xf078('0x27')]){delete _0x221940[_0xf078('0x27')];}_0x54ba61[_0xf078('0x1b')](_0x11b6ed)[_0xf078('0x28')](_0x221940);};}exports[_0xf078('0x29')]=function(_0x474b4a,_0x4bd5b9){var _0x3b7c9f={},_0x41c866={},_0x191e8f={'count':0x0,'rows':[]};var _0x1cb72e=_[_0xf078('0x2a')](db[_0xf078('0x2b')][_0xf078('0x2c')],function(_0x220c85){return{'name':_0x220c85[_0xf078('0x2d')],'type':_0x220c85[_0xf078('0x2e')][_0xf078('0x2f')]};});_0x41c866[_0xf078('0x30')]=_[_0xf078('0x2a')](_0x1cb72e,'name');_0x41c866[_0xf078('0x31')]=_[_0xf078('0x32')](_0x474b4a[_0xf078('0x31')]);_0x41c866['filters']=_[_0xf078('0x33')](_0x41c866[_0xf078('0x30')],_0x41c866[_0xf078('0x31')]);_0x3b7c9f[_0xf078('0x34')]=_[_0xf078('0x33')](_0x41c866[_0xf078('0x30')],qs['fields'](_0x474b4a[_0xf078('0x31')]['fields']));_0x3b7c9f[_0xf078('0x34')]=_0x3b7c9f[_0xf078('0x34')][_0xf078('0x35')]?_0x3b7c9f[_0xf078('0x34')]:_0x41c866['model'];if(!_0x474b4a[_0xf078('0x31')][_0xf078('0x36')](_0xf078('0x37'))){_0x3b7c9f['limit']=qs['limit'](_0x474b4a[_0xf078('0x31')][_0xf078('0x1d')]);_0x3b7c9f[_0xf078('0x38')]=qs[_0xf078('0x38')](_0x474b4a['query']['offset']);}_0x3b7c9f['order']=qs['sort'](_0x474b4a[_0xf078('0x31')][_0xf078('0x39')]);_0x3b7c9f['where']=qs['filters'](_['pick'](_0x474b4a[_0xf078('0x31')],_0x41c866['filters']),_0x1cb72e);if(_0x474b4a[_0xf078('0x31')]['filter']){_0x3b7c9f[_0xf078('0x3a')]=_['merge'](_0x3b7c9f[_0xf078('0x3a')],{'$or':_[_0xf078('0x2a')](_0x1cb72e,function(_0x15c458){if(_0x15c458[_0xf078('0x2e')]!==_0xf078('0x3b')){var _0x3db270={};_0x3db270[_0x15c458['name']]={'$like':'%'+_0x474b4a['query'][_0xf078('0x3c')]+'%'};return _0x3db270;}})});}_0x3b7c9f=_[_0xf078('0x3d')]({},_0x3b7c9f,_0x474b4a[_0xf078('0x3e')]);var _0x4d3a36={'where':_0x3b7c9f['where']};return db['MailTransferReport'][_0xf078('0x3f')](_0x4d3a36)[_0xf078('0x24')](function(_0x288415){_0x191e8f[_0xf078('0x3f')]=_0x288415;if(_0x474b4a[_0xf078('0x31')]['includeAll']){_0x3b7c9f['include']=[{'all':!![]}];}return db[_0xf078('0x2b')]['findAll'](_0x3b7c9f);})[_0xf078('0x24')](function(_0x5015cc){_0x191e8f[_0xf078('0x40')]=_0x5015cc;return _0x191e8f;})[_0xf078('0x24')](respondWithFilteredResult(_0x4bd5b9,_0x3b7c9f))[_0xf078('0x41')](handleError(_0x4bd5b9,null));};exports['show']=function(_0x1fd289,_0x4a4e67){var _0x40a43f={'raw':!![],'where':{'id':_0x1fd289['params']['id']}},_0x5cc3fd={};_0x5cc3fd[_0xf078('0x30')]=_[_0xf078('0x32')](db[_0xf078('0x2b')][_0xf078('0x2c')]);_0x5cc3fd[_0xf078('0x31')]=_[_0xf078('0x32')](_0x1fd289[_0xf078('0x31')]);_0x5cc3fd[_0xf078('0x42')]=_[_0xf078('0x33')](_0x5cc3fd[_0xf078('0x30')],_0x5cc3fd[_0xf078('0x31')]);_0x40a43f[_0xf078('0x34')]=_[_0xf078('0x33')](_0x5cc3fd[_0xf078('0x30')],qs[_0xf078('0x43')](_0x1fd289[_0xf078('0x31')][_0xf078('0x43')]));_0x40a43f['attributes']=_0x40a43f[_0xf078('0x34')][_0xf078('0x35')]?_0x40a43f[_0xf078('0x34')]:_0x5cc3fd[_0xf078('0x30')];if(_0x1fd289[_0xf078('0x31')]['includeAll']){_0x40a43f[_0xf078('0x44')]=[{'all':!![]}];}_0x40a43f=_['merge']({},_0x40a43f,_0x1fd289[_0xf078('0x3e')]);return db['MailTransferReport']['find'](_0x40a43f)[_0xf078('0x24')](handleEntityNotFound(_0x4a4e67,null))[_0xf078('0x24')](respondWithResult(_0x4a4e67,null))[_0xf078('0x41')](handleError(_0x4a4e67,null));};exports[_0xf078('0x45')]=function(_0x20d738,_0x221f9f){return db['MailTransferReport'][_0xf078('0x45')](_0x20d738[_0xf078('0x46')],{})[_0xf078('0x24')](respondWithResult(_0x221f9f,0xc9))['catch'](handleError(_0x221f9f,null));};exports['update']=function(_0x4e12ed,_0x2d2a51){if(_0x4e12ed['body']['id']){delete _0x4e12ed['body']['id'];}return db[_0xf078('0x2b')]['find']({'where':{'id':_0x4e12ed[_0xf078('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d2a51,null))[_0xf078('0x24')](saveUpdates(_0x4e12ed[_0xf078('0x46')],null))['then'](respondWithResult(_0x2d2a51,null))[_0xf078('0x41')](handleError(_0x2d2a51,null));};exports[_0xf078('0x48')]=function(_0xf213d1,_0xcb750c){return db['MailTransferReport'][_0xf078('0x49')]({'where':{'id':_0xf213d1[_0xf078('0x47')]['id']}})[_0xf078('0x24')](handleEntityNotFound(_0xcb750c,null))[_0xf078('0x24')](removeEntity(_0xcb750c,null))[_0xf078('0x41')](handleError(_0xcb750c,null));};exports['describe']=function(_0x49d34a,_0x804d8e){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x804d8e,null))[_0xf078('0x41')](handleError(_0x804d8e,null));};
\ No newline at end of file
+var _0x6f96=['limit','Content-Range','apply','save','destroy','then','error','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','length','includeAll','include','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x544d66,_0xabcbd9){var _0x46a80d=function(_0x48311d){while(--_0x48311d){_0x544d66['push'](_0x544d66['shift']());}};_0x46a80d(++_0xabcbd9);}(_0x6f96,0x13f));var _0x66f9=function(_0x42959a,_0x306b07){_0x42959a=_0x42959a-0x0;var _0x135df6=_0x6f96[_0x42959a];return _0x135df6;};'use strict';var pdf=require(_0x66f9('0x0'));var emlformat=require(_0x66f9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x66f9('0x2'));var jsonpatch=require(_0x66f9('0x3'));var rp=require(_0x66f9('0x4'));var moment=require('moment');var BPromise=require(_0x66f9('0x5'));var Mustache=require(_0x66f9('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x66f9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66f9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66f9('0x9'));var deskjs=require(_0x66f9('0xa'));var toCsv=require(_0x66f9('0x7'));var querystring=require(_0x66f9('0xb'));var Papa=require(_0x66f9('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x66f9('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x66f9('0xe'))(_0x66f9('0xf'));var utils=require(_0x66f9('0x10'));var config=require(_0x66f9('0x11'));var licenseUtil=require(_0x66f9('0x12'));var db=require(_0x66f9('0x13'))['db'];function respondWithStatusCode(_0x53e6ac,_0x4480f2){_0x4480f2=_0x4480f2||0xcc;return function(_0x2d9663){if(_0x2d9663){return _0x53e6ac[_0x66f9('0x14')](_0x4480f2);}return _0x53e6ac[_0x66f9('0x15')](_0x4480f2)[_0x66f9('0x16')]();};}function respondWithResult(_0x60753a,_0x1b346a){_0x1b346a=_0x1b346a||0xc8;return function(_0x5dffce){if(_0x5dffce){return _0x60753a['status'](_0x1b346a)[_0x66f9('0x17')](_0x5dffce);}};}function respondWithFilteredResult(_0x46e316,_0x3f326e){return function(_0x229b67){if(_0x229b67){var _0x55aea6=_0x229b67[_0x66f9('0x18')],_0x134c43=_0x3f326e[_0x66f9('0x19')],_0x326546=_0x3f326e[_0x66f9('0x19')]+_0x3f326e[_0x66f9('0x1a')],_0x2b1b11;if(_0x326546>=_0x55aea6){_0x326546=_0x55aea6;_0x2b1b11=0xc8;}else{_0x2b1b11=0xce;}_0x46e316[_0x66f9('0x15')](_0x2b1b11);return _0x46e316['set'](_0x66f9('0x1b'),_0x134c43+'-'+_0x326546+'/'+_0x55aea6)[_0x66f9('0x17')](_0x229b67);}return null;};}function patchUpdates(_0x9ca88){return function(_0x2b1cfd){try{jsonpatch[_0x66f9('0x1c')](_0x2b1cfd,_0x9ca88,!![]);}catch(_0x463802){return BPromise['reject'](_0x463802);}return _0x2b1cfd[_0x66f9('0x1d')]();};}function saveUpdates(_0x8f1382,_0x381044){return function(_0x597fac){if(_0x597fac){return _0x597fac['update'](_0x8f1382)['then'](function(_0x43c807){return _0x43c807;});}return null;};}function removeEntity(_0x58d970,_0x4e634e){return function(_0x178c27){if(_0x178c27){return _0x178c27[_0x66f9('0x1e')]()[_0x66f9('0x1f')](function(){_0x58d970['status'](0xcc)[_0x66f9('0x16')]();});}};}function handleEntityNotFound(_0x1de35e,_0x3370ff){return function(_0x4c458d){if(!_0x4c458d){_0x1de35e[_0x66f9('0x14')](0x194);}return _0x4c458d;};}function handleError(_0x274b32,_0x21e286){_0x21e286=_0x21e286||0x1f4;return function(_0x1732d8){logger[_0x66f9('0x20')](_0x1732d8['stack']);if(_0x1732d8[_0x66f9('0x21')]){delete _0x1732d8[_0x66f9('0x21')];}_0x274b32['status'](_0x21e286)[_0x66f9('0x22')](_0x1732d8);};}exports[_0x66f9('0x23')]=function(_0x2cb17c,_0x278114){var _0x54d96c={},_0x398e44={},_0x548a11={'count':0x0,'rows':[]};var _0x3fafbe=_[_0x66f9('0x24')](db[_0x66f9('0x25')][_0x66f9('0x26')],function(_0x1779fd){return{'name':_0x1779fd['fieldName'],'type':_0x1779fd[_0x66f9('0x27')][_0x66f9('0x28')]};});_0x398e44[_0x66f9('0x29')]=_[_0x66f9('0x24')](_0x3fafbe,'name');_0x398e44[_0x66f9('0x2a')]=_[_0x66f9('0x2b')](_0x2cb17c['query']);_0x398e44['filters']=_[_0x66f9('0x2c')](_0x398e44[_0x66f9('0x29')],_0x398e44['query']);_0x54d96c[_0x66f9('0x2d')]=_[_0x66f9('0x2c')](_0x398e44[_0x66f9('0x29')],qs['fields'](_0x2cb17c[_0x66f9('0x2a')][_0x66f9('0x2e')]));_0x54d96c[_0x66f9('0x2d')]=_0x54d96c[_0x66f9('0x2d')]['length']?_0x54d96c[_0x66f9('0x2d')]:_0x398e44[_0x66f9('0x29')];if(!_0x2cb17c['query']['hasOwnProperty'](_0x66f9('0x2f'))){_0x54d96c[_0x66f9('0x1a')]=qs[_0x66f9('0x1a')](_0x2cb17c[_0x66f9('0x2a')][_0x66f9('0x1a')]);_0x54d96c[_0x66f9('0x19')]=qs[_0x66f9('0x19')](_0x2cb17c[_0x66f9('0x2a')]['offset']);}_0x54d96c[_0x66f9('0x30')]=qs[_0x66f9('0x31')](_0x2cb17c[_0x66f9('0x2a')][_0x66f9('0x31')]);_0x54d96c[_0x66f9('0x32')]=qs[_0x66f9('0x33')](_[_0x66f9('0x34')](_0x2cb17c['query'],_0x398e44[_0x66f9('0x33')]),_0x3fafbe);if(_0x2cb17c['query']['filter']){_0x54d96c['where']=_[_0x66f9('0x35')](_0x54d96c[_0x66f9('0x32')],{'$or':_[_0x66f9('0x24')](_0x3fafbe,function(_0x46d4dc){if(_0x46d4dc['type']!==_0x66f9('0x36')){var _0xb9f16c={};_0xb9f16c[_0x46d4dc[_0x66f9('0x21')]]={'$like':'%'+_0x2cb17c[_0x66f9('0x2a')][_0x66f9('0x37')]+'%'};return _0xb9f16c;}})});}_0x54d96c=_[_0x66f9('0x35')]({},_0x54d96c,_0x2cb17c[_0x66f9('0x38')]);var _0x9fe050={'where':_0x54d96c['where']};return db[_0x66f9('0x25')][_0x66f9('0x18')](_0x9fe050)[_0x66f9('0x1f')](function(_0x447a0b){_0x548a11[_0x66f9('0x18')]=_0x447a0b;if(_0x2cb17c['query']['includeAll']){_0x54d96c['include']=[{'all':!![]}];}return db[_0x66f9('0x25')][_0x66f9('0x39')](_0x54d96c);})[_0x66f9('0x1f')](function(_0x1cc74e){_0x548a11[_0x66f9('0x3a')]=_0x1cc74e;return _0x548a11;})[_0x66f9('0x1f')](respondWithFilteredResult(_0x278114,_0x54d96c))[_0x66f9('0x3b')](handleError(_0x278114,null));};exports['show']=function(_0x89d0c4,_0xb2a6e7){var _0x572a4d={'raw':!![],'where':{'id':_0x89d0c4[_0x66f9('0x3c')]['id']}},_0x44bcad={};_0x44bcad[_0x66f9('0x29')]=_[_0x66f9('0x2b')](db['MailTransferReport'][_0x66f9('0x26')]);_0x44bcad['query']=_[_0x66f9('0x2b')](_0x89d0c4[_0x66f9('0x2a')]);_0x44bcad[_0x66f9('0x33')]=_[_0x66f9('0x2c')](_0x44bcad[_0x66f9('0x29')],_0x44bcad[_0x66f9('0x2a')]);_0x572a4d['attributes']=_[_0x66f9('0x2c')](_0x44bcad[_0x66f9('0x29')],qs[_0x66f9('0x2e')](_0x89d0c4[_0x66f9('0x2a')][_0x66f9('0x2e')]));_0x572a4d['attributes']=_0x572a4d[_0x66f9('0x2d')][_0x66f9('0x3d')]?_0x572a4d['attributes']:_0x44bcad[_0x66f9('0x29')];if(_0x89d0c4[_0x66f9('0x2a')][_0x66f9('0x3e')]){_0x572a4d[_0x66f9('0x3f')]=[{'all':!![]}];}_0x572a4d=_['merge']({},_0x572a4d,_0x89d0c4['options']);return db[_0x66f9('0x25')][_0x66f9('0x40')](_0x572a4d)[_0x66f9('0x1f')](handleEntityNotFound(_0xb2a6e7,null))[_0x66f9('0x1f')](respondWithResult(_0xb2a6e7,null))[_0x66f9('0x3b')](handleError(_0xb2a6e7,null));};exports[_0x66f9('0x41')]=function(_0x560d0b,_0x542d92){return db[_0x66f9('0x25')][_0x66f9('0x41')](_0x560d0b[_0x66f9('0x42')],{})[_0x66f9('0x1f')](respondWithResult(_0x542d92,0xc9))[_0x66f9('0x3b')](handleError(_0x542d92,null));};exports[_0x66f9('0x43')]=function(_0x2db340,_0x294df7){if(_0x2db340['body']['id']){delete _0x2db340['body']['id'];}return db[_0x66f9('0x25')][_0x66f9('0x40')]({'where':{'id':_0x2db340[_0x66f9('0x3c')]['id']}})[_0x66f9('0x1f')](handleEntityNotFound(_0x294df7,null))['then'](saveUpdates(_0x2db340[_0x66f9('0x42')],null))['then'](respondWithResult(_0x294df7,null))[_0x66f9('0x3b')](handleError(_0x294df7,null));};exports[_0x66f9('0x1e')]=function(_0x415a66,_0x2125d3){return db[_0x66f9('0x25')][_0x66f9('0x40')]({'where':{'id':_0x415a66[_0x66f9('0x3c')]['id']}})[_0x66f9('0x1f')](handleEntityNotFound(_0x2125d3,null))[_0x66f9('0x1f')](removeEntity(_0x2125d3,null))['catch'](handleError(_0x2125d3,null));};exports[_0x66f9('0x44')]=function(_0x1b4629,_0x5ae0e3){return db[_0x66f9('0x25')][_0x66f9('0x44')]()[_0x66f9('0x1f')](respondWithResult(_0x5ae0e3,null))[_0x66f9('0x3b')](handleError(_0x5ae0e3,null));};
\ No newline at end of file