Built motion from commit (unavailable).|2.5.20
[motion2.git] / server / api / mailSubstatus / mailSubstatus.controller.js
index 53a630e..32b875a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb401=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailSubstatus','includeAll','include','rows','show','find','catch','create','body','params','describe','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x52b48a,_0x4be672){var _0x234d06=function(_0x4c9e33){while(--_0x4c9e33){_0x52b48a['push'](_0x52b48a['shift']());}};_0x234d06(++_0x4be672);}(_0xb401,0x108));var _0x1b40=function(_0x481299,_0x43b7a1){_0x481299=_0x481299-0x0;var _0x380b8a=_0xb401[_0x481299];return _0x380b8a;};'use strict';var pdf=require(_0x1b40('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b40('0x1'));var moment=require(_0x1b40('0x2'));var BPromise=require(_0x1b40('0x3'));var Mustache=require(_0x1b40('0x4'));var util=require(_0x1b40('0x5'));var path=require(_0x1b40('0x6'));var sox=require(_0x1b40('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b40('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1b40('0x9'));var toCsv=require(_0x1b40('0xa'));var querystring=require(_0x1b40('0xb'));var Papa=require(_0x1b40('0xc'));var Redis=require(_0x1b40('0xd'));var authService=require(_0x1b40('0xe'));var qs=require(_0x1b40('0xf'));var as=require(_0x1b40('0x10'));var hardwareService=require(_0x1b40('0x11'));var logger=require(_0x1b40('0x12'))(_0x1b40('0x13'));var utils=require('../../config/utils');var config=require(_0x1b40('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b40('0x15'))['db'];function respondWithStatusCode(_0x443875,_0x2fb716){_0x2fb716=_0x2fb716||0xcc;return function(_0x380915){if(_0x380915){return _0x443875['sendStatus'](_0x2fb716);}return _0x443875[_0x1b40('0x16')](_0x2fb716)[_0x1b40('0x17')]();};}function respondWithResult(_0x2a32f6,_0x1733ed){_0x1733ed=_0x1733ed||0xc8;return function(_0x4acb54){if(_0x4acb54){return _0x2a32f6[_0x1b40('0x16')](_0x1733ed)[_0x1b40('0x18')](_0x4acb54);}};}function respondWithFilteredResult(_0x321568,_0xcf121c){return function(_0x377761){if(_0x377761){var _0x41d15f=_0x377761[_0x1b40('0x19')],_0x21cced=_0xcf121c['offset'],_0x30d28e=_0xcf121c[_0x1b40('0x1a')]+_0xcf121c[_0x1b40('0x1b')],_0x322a05;if(_0x30d28e>=_0x41d15f){_0x30d28e=_0x41d15f;_0x322a05=0xc8;}else{_0x322a05=0xce;}_0x321568[_0x1b40('0x16')](_0x322a05);return _0x321568[_0x1b40('0x1c')]('Content-Range',_0x21cced+'-'+_0x30d28e+'/'+_0x41d15f)[_0x1b40('0x18')](_0x377761);}return null;};}function patchUpdates(_0x5a9e44){return function(_0x5281df){try{jsonpatch[_0x1b40('0x1d')](_0x5281df,_0x5a9e44,!![]);}catch(_0xe55a45){return BPromise['reject'](_0xe55a45);}return _0x5281df['save']();};}function saveUpdates(_0x5ad99c,_0x376bdd){return function(_0x1e0600){if(_0x1e0600){return _0x1e0600['update'](_0x5ad99c)[_0x1b40('0x1e')](function(_0x13867){return _0x13867;});}return null;};}function removeEntity(_0x55f045,_0x21a6d4){return function(_0x22c9ec){if(_0x22c9ec){return _0x22c9ec[_0x1b40('0x1f')]()[_0x1b40('0x1e')](function(){_0x55f045['status'](0xcc)[_0x1b40('0x17')]();});}};}function handleEntityNotFound(_0x27f3f9,_0x55db95){return function(_0x262cc5){if(!_0x262cc5){_0x27f3f9[_0x1b40('0x20')](0x194);}return _0x262cc5;};}function handleError(_0x1b7bd4,_0x294da8){_0x294da8=_0x294da8||0x1f4;return function(_0x120a3f){logger[_0x1b40('0x21')](_0x120a3f['stack']);if(_0x120a3f[_0x1b40('0x22')]){delete _0x120a3f[_0x1b40('0x22')];}_0x1b7bd4[_0x1b40('0x16')](_0x294da8)[_0x1b40('0x23')](_0x120a3f);};}exports[_0x1b40('0x24')]=function(_0x18f8a2,_0x745cf6){var _0x217e2d={},_0x2786a5={},_0xa21c8c={'count':0x0,'rows':[]};var _0x2ae008=_[_0x1b40('0x25')](db['MailSubstatus'][_0x1b40('0x26')],function(_0x21cbc7){return{'name':_0x21cbc7[_0x1b40('0x27')],'type':_0x21cbc7[_0x1b40('0x28')][_0x1b40('0x29')]};});_0x2786a5['model']=_[_0x1b40('0x25')](_0x2ae008,_0x1b40('0x22'));_0x2786a5[_0x1b40('0x2a')]=_[_0x1b40('0x2b')](_0x18f8a2[_0x1b40('0x2a')]);_0x2786a5[_0x1b40('0x2c')]=_['intersection'](_0x2786a5[_0x1b40('0x2d')],_0x2786a5[_0x1b40('0x2a')]);_0x217e2d[_0x1b40('0x2e')]=_[_0x1b40('0x2f')](_0x2786a5[_0x1b40('0x2d')],qs[_0x1b40('0x30')](_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x30')]));_0x217e2d['attributes']=_0x217e2d[_0x1b40('0x2e')][_0x1b40('0x31')]?_0x217e2d['attributes']:_0x2786a5[_0x1b40('0x2d')];if(!_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x32')](_0x1b40('0x33'))){_0x217e2d[_0x1b40('0x1b')]=qs[_0x1b40('0x1b')](_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x1b')]);_0x217e2d[_0x1b40('0x1a')]=qs[_0x1b40('0x1a')](_0x18f8a2['query'][_0x1b40('0x1a')]);}_0x217e2d[_0x1b40('0x34')]=qs['sort'](_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x35')]);_0x217e2d[_0x1b40('0x36')]=qs[_0x1b40('0x2c')](_[_0x1b40('0x37')](_0x18f8a2['query'],_0x2786a5[_0x1b40('0x2c')]),_0x2ae008);if(_0x18f8a2['query'][_0x1b40('0x38')]){_0x217e2d[_0x1b40('0x36')]=_[_0x1b40('0x39')](_0x217e2d[_0x1b40('0x36')],{'$or':_[_0x1b40('0x25')](_0x2ae008,function(_0x4de175){if(_0x4de175[_0x1b40('0x28')]!==_0x1b40('0x3a')){var _0x4b2e99={};_0x4b2e99[_0x4de175[_0x1b40('0x22')]]={'$like':'%'+_0x18f8a2['query'][_0x1b40('0x38')]+'%'};return _0x4b2e99;}})});}_0x217e2d=_[_0x1b40('0x39')]({},_0x217e2d,_0x18f8a2['options']);var _0x1f0e74={'where':_0x217e2d[_0x1b40('0x36')]};return db[_0x1b40('0x3b')][_0x1b40('0x19')](_0x1f0e74)[_0x1b40('0x1e')](function(_0x10aa8f){_0xa21c8c[_0x1b40('0x19')]=_0x10aa8f;if(_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x3c')]){_0x217e2d[_0x1b40('0x3d')]=[{'all':!![]}];}return db[_0x1b40('0x3b')]['findAll'](_0x217e2d);})[_0x1b40('0x1e')](function(_0x2ffb1e){_0xa21c8c[_0x1b40('0x3e')]=_0x2ffb1e;return _0xa21c8c;})['then'](respondWithFilteredResult(_0x745cf6,_0x217e2d))['catch'](handleError(_0x745cf6,null));};exports[_0x1b40('0x3f')]=function(_0x4edbaf,_0x1f6dc7){var _0xe3fddd={'raw':!![],'where':{'id':_0x4edbaf['params']['id']}},_0x4a01c4={};_0x4a01c4['model']=_['keys'](db[_0x1b40('0x3b')][_0x1b40('0x26')]);_0x4a01c4[_0x1b40('0x2a')]=_[_0x1b40('0x2b')](_0x4edbaf['query']);_0x4a01c4[_0x1b40('0x2c')]=_['intersection'](_0x4a01c4[_0x1b40('0x2d')],_0x4a01c4[_0x1b40('0x2a')]);_0xe3fddd[_0x1b40('0x2e')]=_[_0x1b40('0x2f')](_0x4a01c4['model'],qs[_0x1b40('0x30')](_0x4edbaf['query'][_0x1b40('0x30')]));_0xe3fddd[_0x1b40('0x2e')]=_0xe3fddd['attributes']['length']?_0xe3fddd['attributes']:_0x4a01c4[_0x1b40('0x2d')];if(_0x4edbaf['query']['includeAll']){_0xe3fddd[_0x1b40('0x3d')]=[{'all':!![]}];}_0xe3fddd=_[_0x1b40('0x39')]({},_0xe3fddd,_0x4edbaf['options']);return db['MailSubstatus'][_0x1b40('0x40')](_0xe3fddd)[_0x1b40('0x1e')](handleEntityNotFound(_0x1f6dc7,null))['then'](respondWithResult(_0x1f6dc7,null))[_0x1b40('0x41')](handleError(_0x1f6dc7,null));};exports[_0x1b40('0x42')]=function(_0x282a50,_0x458ee4){return db['MailSubstatus'][_0x1b40('0x42')](_0x282a50[_0x1b40('0x43')],{})['then'](respondWithResult(_0x458ee4,0xc9))['catch'](handleError(_0x458ee4,null));};exports['update']=function(_0x4d9593,_0xb83e57){if(_0x4d9593['body']['id']){delete _0x4d9593[_0x1b40('0x43')]['id'];}return db[_0x1b40('0x3b')][_0x1b40('0x40')]({'where':{'id':_0x4d9593[_0x1b40('0x44')]['id']}})[_0x1b40('0x1e')](handleEntityNotFound(_0xb83e57,null))[_0x1b40('0x1e')](saveUpdates(_0x4d9593['body'],null))[_0x1b40('0x1e')](respondWithResult(_0xb83e57,null))['catch'](handleError(_0xb83e57,null));};exports[_0x1b40('0x1f')]=function(_0x4cf808,_0x21b4f0){return db[_0x1b40('0x3b')]['find']({'where':{'id':_0x4cf808[_0x1b40('0x44')]['id']}})[_0x1b40('0x1e')](handleEntityNotFound(_0x21b4f0,null))[_0x1b40('0x1e')](removeEntity(_0x21b4f0,null))[_0x1b40('0x41')](handleError(_0x21b4f0,null));};exports['describe']=function(_0x329ed2,_0x349943){return db['MailSubstatus'][_0x1b40('0x45')]()[_0x1b40('0x1e')](respondWithResult(_0x349943,null))[_0x1b40('0x41')](handleError(_0x349943,null));};
\ No newline at end of file
+var _0x37cb=['params','include','find','create','update','body','catch','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show'];(function(_0x52407f,_0x3a57d2){var _0x5663e7=function(_0x50170e){while(--_0x50170e){_0x52407f['push'](_0x52407f['shift']());}};_0x5663e7(++_0x3a57d2);}(_0x37cb,0x1b8));var _0xb37c=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x37cb[_0x45b034];return _0x509cb0;};'use strict';var pdf=require(_0xb37c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb37c('0x1'));var jsonpatch=require(_0xb37c('0x2'));var rp=require('request-promise');var moment=require(_0xb37c('0x3'));var BPromise=require(_0xb37c('0x4'));var Mustache=require(_0xb37c('0x5'));var util=require(_0xb37c('0x6'));var path=require(_0xb37c('0x7'));var sox=require(_0xb37c('0x8'));var csv=require(_0xb37c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb37c('0xa'));var squel=require(_0xb37c('0xb'));var crypto=require(_0xb37c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb37c('0xd'));var toCsv=require(_0xb37c('0x9'));var querystring=require(_0xb37c('0xe'));var Papa=require(_0xb37c('0xf'));var Redis=require(_0xb37c('0x10'));var authService=require(_0xb37c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb37c('0x12'));var hardwareService=require(_0xb37c('0x13'));var logger=require(_0xb37c('0x14'))('api');var utils=require(_0xb37c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb37c('0x16'));var db=require(_0xb37c('0x17'))['db'];function respondWithStatusCode(_0x2f1b53,_0x2bf283){_0x2bf283=_0x2bf283||0xcc;return function(_0x572ab8){if(_0x572ab8){return _0x2f1b53[_0xb37c('0x18')](_0x2bf283);}return _0x2f1b53[_0xb37c('0x19')](_0x2bf283)[_0xb37c('0x1a')]();};}function respondWithResult(_0x4f8732,_0x327087){_0x327087=_0x327087||0xc8;return function(_0x56a335){if(_0x56a335){return _0x4f8732['status'](_0x327087)[_0xb37c('0x1b')](_0x56a335);}};}function respondWithFilteredResult(_0x2a394e,_0x550c15){return function(_0x14e5af){if(_0x14e5af){var _0x50bb57=_0x14e5af[_0xb37c('0x1c')],_0x43bcf3=_0x550c15[_0xb37c('0x1d')],_0x2c45d9=_0x550c15[_0xb37c('0x1d')]+_0x550c15[_0xb37c('0x1e')],_0x41df08;if(_0x2c45d9>=_0x50bb57){_0x2c45d9=_0x50bb57;_0x41df08=0xc8;}else{_0x41df08=0xce;}_0x2a394e[_0xb37c('0x19')](_0x41df08);return _0x2a394e[_0xb37c('0x1f')](_0xb37c('0x20'),_0x43bcf3+'-'+_0x2c45d9+'/'+_0x50bb57)[_0xb37c('0x1b')](_0x14e5af);}return null;};}function patchUpdates(_0x2b933e){return function(_0x519621){try{jsonpatch[_0xb37c('0x21')](_0x519621,_0x2b933e,!![]);}catch(_0x235588){return BPromise['reject'](_0x235588);}return _0x519621[_0xb37c('0x22')]();};}function saveUpdates(_0x2934ba,_0x1067bc){return function(_0x182118){if(_0x182118){return _0x182118['update'](_0x2934ba)[_0xb37c('0x23')](function(_0x147e68){return _0x147e68;});}return null;};}function removeEntity(_0x22fffc,_0xd66193){return function(_0x56da6c){if(_0x56da6c){return _0x56da6c[_0xb37c('0x24')]()[_0xb37c('0x23')](function(){_0x22fffc[_0xb37c('0x19')](0xcc)[_0xb37c('0x1a')]();});}};}function handleEntityNotFound(_0x2f072e,_0xc89b){return function(_0x570bf0){if(!_0x570bf0){_0x2f072e[_0xb37c('0x18')](0x194);}return _0x570bf0;};}function handleError(_0x13e1ce,_0x3970f5){_0x3970f5=_0x3970f5||0x1f4;return function(_0x4f6a03){logger['error'](_0x4f6a03[_0xb37c('0x25')]);if(_0x4f6a03[_0xb37c('0x26')]){delete _0x4f6a03[_0xb37c('0x26')];}_0x13e1ce[_0xb37c('0x19')](_0x3970f5)['send'](_0x4f6a03);};}exports[_0xb37c('0x27')]=function(_0x129914,_0x2596ff){var _0x49968d={},_0x41cb44={},_0x24ab0d={'count':0x0,'rows':[]};var _0x81a9a0=_[_0xb37c('0x28')](db[_0xb37c('0x29')][_0xb37c('0x2a')],function(_0x2d5b70){return{'name':_0x2d5b70[_0xb37c('0x2b')],'type':_0x2d5b70['type'][_0xb37c('0x2c')]};});_0x41cb44[_0xb37c('0x2d')]=_['map'](_0x81a9a0,_0xb37c('0x26'));_0x41cb44['query']=_[_0xb37c('0x2e')](_0x129914[_0xb37c('0x2f')]);_0x41cb44[_0xb37c('0x30')]=_[_0xb37c('0x31')](_0x41cb44[_0xb37c('0x2d')],_0x41cb44[_0xb37c('0x2f')]);_0x49968d[_0xb37c('0x32')]=_[_0xb37c('0x31')](_0x41cb44[_0xb37c('0x2d')],qs[_0xb37c('0x33')](_0x129914[_0xb37c('0x2f')][_0xb37c('0x33')]));_0x49968d['attributes']=_0x49968d[_0xb37c('0x32')][_0xb37c('0x34')]?_0x49968d[_0xb37c('0x32')]:_0x41cb44['model'];if(!_0x129914['query']['hasOwnProperty']('nolimit')){_0x49968d['limit']=qs['limit'](_0x129914[_0xb37c('0x2f')][_0xb37c('0x1e')]);_0x49968d[_0xb37c('0x1d')]=qs['offset'](_0x129914['query'][_0xb37c('0x1d')]);}_0x49968d[_0xb37c('0x35')]=qs[_0xb37c('0x36')](_0x129914[_0xb37c('0x2f')][_0xb37c('0x36')]);_0x49968d[_0xb37c('0x37')]=qs['filters'](_['pick'](_0x129914[_0xb37c('0x2f')],_0x41cb44[_0xb37c('0x30')]),_0x81a9a0);if(_0x129914['query'][_0xb37c('0x38')]){_0x49968d[_0xb37c('0x37')]=_[_0xb37c('0x39')](_0x49968d[_0xb37c('0x37')],{'$or':_['map'](_0x81a9a0,function(_0x2eb55a){if(_0x2eb55a['type']!==_0xb37c('0x3a')){var _0x4eaf0b={};_0x4eaf0b[_0x2eb55a[_0xb37c('0x26')]]={'$like':'%'+_0x129914[_0xb37c('0x2f')][_0xb37c('0x38')]+'%'};return _0x4eaf0b;}})});}_0x49968d=_[_0xb37c('0x39')]({},_0x49968d,_0x129914[_0xb37c('0x3b')]);var _0xfe008a={'where':_0x49968d['where']};return db['MailSubstatus'][_0xb37c('0x1c')](_0xfe008a)[_0xb37c('0x23')](function(_0x6bd8de){_0x24ab0d[_0xb37c('0x1c')]=_0x6bd8de;if(_0x129914[_0xb37c('0x2f')][_0xb37c('0x3c')]){_0x49968d['include']=[{'all':!![]}];}return db[_0xb37c('0x29')][_0xb37c('0x3d')](_0x49968d);})[_0xb37c('0x23')](function(_0x237b0c){_0x24ab0d[_0xb37c('0x3e')]=_0x237b0c;return _0x24ab0d;})[_0xb37c('0x23')](respondWithFilteredResult(_0x2596ff,_0x49968d))['catch'](handleError(_0x2596ff,null));};exports[_0xb37c('0x3f')]=function(_0x28c314,_0x470959){var _0xcd48fe={'raw':!![],'where':{'id':_0x28c314[_0xb37c('0x40')]['id']}},_0x19174c={};_0x19174c[_0xb37c('0x2d')]=_[_0xb37c('0x2e')](db['MailSubstatus'][_0xb37c('0x2a')]);_0x19174c[_0xb37c('0x2f')]=_[_0xb37c('0x2e')](_0x28c314[_0xb37c('0x2f')]);_0x19174c[_0xb37c('0x30')]=_[_0xb37c('0x31')](_0x19174c[_0xb37c('0x2d')],_0x19174c['query']);_0xcd48fe[_0xb37c('0x32')]=_[_0xb37c('0x31')](_0x19174c[_0xb37c('0x2d')],qs['fields'](_0x28c314[_0xb37c('0x2f')][_0xb37c('0x33')]));_0xcd48fe[_0xb37c('0x32')]=_0xcd48fe[_0xb37c('0x32')]['length']?_0xcd48fe[_0xb37c('0x32')]:_0x19174c['model'];if(_0x28c314['query'][_0xb37c('0x3c')]){_0xcd48fe[_0xb37c('0x41')]=[{'all':!![]}];}_0xcd48fe=_['merge']({},_0xcd48fe,_0x28c314[_0xb37c('0x3b')]);return db[_0xb37c('0x29')][_0xb37c('0x42')](_0xcd48fe)['then'](handleEntityNotFound(_0x470959,null))[_0xb37c('0x23')](respondWithResult(_0x470959,null))['catch'](handleError(_0x470959,null));};exports[_0xb37c('0x43')]=function(_0x4d22cd,_0x2201b3){return db['MailSubstatus']['create'](_0x4d22cd['body'],{})['then'](respondWithResult(_0x2201b3,0xc9))['catch'](handleError(_0x2201b3,null));};exports[_0xb37c('0x44')]=function(_0x3672bb,_0x3883c){if(_0x3672bb[_0xb37c('0x45')]['id']){delete _0x3672bb[_0xb37c('0x45')]['id'];}return db[_0xb37c('0x29')][_0xb37c('0x42')]({'where':{'id':_0x3672bb['params']['id']}})[_0xb37c('0x23')](handleEntityNotFound(_0x3883c,null))[_0xb37c('0x23')](saveUpdates(_0x3672bb[_0xb37c('0x45')],null))[_0xb37c('0x23')](respondWithResult(_0x3883c,null))[_0xb37c('0x46')](handleError(_0x3883c,null));};exports['destroy']=function(_0x379468,_0x58a988){return db[_0xb37c('0x29')][_0xb37c('0x42')]({'where':{'id':_0x379468['params']['id']}})['then'](handleEntityNotFound(_0x58a988,null))[_0xb37c('0x23')](removeEntity(_0x58a988,null))[_0xb37c('0x46')](handleError(_0x58a988,null));};exports[_0xb37c('0x47')]=function(_0x4178e2,_0x283c7c){return db['MailSubstatus'][_0xb37c('0x47')]()[_0xb37c('0x23')](respondWithResult(_0x283c7c,null))[_0xb37c('0x46')](handleError(_0x283c7c,null));};
\ No newline at end of file