Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / faxQueueReport / faxQueueReport.controller.js
index 09da570..8502d02 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 _0x383a=['name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','include','FaxQueueReport','findAll','rows','catch','params','keys','rawAttributes','options','find','create','update','body','describe','rimraf','zip-dir','moment','mustache','util','path','ejs','fs-extra','lodash','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack'];(function(_0x4360d9,_0x3d2c99){var _0x22e456=function(_0x138fe6){while(--_0x138fe6){_0x4360d9['push'](_0x4360d9['shift']());}};_0x22e456(++_0x3d2c99);}(_0x383a,0x1ad));var _0xa383=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x383a[_0x31a938];return _0x1bf341;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa383('0x0'));var zipdir=require(_0xa383('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa383('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa383('0x3'));var util=require(_0xa383('0x4'));var path=require(_0xa383('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa383('0x6'));var fs=require('fs');var fs_extra=require(_0xa383('0x7'));var _=require(_0xa383('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa383('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa383('0xa'));var authService=require(_0xa383('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xa383('0xc'));var hardwareService=require(_0xa383('0xd'));var logger=require(_0xa383('0xe'))('api');var utils=require(_0xa383('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa383('0x10'))['db'];function respondWithStatusCode(_0xe5b711,_0x20dcd8){_0x20dcd8=_0x20dcd8||0xcc;return function(_0x44b6a8){if(_0x44b6a8){return _0xe5b711['sendStatus'](_0x20dcd8);}return _0xe5b711[_0xa383('0x11')](_0x20dcd8)[_0xa383('0x12')]();};}function respondWithResult(_0x2567c8,_0xdf9a86){_0xdf9a86=_0xdf9a86||0xc8;return function(_0x2262fb){if(_0x2262fb){return _0x2567c8[_0xa383('0x11')](_0xdf9a86)[_0xa383('0x13')](_0x2262fb);}};}function respondWithFilteredResult(_0x83a77a,_0x514394){return function(_0x5ca9f3){if(_0x5ca9f3){var _0x35acc9=typeof _0x514394[_0xa383('0x14')]===_0xa383('0x15')&&typeof _0x514394[_0xa383('0x16')]==='undefined';var _0xb098f=_0x5ca9f3['count'];var _0x287b82=_0x35acc9?0x0:_0x514394[_0xa383('0x14')];var _0x2ccaf7=_0x35acc9?_0x5ca9f3[_0xa383('0x17')]:_0x514394[_0xa383('0x14')]+_0x514394[_0xa383('0x16')];var _0x35e38f;if(_0x2ccaf7>=_0xb098f){_0x2ccaf7=_0xb098f;_0x35e38f=0xc8;}else{_0x35e38f=0xce;}_0x83a77a[_0xa383('0x11')](_0x35e38f);return _0x83a77a[_0xa383('0x18')](_0xa383('0x19'),_0x287b82+'-'+_0x2ccaf7+'/'+_0xb098f)['json'](_0x5ca9f3);}return null;};}function patchUpdates(_0x5d87f9){return function(_0x5d5649){try{jsonpatch[_0xa383('0x1a')](_0x5d5649,_0x5d87f9,!![]);}catch(_0x4109fc){return BPromise['reject'](_0x4109fc);}return _0x5d5649[_0xa383('0x1b')]();};}function saveUpdates(_0x48b8f4,_0xa6b4b0){return function(_0x1f376f){if(_0x1f376f){return _0x1f376f['update'](_0x48b8f4)[_0xa383('0x1c')](function(_0x2533f8){return _0x2533f8;});}return null;};}function removeEntity(_0x4cc53b,_0x441582){return function(_0x3a2e1e){if(_0x3a2e1e){return _0x3a2e1e[_0xa383('0x1d')]()[_0xa383('0x1c')](function(){_0x4cc53b[_0xa383('0x11')](0xcc)[_0xa383('0x12')]();});}};}function handleEntityNotFound(_0x480167,_0x23d22b){return function(_0x28add7){if(!_0x28add7){_0x480167[_0xa383('0x1e')](0x194);}return _0x28add7;};}function handleError(_0x2ffa5d,_0x15483b){_0x15483b=_0x15483b||0x1f4;return function(_0x42b6a5){logger[_0xa383('0x1f')](_0x42b6a5[_0xa383('0x20')]);if(_0x42b6a5['name']){delete _0x42b6a5[_0xa383('0x21')];}_0x2ffa5d[_0xa383('0x11')](_0x15483b)[_0xa383('0x22')](_0x42b6a5);};}exports[_0xa383('0x23')]=function(_0x2640f4,_0x26c28a){var _0x30597f={},_0x27b18c={},_0x11c074={'count':0x0,'rows':[]};var _0x14c3f6=_[_0xa383('0x24')](db['FaxQueueReport']['rawAttributes'],function(_0xd11504){return{'name':_0xd11504[_0xa383('0x25')],'type':_0xd11504[_0xa383('0x26')]['key']};});_0x27b18c[_0xa383('0x27')]=_[_0xa383('0x24')](_0x14c3f6,_0xa383('0x21'));_0x27b18c[_0xa383('0x28')]=_['keys'](_0x2640f4[_0xa383('0x28')]);_0x27b18c[_0xa383('0x29')]=_[_0xa383('0x2a')](_0x27b18c[_0xa383('0x27')],_0x27b18c['query']);_0x30597f[_0xa383('0x2b')]=_[_0xa383('0x2a')](_0x27b18c[_0xa383('0x27')],qs[_0xa383('0x2c')](_0x2640f4[_0xa383('0x28')]['fields']));_0x30597f[_0xa383('0x2b')]=_0x30597f[_0xa383('0x2b')][_0xa383('0x2d')]?_0x30597f[_0xa383('0x2b')]:_0x27b18c['model'];if(!_0x2640f4[_0xa383('0x28')][_0xa383('0x2e')]('nolimit')){_0x30597f[_0xa383('0x16')]=qs[_0xa383('0x16')](_0x2640f4[_0xa383('0x28')]['limit']);_0x30597f[_0xa383('0x14')]=qs[_0xa383('0x14')](_0x2640f4[_0xa383('0x28')][_0xa383('0x14')]);}_0x30597f['order']=qs[_0xa383('0x2f')](_0x2640f4['query'][_0xa383('0x2f')]);_0x30597f[_0xa383('0x30')]=qs[_0xa383('0x29')](_['pick'](_0x2640f4[_0xa383('0x28')],_0x27b18c[_0xa383('0x29')]),_0x14c3f6);if(_0x2640f4[_0xa383('0x28')][_0xa383('0x31')]){_0x30597f[_0xa383('0x30')]=_[_0xa383('0x32')](_0x30597f['where'],{'$or':_[_0xa383('0x24')](_0x14c3f6,function(_0x2f3c73){if(_0x2f3c73[_0xa383('0x26')]!=='VIRTUAL'){var _0x34e8da={};_0x34e8da[_0x2f3c73[_0xa383('0x21')]]={'$like':'%'+_0x2640f4['query'][_0xa383('0x31')]+'%'};return _0x34e8da;}})});}_0x30597f=_['merge']({},_0x30597f,_0x2640f4['options']);var _0x39bf06={'where':_0x30597f[_0xa383('0x30')]};return db['FaxQueueReport'][_0xa383('0x17')](_0x39bf06)[_0xa383('0x1c')](function(_0x2f56b4){_0x11c074[_0xa383('0x17')]=_0x2f56b4;if(_0x2640f4['query'][_0xa383('0x33')]){_0x30597f[_0xa383('0x34')]=[{'all':!![]}];}return db[_0xa383('0x35')][_0xa383('0x36')](_0x30597f);})[_0xa383('0x1c')](function(_0x5009fb){_0x11c074[_0xa383('0x37')]=_0x5009fb;return _0x11c074;})[_0xa383('0x1c')](respondWithFilteredResult(_0x26c28a,_0x30597f))[_0xa383('0x38')](handleError(_0x26c28a,null));};exports['show']=function(_0x137d3c,_0x329a16){var _0x112622={'raw':!![],'where':{'id':_0x137d3c[_0xa383('0x39')]['id']}},_0x63c3ed={};_0x63c3ed[_0xa383('0x27')]=_[_0xa383('0x3a')](db['FaxQueueReport'][_0xa383('0x3b')]);_0x63c3ed['query']=_[_0xa383('0x3a')](_0x137d3c['query']);_0x63c3ed[_0xa383('0x29')]=_['intersection'](_0x63c3ed[_0xa383('0x27')],_0x63c3ed[_0xa383('0x28')]);_0x112622[_0xa383('0x2b')]=_[_0xa383('0x2a')](_0x63c3ed[_0xa383('0x27')],qs['fields'](_0x137d3c[_0xa383('0x28')][_0xa383('0x2c')]));_0x112622[_0xa383('0x2b')]=_0x112622[_0xa383('0x2b')]['length']?_0x112622[_0xa383('0x2b')]:_0x63c3ed[_0xa383('0x27')];if(_0x137d3c[_0xa383('0x28')]['includeAll']){_0x112622['include']=[{'all':!![]}];}_0x112622=_[_0xa383('0x32')]({},_0x112622,_0x137d3c[_0xa383('0x3c')]);return db[_0xa383('0x35')][_0xa383('0x3d')](_0x112622)[_0xa383('0x1c')](handleEntityNotFound(_0x329a16,null))[_0xa383('0x1c')](respondWithResult(_0x329a16,null))[_0xa383('0x38')](handleError(_0x329a16,null));};exports[_0xa383('0x3e')]=function(_0x23b4ed,_0x2485be){return db[_0xa383('0x35')][_0xa383('0x3e')](_0x23b4ed['body'],{})[_0xa383('0x1c')](respondWithResult(_0x2485be,0xc9))[_0xa383('0x38')](handleError(_0x2485be,null));};exports[_0xa383('0x3f')]=function(_0x4e544a,_0x5f537e){if(_0x4e544a['body']['id']){delete _0x4e544a[_0xa383('0x40')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x4e544a[_0xa383('0x39')]['id']}})[_0xa383('0x1c')](handleEntityNotFound(_0x5f537e,null))[_0xa383('0x1c')](saveUpdates(_0x4e544a[_0xa383('0x40')],null))[_0xa383('0x1c')](respondWithResult(_0x5f537e,null))[_0xa383('0x38')](handleError(_0x5f537e,null));};exports[_0xa383('0x1d')]=function(_0x13d49b,_0x25e61c){return db['FaxQueueReport'][_0xa383('0x3d')]({'where':{'id':_0x13d49b[_0xa383('0x39')]['id']}})['then'](handleEntityNotFound(_0x25e61c,null))['then'](removeEntity(_0x25e61c,null))['catch'](handleError(_0x25e61c,null));};exports[_0xa383('0x41')]=function(_0xa9719b,_0xd86ef4){return db[_0xa383('0x35')]['describe']()[_0xa383('0x1c')](respondWithResult(_0xd86ef4,null))[_0xa383('0x38')](handleError(_0xd86ef4,null));};
\ No newline at end of file