Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / faxQueueReport / faxQueueReport.controller.js
index 09da570..114caa7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x780f=['fieldName','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','send','index','FaxQueueReport','rawAttributes'];(function(_0x45dbd6,_0x1ce09a){var _0x512bf7=function(_0x5844ea){while(--_0x5844ea){_0x45dbd6['push'](_0x45dbd6['shift']());}};_0x512bf7(++_0x1ce09a);}(_0x780f,0x6c));var _0xf780=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x780f[_0xc82d1a];return _0x32fad2;};'use strict';var emlformat=require(_0xf780('0x0'));var rimraf=require(_0xf780('0x1'));var zipdir=require(_0xf780('0x2'));var jsonpatch=require(_0xf780('0x3'));var rp=require(_0xf780('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf780('0x5'));var util=require(_0xf780('0x6'));var path=require(_0xf780('0x7'));var sox=require(_0xf780('0x8'));var csv=require('to-csv');var ejs=require(_0xf780('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf780('0xa'));var squel=require(_0xf780('0xb'));var crypto=require(_0xf780('0xc'));var jsforce=require(_0xf780('0xd'));var deskjs=require(_0xf780('0xe'));var toCsv=require(_0xf780('0xf'));var querystring=require('querystring');var Papa=require(_0xf780('0x10'));var Redis=require(_0xf780('0x11'));var authService=require(_0xf780('0x12'));var qs=require(_0xf780('0x13'));var as=require(_0xf780('0x14'));var hardwareService=require(_0xf780('0x15'));var logger=require(_0xf780('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf780('0x17'));var licenseUtil=require(_0xf780('0x18'));var db=require(_0xf780('0x19'))['db'];function respondWithStatusCode(_0x1a8520,_0x5f04e1){_0x5f04e1=_0x5f04e1||0xcc;return function(_0x24aa4f){if(_0x24aa4f){return _0x1a8520[_0xf780('0x1a')](_0x5f04e1);}return _0x1a8520[_0xf780('0x1b')](_0x5f04e1)[_0xf780('0x1c')]();};}function respondWithResult(_0x5c353b,_0x5a64bc){_0x5a64bc=_0x5a64bc||0xc8;return function(_0x4be599){if(_0x4be599){return _0x5c353b[_0xf780('0x1b')](_0x5a64bc)[_0xf780('0x1d')](_0x4be599);}};}function respondWithFilteredResult(_0xc1e872,_0x187b6d){return function(_0x206d34){if(_0x206d34){var _0x335ba6=typeof _0x187b6d[_0xf780('0x1e')]==='undefined'&&typeof _0x187b6d[_0xf780('0x1f')]===_0xf780('0x20');var _0xa78b1b=_0x206d34[_0xf780('0x21')];var _0x5d5a81=_0x335ba6?0x0:_0x187b6d[_0xf780('0x1e')];var _0x53dfee=_0x335ba6?_0x206d34[_0xf780('0x21')]:_0x187b6d[_0xf780('0x1e')]+_0x187b6d['limit'];var _0x29dae1;if(_0x53dfee>=_0xa78b1b){_0x53dfee=_0xa78b1b;_0x29dae1=0xc8;}else{_0x29dae1=0xce;}_0xc1e872[_0xf780('0x1b')](_0x29dae1);return _0xc1e872['set'](_0xf780('0x22'),_0x5d5a81+'-'+_0x53dfee+'/'+_0xa78b1b)[_0xf780('0x1d')](_0x206d34);}return null;};}function patchUpdates(_0x3c7054){return function(_0x4065bb){try{jsonpatch[_0xf780('0x23')](_0x4065bb,_0x3c7054,!![]);}catch(_0x147de9){return BPromise['reject'](_0x147de9);}return _0x4065bb[_0xf780('0x24')]();};}function saveUpdates(_0x4de546,_0x5853ea){return function(_0x45d80e){if(_0x45d80e){return _0x45d80e[_0xf780('0x25')](_0x4de546)[_0xf780('0x26')](function(_0x58bb66){return _0x58bb66;});}return null;};}function removeEntity(_0x2fcb2d,_0x373dce){return function(_0x4f59b1){if(_0x4f59b1){return _0x4f59b1[_0xf780('0x27')]()['then'](function(){_0x2fcb2d[_0xf780('0x1b')](0xcc)[_0xf780('0x1c')]();});}};}function handleEntityNotFound(_0x5d4053,_0x589208){return function(_0x3710bb){if(!_0x3710bb){_0x5d4053[_0xf780('0x1a')](0x194);}return _0x3710bb;};}function handleError(_0x462435,_0x40d9c9){_0x40d9c9=_0x40d9c9||0x1f4;return function(_0x458c76){logger[_0xf780('0x28')](_0x458c76[_0xf780('0x29')]);if(_0x458c76['name']){delete _0x458c76['name'];}_0x462435['status'](_0x40d9c9)[_0xf780('0x2a')](_0x458c76);};}exports[_0xf780('0x2b')]=function(_0x26452f,_0x4ef8c3){var _0x4ed256={},_0x36bc63={},_0x149190={'count':0x0,'rows':[]};var _0x2b832d=_['map'](db[_0xf780('0x2c')][_0xf780('0x2d')],function(_0x2368e3){return{'name':_0x2368e3[_0xf780('0x2e')],'type':_0x2368e3['type'][_0xf780('0x2f')]};});_0x36bc63['model']=_[_0xf780('0x30')](_0x2b832d,_0xf780('0x31'));_0x36bc63[_0xf780('0x32')]=_[_0xf780('0x33')](_0x26452f[_0xf780('0x32')]);_0x36bc63[_0xf780('0x34')]=_[_0xf780('0x35')](_0x36bc63[_0xf780('0x36')],_0x36bc63['query']);_0x4ed256[_0xf780('0x37')]=_[_0xf780('0x35')](_0x36bc63[_0xf780('0x36')],qs[_0xf780('0x38')](_0x26452f[_0xf780('0x32')]['fields']));_0x4ed256[_0xf780('0x37')]=_0x4ed256['attributes'][_0xf780('0x39')]?_0x4ed256[_0xf780('0x37')]:_0x36bc63[_0xf780('0x36')];if(!_0x26452f['query'][_0xf780('0x3a')](_0xf780('0x3b'))){_0x4ed256[_0xf780('0x1f')]=qs[_0xf780('0x1f')](_0x26452f['query'][_0xf780('0x1f')]);_0x4ed256['offset']=qs[_0xf780('0x1e')](_0x26452f['query']['offset']);}_0x4ed256[_0xf780('0x3c')]=qs['sort'](_0x26452f[_0xf780('0x32')][_0xf780('0x3d')]);_0x4ed256[_0xf780('0x3e')]=qs[_0xf780('0x34')](_['pick'](_0x26452f[_0xf780('0x32')],_0x36bc63[_0xf780('0x34')]),_0x2b832d);if(_0x26452f[_0xf780('0x32')][_0xf780('0x3f')]){_0x4ed256['where']=_[_0xf780('0x40')](_0x4ed256[_0xf780('0x3e')],{'$or':_[_0xf780('0x30')](_0x2b832d,function(_0xdac8ab){if(_0xdac8ab[_0xf780('0x41')]!=='VIRTUAL'){var _0x4b8a3c={};_0x4b8a3c[_0xdac8ab[_0xf780('0x31')]]={'$like':'%'+_0x26452f[_0xf780('0x32')][_0xf780('0x3f')]+'%'};return _0x4b8a3c;}})});}_0x4ed256=_[_0xf780('0x40')]({},_0x4ed256,_0x26452f[_0xf780('0x42')]);var _0x4a0efe={'where':_0x4ed256[_0xf780('0x3e')]};return db['FaxQueueReport'][_0xf780('0x21')](_0x4a0efe)[_0xf780('0x26')](function(_0x28783f){_0x149190[_0xf780('0x21')]=_0x28783f;if(_0x26452f['query'][_0xf780('0x43')]){_0x4ed256[_0xf780('0x44')]=[{'all':!![]}];}return db[_0xf780('0x2c')][_0xf780('0x45')](_0x4ed256);})[_0xf780('0x26')](function(_0x12ae9a){_0x149190[_0xf780('0x46')]=_0x12ae9a;return _0x149190;})[_0xf780('0x26')](respondWithFilteredResult(_0x4ef8c3,_0x4ed256))[_0xf780('0x47')](handleError(_0x4ef8c3,null));};exports[_0xf780('0x48')]=function(_0x143118,_0x30a036){var _0x406a9e={'raw':!![],'where':{'id':_0x143118['params']['id']}},_0x42a710={};_0x42a710[_0xf780('0x36')]=_['keys'](db[_0xf780('0x2c')][_0xf780('0x2d')]);_0x42a710['query']=_['keys'](_0x143118['query']);_0x42a710['filters']=_[_0xf780('0x35')](_0x42a710['model'],_0x42a710[_0xf780('0x32')]);_0x406a9e[_0xf780('0x37')]=_[_0xf780('0x35')](_0x42a710[_0xf780('0x36')],qs[_0xf780('0x38')](_0x143118['query']['fields']));_0x406a9e['attributes']=_0x406a9e['attributes'][_0xf780('0x39')]?_0x406a9e[_0xf780('0x37')]:_0x42a710[_0xf780('0x36')];if(_0x143118[_0xf780('0x32')][_0xf780('0x43')]){_0x406a9e[_0xf780('0x44')]=[{'all':!![]}];}_0x406a9e=_['merge']({},_0x406a9e,_0x143118[_0xf780('0x42')]);return db[_0xf780('0x2c')][_0xf780('0x49')](_0x406a9e)[_0xf780('0x26')](handleEntityNotFound(_0x30a036,null))[_0xf780('0x26')](respondWithResult(_0x30a036,null))[_0xf780('0x47')](handleError(_0x30a036,null));};exports['create']=function(_0x26fe74,_0x5c4170){return db[_0xf780('0x2c')]['create'](_0x26fe74[_0xf780('0x4a')],{})['then'](respondWithResult(_0x5c4170,0xc9))['catch'](handleError(_0x5c4170,null));};exports[_0xf780('0x25')]=function(_0x72a225,_0x189717){if(_0x72a225[_0xf780('0x4a')]['id']){delete _0x72a225['body']['id'];}return db[_0xf780('0x2c')][_0xf780('0x49')]({'where':{'id':_0x72a225[_0xf780('0x4b')]['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x189717,null))[_0xf780('0x26')](saveUpdates(_0x72a225['body'],null))[_0xf780('0x26')](respondWithResult(_0x189717,null))['catch'](handleError(_0x189717,null));};exports[_0xf780('0x27')]=function(_0x1b492a,_0x22c52d){return db[_0xf780('0x2c')][_0xf780('0x49')]({'where':{'id':_0x1b492a['params']['id']}})['then'](handleEntityNotFound(_0x22c52d,null))[_0xf780('0x26')](removeEntity(_0x22c52d,null))[_0xf780('0x47')](handleError(_0x22c52d,null));};exports[_0xf780('0x4c')]=function(_0x3fead1,_0x4eebe5){return db[_0xf780('0x2c')][_0xf780('0x4c')]()[_0xf780('0x26')](respondWithResult(_0x4eebe5,null))[_0xf780('0x47')](handleError(_0x4eebe5,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