Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / faxQueueReport / faxQueueReport.controller.js
index 9f578cb..114caa7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf351=['where','VIRTUAL','filter','merge','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find','describe','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','FaxQueueReport','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x555e35,_0x205cc1){var _0x35b56a=function(_0x469cb4){while(--_0x469cb4){_0x555e35['push'](_0x555e35['shift']());}};_0x35b56a(++_0x205cc1);}(_0xf351,0x9c));var _0x1f35=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xf351[_0xcfd89f];return _0x59acd4;};'use strict';var pdf=require(_0x1f35('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f35('0x1'));var rp=require(_0x1f35('0x2'));var moment=require(_0x1f35('0x3'));var BPromise=require(_0x1f35('0x4'));var Mustache=require(_0x1f35('0x5'));var util=require(_0x1f35('0x6'));var path=require(_0x1f35('0x7'));var sox=require('sox');var csv=require(_0x1f35('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1f35('0x9'));var crypto=require(_0x1f35('0xa'));var jsforce=require(_0x1f35('0xb'));var deskjs=require(_0x1f35('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1f35('0xd'));var Papa=require('papaparse');var Redis=require(_0x1f35('0xe'));var authService=require(_0x1f35('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1f35('0x10'));var hardwareService=require(_0x1f35('0x11'));var logger=require(_0x1f35('0x12'))(_0x1f35('0x13'));var utils=require(_0x1f35('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1f35('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca2cb,_0x14d5dd){_0x14d5dd=_0x14d5dd||0xcc;return function(_0x472a97){if(_0x472a97){return _0x2ca2cb['sendStatus'](_0x14d5dd);}return _0x2ca2cb[_0x1f35('0x16')](_0x14d5dd)['end']();};}function respondWithResult(_0xc5e9b8,_0x57c69e){_0x57c69e=_0x57c69e||0xc8;return function(_0x1318c7){if(_0x1318c7){return _0xc5e9b8[_0x1f35('0x16')](_0x57c69e)['json'](_0x1318c7);}};}function respondWithFilteredResult(_0x12c650,_0x375d45){return function(_0x51c16c){if(_0x51c16c){var _0x51e563=_0x51c16c['count'],_0x5ac2ed=_0x375d45[_0x1f35('0x17')],_0x361488=_0x375d45[_0x1f35('0x17')]+_0x375d45[_0x1f35('0x18')],_0x412c50;if(_0x361488>=_0x51e563){_0x361488=_0x51e563;_0x412c50=0xc8;}else{_0x412c50=0xce;}_0x12c650['status'](_0x412c50);return _0x12c650[_0x1f35('0x19')](_0x1f35('0x1a'),_0x5ac2ed+'-'+_0x361488+'/'+_0x51e563)['json'](_0x51c16c);}return null;};}function patchUpdates(_0x539fe6){return function(_0x560ab1){try{jsonpatch[_0x1f35('0x1b')](_0x560ab1,_0x539fe6,!![]);}catch(_0x3cec83){return BPromise['reject'](_0x3cec83);}return _0x560ab1['save']();};}function saveUpdates(_0xd77343,_0x3ba638){return function(_0x1659ee){if(_0x1659ee){return _0x1659ee[_0x1f35('0x1c')](_0xd77343)[_0x1f35('0x1d')](function(_0x283ade){return _0x283ade;});}return null;};}function removeEntity(_0x52e1e1,_0x233246){return function(_0x4eed20){if(_0x4eed20){return _0x4eed20[_0x1f35('0x1e')]()[_0x1f35('0x1d')](function(){_0x52e1e1['status'](0xcc)[_0x1f35('0x1f')]();});}};}function handleEntityNotFound(_0x51fdac,_0x28639a){return function(_0x224f91){if(!_0x224f91){_0x51fdac['sendStatus'](0x194);}return _0x224f91;};}function handleError(_0x1741b6,_0x17d030){_0x17d030=_0x17d030||0x1f4;return function(_0x4a2e29){logger[_0x1f35('0x20')](_0x4a2e29[_0x1f35('0x21')]);if(_0x4a2e29['name']){delete _0x4a2e29[_0x1f35('0x22')];}_0x1741b6['status'](_0x17d030)[_0x1f35('0x23')](_0x4a2e29);};}exports[_0x1f35('0x24')]=function(_0x5123a8,_0x17ce5f){var _0x33c473={},_0x4fac96={},_0x4d78ab={'count':0x0,'rows':[]};var _0x4948a1=_[_0x1f35('0x25')](db[_0x1f35('0x26')]['rawAttributes'],function(_0x3006d4){return{'name':_0x3006d4['fieldName'],'type':_0x3006d4[_0x1f35('0x27')][_0x1f35('0x28')]};});_0x4fac96[_0x1f35('0x29')]=_[_0x1f35('0x25')](_0x4948a1,_0x1f35('0x22'));_0x4fac96[_0x1f35('0x2a')]=_['keys'](_0x5123a8[_0x1f35('0x2a')]);_0x4fac96[_0x1f35('0x2b')]=_[_0x1f35('0x2c')](_0x4fac96['model'],_0x4fac96[_0x1f35('0x2a')]);_0x33c473[_0x1f35('0x2d')]=_['intersection'](_0x4fac96[_0x1f35('0x29')],qs[_0x1f35('0x2e')](_0x5123a8[_0x1f35('0x2a')][_0x1f35('0x2e')]));_0x33c473['attributes']=_0x33c473[_0x1f35('0x2d')][_0x1f35('0x2f')]?_0x33c473['attributes']:_0x4fac96[_0x1f35('0x29')];if(!_0x5123a8[_0x1f35('0x2a')]['hasOwnProperty'](_0x1f35('0x30'))){_0x33c473[_0x1f35('0x18')]=qs[_0x1f35('0x18')](_0x5123a8[_0x1f35('0x2a')][_0x1f35('0x18')]);_0x33c473['offset']=qs[_0x1f35('0x17')](_0x5123a8[_0x1f35('0x2a')]['offset']);}_0x33c473[_0x1f35('0x31')]=qs[_0x1f35('0x32')](_0x5123a8[_0x1f35('0x2a')][_0x1f35('0x32')]);_0x33c473[_0x1f35('0x33')]=qs[_0x1f35('0x2b')](_['pick'](_0x5123a8['query'],_0x4fac96[_0x1f35('0x2b')]),_0x4948a1);if(_0x5123a8[_0x1f35('0x2a')]['filter']){_0x33c473[_0x1f35('0x33')]=_['merge'](_0x33c473[_0x1f35('0x33')],{'$or':_[_0x1f35('0x25')](_0x4948a1,function(_0x1cc6ca){if(_0x1cc6ca[_0x1f35('0x27')]!==_0x1f35('0x34')){var _0x5e8b0a={};_0x5e8b0a[_0x1cc6ca[_0x1f35('0x22')]]={'$like':'%'+_0x5123a8['query'][_0x1f35('0x35')]+'%'};return _0x5e8b0a;}})});}_0x33c473=_[_0x1f35('0x36')]({},_0x33c473,_0x5123a8['options']);var _0x5d6576={'where':_0x33c473[_0x1f35('0x33')]};return db[_0x1f35('0x26')][_0x1f35('0x37')](_0x5d6576)['then'](function(_0x338fae){_0x4d78ab[_0x1f35('0x37')]=_0x338fae;if(_0x5123a8[_0x1f35('0x2a')][_0x1f35('0x38')]){_0x33c473[_0x1f35('0x39')]=[{'all':!![]}];}return db[_0x1f35('0x26')][_0x1f35('0x3a')](_0x33c473);})[_0x1f35('0x1d')](function(_0x45ab90){_0x4d78ab[_0x1f35('0x3b')]=_0x45ab90;return _0x4d78ab;})['then'](respondWithFilteredResult(_0x17ce5f,_0x33c473))[_0x1f35('0x3c')](handleError(_0x17ce5f,null));};exports['show']=function(_0x40c07f,_0x33e9cb){var _0x122664={'raw':!![],'where':{'id':_0x40c07f[_0x1f35('0x3d')]['id']}},_0x837b13={};_0x837b13[_0x1f35('0x29')]=_[_0x1f35('0x3e')](db[_0x1f35('0x26')][_0x1f35('0x3f')]);_0x837b13['query']=_['keys'](_0x40c07f[_0x1f35('0x2a')]);_0x837b13[_0x1f35('0x2b')]=_['intersection'](_0x837b13[_0x1f35('0x29')],_0x837b13['query']);_0x122664[_0x1f35('0x2d')]=_[_0x1f35('0x2c')](_0x837b13['model'],qs[_0x1f35('0x2e')](_0x40c07f['query'][_0x1f35('0x2e')]));_0x122664['attributes']=_0x122664[_0x1f35('0x2d')]['length']?_0x122664['attributes']:_0x837b13[_0x1f35('0x29')];if(_0x40c07f[_0x1f35('0x2a')][_0x1f35('0x38')]){_0x122664['include']=[{'all':!![]}];}_0x122664=_[_0x1f35('0x36')]({},_0x122664,_0x40c07f[_0x1f35('0x40')]);return db[_0x1f35('0x26')]['find'](_0x122664)[_0x1f35('0x1d')](handleEntityNotFound(_0x33e9cb,null))['then'](respondWithResult(_0x33e9cb,null))[_0x1f35('0x3c')](handleError(_0x33e9cb,null));};exports[_0x1f35('0x41')]=function(_0x4d06bd,_0x51aeb5){return db[_0x1f35('0x26')][_0x1f35('0x41')](_0x4d06bd['body'],{})[_0x1f35('0x1d')](respondWithResult(_0x51aeb5,0xc9))[_0x1f35('0x3c')](handleError(_0x51aeb5,null));};exports[_0x1f35('0x1c')]=function(_0x169b26,_0x1def1f){if(_0x169b26[_0x1f35('0x42')]['id']){delete _0x169b26['body']['id'];}return db[_0x1f35('0x26')][_0x1f35('0x43')]({'where':{'id':_0x169b26[_0x1f35('0x3d')]['id']}})[_0x1f35('0x1d')](handleEntityNotFound(_0x1def1f,null))[_0x1f35('0x1d')](saveUpdates(_0x169b26[_0x1f35('0x42')],null))[_0x1f35('0x1d')](respondWithResult(_0x1def1f,null))['catch'](handleError(_0x1def1f,null));};exports[_0x1f35('0x1e')]=function(_0x25a0b6,_0x2f2d31){return db[_0x1f35('0x26')][_0x1f35('0x43')]({'where':{'id':_0x25a0b6['params']['id']}})[_0x1f35('0x1d')](handleEntityNotFound(_0x2f2d31,null))[_0x1f35('0x1d')](removeEntity(_0x2f2d31,null))[_0x1f35('0x3c')](handleError(_0x2f2d31,null));};exports[_0x1f35('0x44')]=function(_0x4a988b,_0x3ca7b7){return db[_0x1f35('0x26')][_0x1f35('0x44')]()[_0x1f35('0x1d')](respondWithResult(_0x3ca7b7,null))[_0x1f35('0x3c')](handleError(_0x3ca7b7,null));};
\ No newline at end of file
+var _0x765b=['attributes','order','sort','where','filter','merge','type','FaxQueueReport','include','rows','show','options','catch','create','body','find','params','describe','fast-json-patch','moment','mustache','util','path','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','name','send','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length'];(function(_0x4a3a71,_0x51afe3){var _0x2e0160=function(_0x32a0a8){while(--_0x32a0a8){_0x4a3a71['push'](_0x4a3a71['shift']());}};_0x2e0160(++_0x51afe3);}(_0x765b,0x18c));var _0xb765=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x765b[_0x57fa7e];return _0x320671;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb765('0x0'));var rp=require('request-promise');var moment=require(_0xb765('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb765('0x2'));var util=require(_0xb765('0x3'));var path=require(_0xb765('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb765('0x5'));var squel=require('squel');var crypto=require(_0xb765('0x6'));var jsforce=require(_0xb765('0x7'));var deskjs=require(_0xb765('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb765('0x9'));var Papa=require(_0xb765('0xa'));var Redis=require(_0xb765('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb765('0xc'));var logger=require(_0xb765('0xd'))(_0xb765('0xe'));var utils=require(_0xb765('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xb765('0x10'));var db=require(_0xb765('0x11'))['db'];function respondWithStatusCode(_0x157a3b,_0x3f9acb){_0x3f9acb=_0x3f9acb||0xcc;return function(_0x38ee06){if(_0x38ee06){return _0x157a3b[_0xb765('0x12')](_0x3f9acb);}return _0x157a3b[_0xb765('0x13')](_0x3f9acb)[_0xb765('0x14')]();};}function respondWithResult(_0x355f6e,_0x4d8eff){_0x4d8eff=_0x4d8eff||0xc8;return function(_0x2aebdb){if(_0x2aebdb){return _0x355f6e['status'](_0x4d8eff)[_0xb765('0x15')](_0x2aebdb);}};}function respondWithFilteredResult(_0x33958e,_0x4cecc1){return function(_0x4b8e26){if(_0x4b8e26){var _0x3f73f4=typeof _0x4cecc1[_0xb765('0x16')]===_0xb765('0x17')&&typeof _0x4cecc1[_0xb765('0x18')]===_0xb765('0x17');var _0x3b9a9b=_0x4b8e26[_0xb765('0x19')];var _0x395edc=_0x3f73f4?0x0:_0x4cecc1['offset'];var _0x3fd470=_0x3f73f4?_0x4b8e26[_0xb765('0x19')]:_0x4cecc1[_0xb765('0x16')]+_0x4cecc1[_0xb765('0x18')];var _0x711484;if(_0x3fd470>=_0x3b9a9b){_0x3fd470=_0x3b9a9b;_0x711484=0xc8;}else{_0x711484=0xce;}_0x33958e[_0xb765('0x13')](_0x711484);return _0x33958e[_0xb765('0x1a')](_0xb765('0x1b'),_0x395edc+'-'+_0x3fd470+'/'+_0x3b9a9b)[_0xb765('0x15')](_0x4b8e26);}return null;};}function patchUpdates(_0x3a1197){return function(_0x44936d){try{jsonpatch[_0xb765('0x1c')](_0x44936d,_0x3a1197,!![]);}catch(_0x5074ca){return BPromise['reject'](_0x5074ca);}return _0x44936d[_0xb765('0x1d')]();};}function saveUpdates(_0x5f4189,_0x3d69c7){return function(_0x2e0196){if(_0x2e0196){return _0x2e0196[_0xb765('0x1e')](_0x5f4189)['then'](function(_0x97b886){return _0x97b886;});}return null;};}function removeEntity(_0x1a740c,_0x5d1ea0){return function(_0x3a05b1){if(_0x3a05b1){return _0x3a05b1[_0xb765('0x1f')]()[_0xb765('0x20')](function(){_0x1a740c[_0xb765('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3735e3,_0x6a5457){return function(_0x4e12b8){if(!_0x4e12b8){_0x3735e3['sendStatus'](0x194);}return _0x4e12b8;};}function handleError(_0x2a38b6,_0x4715d7){_0x4715d7=_0x4715d7||0x1f4;return function(_0x1c561a){logger['error'](_0x1c561a['stack']);if(_0x1c561a['name']){delete _0x1c561a[_0xb765('0x21')];}_0x2a38b6[_0xb765('0x13')](_0x4715d7)[_0xb765('0x22')](_0x1c561a);};}exports['index']=function(_0xb41497,_0x3c7206){var _0x48a84a={},_0x2842c2={},_0xe9f0b9={'count':0x0,'rows':[]};var _0x439162=_['map'](db['FaxQueueReport'][_0xb765('0x23')],function(_0x42fc05){return{'name':_0x42fc05[_0xb765('0x24')],'type':_0x42fc05['type'][_0xb765('0x25')]};});_0x2842c2[_0xb765('0x26')]=_['map'](_0x439162,'name');_0x2842c2[_0xb765('0x27')]=_[_0xb765('0x28')](_0xb41497[_0xb765('0x27')]);_0x2842c2[_0xb765('0x29')]=_[_0xb765('0x2a')](_0x2842c2[_0xb765('0x26')],_0x2842c2[_0xb765('0x27')]);_0x48a84a['attributes']=_[_0xb765('0x2a')](_0x2842c2[_0xb765('0x26')],qs[_0xb765('0x2b')](_0xb41497[_0xb765('0x27')]['fields']));_0x48a84a['attributes']=_0x48a84a['attributes'][_0xb765('0x2c')]?_0x48a84a[_0xb765('0x2d')]:_0x2842c2['model'];if(!_0xb41497[_0xb765('0x27')]['hasOwnProperty']('nolimit')){_0x48a84a[_0xb765('0x18')]=qs[_0xb765('0x18')](_0xb41497['query'][_0xb765('0x18')]);_0x48a84a[_0xb765('0x16')]=qs['offset'](_0xb41497[_0xb765('0x27')][_0xb765('0x16')]);}_0x48a84a[_0xb765('0x2e')]=qs[_0xb765('0x2f')](_0xb41497[_0xb765('0x27')][_0xb765('0x2f')]);_0x48a84a[_0xb765('0x30')]=qs[_0xb765('0x29')](_['pick'](_0xb41497[_0xb765('0x27')],_0x2842c2[_0xb765('0x29')]),_0x439162);if(_0xb41497['query'][_0xb765('0x31')]){_0x48a84a['where']=_[_0xb765('0x32')](_0x48a84a[_0xb765('0x30')],{'$or':_['map'](_0x439162,function(_0x146237){if(_0x146237[_0xb765('0x33')]!=='VIRTUAL'){var _0x5b3d74={};_0x5b3d74[_0x146237[_0xb765('0x21')]]={'$like':'%'+_0xb41497[_0xb765('0x27')][_0xb765('0x31')]+'%'};return _0x5b3d74;}})});}_0x48a84a=_[_0xb765('0x32')]({},_0x48a84a,_0xb41497['options']);var _0x191daf={'where':_0x48a84a[_0xb765('0x30')]};return db[_0xb765('0x34')]['count'](_0x191daf)[_0xb765('0x20')](function(_0x17a2a3){_0xe9f0b9[_0xb765('0x19')]=_0x17a2a3;if(_0xb41497[_0xb765('0x27')]['includeAll']){_0x48a84a[_0xb765('0x35')]=[{'all':!![]}];}return db[_0xb765('0x34')]['findAll'](_0x48a84a);})[_0xb765('0x20')](function(_0x536651){_0xe9f0b9[_0xb765('0x36')]=_0x536651;return _0xe9f0b9;})['then'](respondWithFilteredResult(_0x3c7206,_0x48a84a))['catch'](handleError(_0x3c7206,null));};exports[_0xb765('0x37')]=function(_0x15077b,_0x542372){var _0x42a715={'raw':!![],'where':{'id':_0x15077b['params']['id']}},_0x516b98={};_0x516b98['model']=_['keys'](db[_0xb765('0x34')][_0xb765('0x23')]);_0x516b98[_0xb765('0x27')]=_[_0xb765('0x28')](_0x15077b[_0xb765('0x27')]);_0x516b98['filters']=_[_0xb765('0x2a')](_0x516b98[_0xb765('0x26')],_0x516b98['query']);_0x42a715[_0xb765('0x2d')]=_[_0xb765('0x2a')](_0x516b98['model'],qs[_0xb765('0x2b')](_0x15077b[_0xb765('0x27')][_0xb765('0x2b')]));_0x42a715[_0xb765('0x2d')]=_0x42a715[_0xb765('0x2d')][_0xb765('0x2c')]?_0x42a715[_0xb765('0x2d')]:_0x516b98[_0xb765('0x26')];if(_0x15077b[_0xb765('0x27')]['includeAll']){_0x42a715[_0xb765('0x35')]=[{'all':!![]}];}_0x42a715=_[_0xb765('0x32')]({},_0x42a715,_0x15077b[_0xb765('0x38')]);return db['FaxQueueReport']['find'](_0x42a715)[_0xb765('0x20')](handleEntityNotFound(_0x542372,null))['then'](respondWithResult(_0x542372,null))[_0xb765('0x39')](handleError(_0x542372,null));};exports[_0xb765('0x3a')]=function(_0x53ad7b,_0x12eff7){return db[_0xb765('0x34')][_0xb765('0x3a')](_0x53ad7b[_0xb765('0x3b')],{})[_0xb765('0x20')](respondWithResult(_0x12eff7,0xc9))[_0xb765('0x39')](handleError(_0x12eff7,null));};exports['update']=function(_0x188dbe,_0x2540fc){if(_0x188dbe[_0xb765('0x3b')]['id']){delete _0x188dbe[_0xb765('0x3b')]['id'];}return db[_0xb765('0x34')][_0xb765('0x3c')]({'where':{'id':_0x188dbe[_0xb765('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2540fc,null))[_0xb765('0x20')](saveUpdates(_0x188dbe['body'],null))[_0xb765('0x20')](respondWithResult(_0x2540fc,null))[_0xb765('0x39')](handleError(_0x2540fc,null));};exports[_0xb765('0x1f')]=function(_0x38752d,_0x5f37de){return db[_0xb765('0x34')]['find']({'where':{'id':_0x38752d[_0xb765('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5f37de,null))[_0xb765('0x20')](removeEntity(_0x5f37de,null))['catch'](handleError(_0x5f37de,null));};exports['describe']=function(_0x3170d4,_0x580a3d){return db[_0xb765('0x34')][_0xb765('0x3e')]()[_0xb765('0x20')](respondWithResult(_0x580a3d,null))[_0xb765('0x39')](handleError(_0x580a3d,null));};
\ No newline at end of file