Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / faxQueueReport / faxQueueReport.controller.js
index 8043a41..ca7cd57 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a43=['limit','status','set','Content-Range','then','destroy','error','stack','name','map','FaxQueueReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset'];(function(_0xed4d83,_0xae0e9b){var _0x231297=function(_0x4f72a1){while(--_0x4f72a1){_0xed4d83['push'](_0xed4d83['shift']());}};_0x231297(++_0xae0e9b);}(_0x5a43,0xf1));var _0x35a4=function(_0x2ea429,_0x55cd72){_0x2ea429=_0x2ea429-0x0;var _0x238904=_0x5a43[_0x2ea429];return _0x238904;};'use strict';var pdf=require(_0x35a4('0x0'));var emlformat=require(_0x35a4('0x1'));var rimraf=require(_0x35a4('0x2'));var zipdir=require(_0x35a4('0x3'));var jsonpatch=require(_0x35a4('0x4'));var rp=require(_0x35a4('0x5'));var moment=require(_0x35a4('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x35a4('0x7'));var csv=require(_0x35a4('0x8'));var ejs=require(_0x35a4('0x9'));var fs=require('fs');var _=require(_0x35a4('0xa'));var squel=require(_0x35a4('0xb'));var crypto=require(_0x35a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x35a4('0xd'));var toCsv=require(_0x35a4('0x8'));var querystring=require(_0x35a4('0xe'));var Papa=require(_0x35a4('0xf'));var Redis=require(_0x35a4('0x10'));var authService=require(_0x35a4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a4('0x12'))('api');var utils=require(_0x35a4('0x13'));var config=require(_0x35a4('0x14'));var licenseUtil=require(_0x35a4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fef5e,_0x311af9){_0x311af9=_0x311af9||0xcc;return function(_0x5fc594){if(_0x5fc594){return _0x3fef5e[_0x35a4('0x16')](_0x311af9);}return _0x3fef5e['status'](_0x311af9)[_0x35a4('0x17')]();};}function respondWithResult(_0xf9f6d3,_0x4bc73b){_0x4bc73b=_0x4bc73b||0xc8;return function(_0x417c52){if(_0x417c52){return _0xf9f6d3['status'](_0x4bc73b)[_0x35a4('0x18')](_0x417c52);}};}function respondWithFilteredResult(_0x3d0027,_0x4533c7){return function(_0x19e719){if(_0x19e719){var _0x2609a7=_0x19e719[_0x35a4('0x19')],_0x17601e=_0x4533c7['offset'],_0x4111b7=_0x4533c7[_0x35a4('0x1a')]+_0x4533c7[_0x35a4('0x1b')],_0x26a97e;if(_0x4111b7>=_0x2609a7){_0x4111b7=_0x2609a7;_0x26a97e=0xc8;}else{_0x26a97e=0xce;}_0x3d0027[_0x35a4('0x1c')](_0x26a97e);return _0x3d0027[_0x35a4('0x1d')](_0x35a4('0x1e'),_0x17601e+'-'+_0x4111b7+'/'+_0x2609a7)[_0x35a4('0x18')](_0x19e719);}return null;};}function patchUpdates(_0xb8d9b){return function(_0x3e29ba){try{jsonpatch['apply'](_0x3e29ba,_0xb8d9b,!![]);}catch(_0x15113f){return BPromise['reject'](_0x15113f);}return _0x3e29ba['save']();};}function saveUpdates(_0x3e48b3,_0x3ef8a8){return function(_0x17c362){if(_0x17c362){return _0x17c362['update'](_0x3e48b3)[_0x35a4('0x1f')](function(_0xf0f7a5){return _0xf0f7a5;});}return null;};}function removeEntity(_0x44121d,_0x56b424){return function(_0xa1130){if(_0xa1130){return _0xa1130[_0x35a4('0x20')]()['then'](function(){_0x44121d[_0x35a4('0x1c')](0xcc)[_0x35a4('0x17')]();});}};}function handleEntityNotFound(_0x34fc8d,_0x2af3ff){return function(_0x4d9983){if(!_0x4d9983){_0x34fc8d['sendStatus'](0x194);}return _0x4d9983;};}function handleError(_0x7a193c,_0x540ef8){_0x540ef8=_0x540ef8||0x1f4;return function(_0x469728){logger[_0x35a4('0x21')](_0x469728[_0x35a4('0x22')]);if(_0x469728[_0x35a4('0x23')]){delete _0x469728[_0x35a4('0x23')];}_0x7a193c[_0x35a4('0x1c')](_0x540ef8)['send'](_0x469728);};}exports['index']=function(_0x56456e,_0x34bdf6){var _0x69b73e={},_0x4caf12={},_0x490002={'count':0x0,'rows':[]};var _0x7d2c5=_[_0x35a4('0x24')](db[_0x35a4('0x25')][_0x35a4('0x26')],function(_0x5d3313){return{'name':_0x5d3313['fieldName'],'type':_0x5d3313['type']['key']};});_0x4caf12[_0x35a4('0x27')]=_[_0x35a4('0x24')](_0x7d2c5,_0x35a4('0x23'));_0x4caf12[_0x35a4('0x28')]=_[_0x35a4('0x29')](_0x56456e[_0x35a4('0x28')]);_0x4caf12[_0x35a4('0x2a')]=_[_0x35a4('0x2b')](_0x4caf12[_0x35a4('0x27')],_0x4caf12[_0x35a4('0x28')]);_0x69b73e[_0x35a4('0x2c')]=_[_0x35a4('0x2b')](_0x4caf12[_0x35a4('0x27')],qs[_0x35a4('0x2d')](_0x56456e[_0x35a4('0x28')][_0x35a4('0x2d')]));_0x69b73e['attributes']=_0x69b73e[_0x35a4('0x2c')][_0x35a4('0x2e')]?_0x69b73e[_0x35a4('0x2c')]:_0x4caf12['model'];if(!_0x56456e[_0x35a4('0x28')][_0x35a4('0x2f')](_0x35a4('0x30'))){_0x69b73e['limit']=qs['limit'](_0x56456e[_0x35a4('0x28')]['limit']);_0x69b73e[_0x35a4('0x1a')]=qs[_0x35a4('0x1a')](_0x56456e[_0x35a4('0x28')]['offset']);}_0x69b73e['order']=qs[_0x35a4('0x31')](_0x56456e[_0x35a4('0x28')][_0x35a4('0x31')]);_0x69b73e[_0x35a4('0x32')]=qs[_0x35a4('0x2a')](_[_0x35a4('0x33')](_0x56456e[_0x35a4('0x28')],_0x4caf12[_0x35a4('0x2a')]),_0x7d2c5);if(_0x56456e['query']['filter']){_0x69b73e[_0x35a4('0x32')]=_[_0x35a4('0x34')](_0x69b73e[_0x35a4('0x32')],{'$or':_[_0x35a4('0x24')](_0x7d2c5,function(_0xba030a){if(_0xba030a['type']!==_0x35a4('0x35')){var _0x5a6630={};_0x5a6630[_0xba030a[_0x35a4('0x23')]]={'$like':'%'+_0x56456e['query'][_0x35a4('0x36')]+'%'};return _0x5a6630;}})});}_0x69b73e=_[_0x35a4('0x34')]({},_0x69b73e,_0x56456e[_0x35a4('0x37')]);var _0x1dd4aa={'where':_0x69b73e[_0x35a4('0x32')]};return db[_0x35a4('0x25')]['count'](_0x1dd4aa)[_0x35a4('0x1f')](function(_0x284ad6){_0x490002[_0x35a4('0x19')]=_0x284ad6;if(_0x56456e[_0x35a4('0x28')][_0x35a4('0x38')]){_0x69b73e[_0x35a4('0x39')]=[{'all':!![]}];}return db[_0x35a4('0x25')][_0x35a4('0x3a')](_0x69b73e);})[_0x35a4('0x1f')](function(_0x25a4f2){_0x490002[_0x35a4('0x3b')]=_0x25a4f2;return _0x490002;})[_0x35a4('0x1f')](respondWithFilteredResult(_0x34bdf6,_0x69b73e))['catch'](handleError(_0x34bdf6,null));};exports[_0x35a4('0x3c')]=function(_0x5e1eb6,_0x251282){var _0x188305={'raw':!![],'where':{'id':_0x5e1eb6[_0x35a4('0x3d')]['id']}},_0x43105e={};_0x43105e[_0x35a4('0x27')]=_[_0x35a4('0x29')](db[_0x35a4('0x25')][_0x35a4('0x26')]);_0x43105e[_0x35a4('0x28')]=_[_0x35a4('0x29')](_0x5e1eb6['query']);_0x43105e[_0x35a4('0x2a')]=_[_0x35a4('0x2b')](_0x43105e[_0x35a4('0x27')],_0x43105e[_0x35a4('0x28')]);_0x188305[_0x35a4('0x2c')]=_[_0x35a4('0x2b')](_0x43105e[_0x35a4('0x27')],qs['fields'](_0x5e1eb6[_0x35a4('0x28')][_0x35a4('0x2d')]));_0x188305[_0x35a4('0x2c')]=_0x188305['attributes'][_0x35a4('0x2e')]?_0x188305[_0x35a4('0x2c')]:_0x43105e[_0x35a4('0x27')];if(_0x5e1eb6[_0x35a4('0x28')][_0x35a4('0x38')]){_0x188305[_0x35a4('0x39')]=[{'all':!![]}];}_0x188305=_[_0x35a4('0x34')]({},_0x188305,_0x5e1eb6['options']);return db[_0x35a4('0x25')]['find'](_0x188305)[_0x35a4('0x1f')](handleEntityNotFound(_0x251282,null))[_0x35a4('0x1f')](respondWithResult(_0x251282,null))[_0x35a4('0x3e')](handleError(_0x251282,null));};exports[_0x35a4('0x3f')]=function(_0x5c5f80,_0x2c891a){return db[_0x35a4('0x25')][_0x35a4('0x3f')](_0x5c5f80[_0x35a4('0x40')],{})[_0x35a4('0x1f')](respondWithResult(_0x2c891a,0xc9))[_0x35a4('0x3e')](handleError(_0x2c891a,null));};exports[_0x35a4('0x41')]=function(_0x164a68,_0x181def){if(_0x164a68['body']['id']){delete _0x164a68[_0x35a4('0x40')]['id'];}return db[_0x35a4('0x25')]['find']({'where':{'id':_0x164a68[_0x35a4('0x3d')]['id']}})[_0x35a4('0x1f')](handleEntityNotFound(_0x181def,null))[_0x35a4('0x1f')](saveUpdates(_0x164a68[_0x35a4('0x40')],null))['then'](respondWithResult(_0x181def,null))[_0x35a4('0x3e')](handleError(_0x181def,null));};exports[_0x35a4('0x20')]=function(_0x9f692d,_0x57c415){return db[_0x35a4('0x25')]['find']({'where':{'id':_0x9f692d[_0x35a4('0x3d')]['id']}})[_0x35a4('0x1f')](handleEntityNotFound(_0x57c415,null))['then'](removeEntity(_0x57c415,null))[_0x35a4('0x3e')](handleError(_0x57c415,null));};exports['describe']=function(_0x271392,_0x57870c){return db[_0x35a4('0x25')][_0x35a4('0x42')]()[_0x35a4('0x1f')](respondWithResult(_0x57870c,null))[_0x35a4('0x3e')](handleError(_0x57870c,null));};
\ No newline at end of file
+var _0x867f=['catch','params','rawAttributes','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','then','includeAll','include','rows'];(function(_0x1ba555,_0x28fc4){var _0x330b18=function(_0x5aa0df){while(--_0x5aa0df){_0x1ba555['push'](_0x1ba555['shift']());}};_0x330b18(++_0x28fc4);}(_0x867f,0xe6));var _0xf867=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x867f[_0x47623f];return _0x282ce8;};'use strict';var emlformat=require(_0xf867('0x0'));var rimraf=require(_0xf867('0x1'));var zipdir=require(_0xf867('0x2'));var jsonpatch=require(_0xf867('0x3'));var rp=require(_0xf867('0x4'));var moment=require(_0xf867('0x5'));var BPromise=require(_0xf867('0x6'));var Mustache=require(_0xf867('0x7'));var util=require(_0xf867('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf867('0x9'));var ejs=require(_0xf867('0xa'));var fs=require('fs');var fs_extra=require(_0xf867('0xb'));var _=require(_0xf867('0xc'));var squel=require(_0xf867('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf867('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf867('0xf'));var Papa=require(_0xf867('0x10'));var Redis=require(_0xf867('0x11'));var authService=require(_0xf867('0x12'));var qs=require(_0xf867('0x13'));var as=require(_0xf867('0x14'));var hardwareService=require(_0xf867('0x15'));var logger=require(_0xf867('0x16'))('api');var utils=require(_0xf867('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf867('0x18'))['db'];function respondWithStatusCode(_0x1792ae,_0x20fe34){_0x20fe34=_0x20fe34||0xcc;return function(_0x56740c){if(_0x56740c){return _0x1792ae['sendStatus'](_0x20fe34);}return _0x1792ae[_0xf867('0x19')](_0x20fe34)['end']();};}function respondWithResult(_0x352f0b,_0x49ff40){_0x49ff40=_0x49ff40||0xc8;return function(_0x48ff28){if(_0x48ff28){return _0x352f0b[_0xf867('0x19')](_0x49ff40)[_0xf867('0x1a')](_0x48ff28);}};}function respondWithFilteredResult(_0x7a143e,_0x13973b){return function(_0x38fed9){if(_0x38fed9){var _0x1e5161=typeof _0x13973b[_0xf867('0x1b')]===_0xf867('0x1c')&&typeof _0x13973b[_0xf867('0x1d')]==='undefined';var _0x44f6f1=_0x38fed9['count'];var _0x39f9e8=_0x1e5161?0x0:_0x13973b['offset'];var _0x51bdb3=_0x1e5161?_0x38fed9[_0xf867('0x1e')]:_0x13973b['offset']+_0x13973b['limit'];var _0x2092af;if(_0x51bdb3>=_0x44f6f1){_0x51bdb3=_0x44f6f1;_0x2092af=0xc8;}else{_0x2092af=0xce;}_0x7a143e[_0xf867('0x19')](_0x2092af);return _0x7a143e['set']('Content-Range',_0x39f9e8+'-'+_0x51bdb3+'/'+_0x44f6f1)[_0xf867('0x1a')](_0x38fed9);}return null;};}function patchUpdates(_0x23e7dd){return function(_0x1456ce){try{jsonpatch[_0xf867('0x1f')](_0x1456ce,_0x23e7dd,!![]);}catch(_0x419f75){return BPromise[_0xf867('0x20')](_0x419f75);}return _0x1456ce[_0xf867('0x21')]();};}function saveUpdates(_0x34db74,_0x586a25){return function(_0x568aba){if(_0x568aba){return _0x568aba[_0xf867('0x22')](_0x34db74)['then'](function(_0x3072b7){return _0x3072b7;});}return null;};}function removeEntity(_0x3fc971,_0x4da34b){return function(_0x419b6f){if(_0x419b6f){return _0x419b6f[_0xf867('0x23')]()['then'](function(){_0x3fc971[_0xf867('0x19')](0xcc)[_0xf867('0x24')]();});}};}function handleEntityNotFound(_0x167e70,_0x1bc6ca){return function(_0x58bded){if(!_0x58bded){_0x167e70[_0xf867('0x25')](0x194);}return _0x58bded;};}function handleError(_0x67e3a,_0x2efca3){_0x2efca3=_0x2efca3||0x1f4;return function(_0xd765c){logger[_0xf867('0x26')](_0xd765c[_0xf867('0x27')]);if(_0xd765c[_0xf867('0x28')]){delete _0xd765c[_0xf867('0x28')];}_0x67e3a[_0xf867('0x19')](_0x2efca3)[_0xf867('0x29')](_0xd765c);};}exports[_0xf867('0x2a')]=function(_0x57bf28,_0xb6d069){var _0x3981d0={},_0x39218a={},_0xb0dcdd={'count':0x0,'rows':[]};var _0x350d6d=_[_0xf867('0x2b')](db[_0xf867('0x2c')]['rawAttributes'],function(_0x44ddd4){return{'name':_0x44ddd4[_0xf867('0x2d')],'type':_0x44ddd4[_0xf867('0x2e')][_0xf867('0x2f')]};});_0x39218a[_0xf867('0x30')]=_[_0xf867('0x2b')](_0x350d6d,_0xf867('0x28'));_0x39218a[_0xf867('0x31')]=_['keys'](_0x57bf28[_0xf867('0x31')]);_0x39218a['filters']=_[_0xf867('0x32')](_0x39218a['model'],_0x39218a[_0xf867('0x31')]);_0x3981d0[_0xf867('0x33')]=_[_0xf867('0x32')](_0x39218a['model'],qs[_0xf867('0x34')](_0x57bf28[_0xf867('0x31')]['fields']));_0x3981d0['attributes']=_0x3981d0[_0xf867('0x33')]['length']?_0x3981d0[_0xf867('0x33')]:_0x39218a[_0xf867('0x30')];if(!_0x57bf28[_0xf867('0x31')][_0xf867('0x35')]('nolimit')){_0x3981d0['limit']=qs[_0xf867('0x1d')](_0x57bf28[_0xf867('0x31')][_0xf867('0x1d')]);_0x3981d0['offset']=qs[_0xf867('0x1b')](_0x57bf28[_0xf867('0x31')]['offset']);}_0x3981d0[_0xf867('0x36')]=qs['sort'](_0x57bf28[_0xf867('0x31')][_0xf867('0x37')]);_0x3981d0[_0xf867('0x38')]=qs['filters'](_[_0xf867('0x39')](_0x57bf28['query'],_0x39218a[_0xf867('0x3a')]),_0x350d6d);if(_0x57bf28[_0xf867('0x31')][_0xf867('0x3b')]){_0x3981d0[_0xf867('0x38')]=_[_0xf867('0x3c')](_0x3981d0[_0xf867('0x38')],{'$or':_[_0xf867('0x2b')](_0x350d6d,function(_0x2a2e81){if(_0x2a2e81['type']!=='VIRTUAL'){var _0x4a877={};_0x4a877[_0x2a2e81[_0xf867('0x28')]]={'$like':'%'+_0x57bf28[_0xf867('0x31')][_0xf867('0x3b')]+'%'};return _0x4a877;}})});}_0x3981d0=_[_0xf867('0x3c')]({},_0x3981d0,_0x57bf28[_0xf867('0x3d')]);var _0x36ccbe={'where':_0x3981d0['where']};return db[_0xf867('0x2c')][_0xf867('0x1e')](_0x36ccbe)[_0xf867('0x3e')](function(_0x352f8e){_0xb0dcdd[_0xf867('0x1e')]=_0x352f8e;if(_0x57bf28[_0xf867('0x31')][_0xf867('0x3f')]){_0x3981d0[_0xf867('0x40')]=[{'all':!![]}];}return db[_0xf867('0x2c')]['findAll'](_0x3981d0);})[_0xf867('0x3e')](function(_0x4e31d8){_0xb0dcdd[_0xf867('0x41')]=_0x4e31d8;return _0xb0dcdd;})[_0xf867('0x3e')](respondWithFilteredResult(_0xb6d069,_0x3981d0))[_0xf867('0x42')](handleError(_0xb6d069,null));};exports['show']=function(_0x16dfd3,_0x86d79c){var _0x27421a={'raw':!![],'where':{'id':_0x16dfd3[_0xf867('0x43')]['id']}},_0xed868d={};_0xed868d[_0xf867('0x30')]=_['keys'](db[_0xf867('0x2c')][_0xf867('0x44')]);_0xed868d[_0xf867('0x31')]=_[_0xf867('0x45')](_0x16dfd3[_0xf867('0x31')]);_0xed868d['filters']=_[_0xf867('0x32')](_0xed868d['model'],_0xed868d[_0xf867('0x31')]);_0x27421a[_0xf867('0x33')]=_['intersection'](_0xed868d[_0xf867('0x30')],qs[_0xf867('0x34')](_0x16dfd3[_0xf867('0x31')][_0xf867('0x34')]));_0x27421a[_0xf867('0x33')]=_0x27421a[_0xf867('0x33')]['length']?_0x27421a[_0xf867('0x33')]:_0xed868d['model'];if(_0x16dfd3[_0xf867('0x31')][_0xf867('0x3f')]){_0x27421a[_0xf867('0x40')]=[{'all':!![]}];}_0x27421a=_[_0xf867('0x3c')]({},_0x27421a,_0x16dfd3[_0xf867('0x3d')]);return db[_0xf867('0x2c')][_0xf867('0x46')](_0x27421a)['then'](handleEntityNotFound(_0x86d79c,null))['then'](respondWithResult(_0x86d79c,null))[_0xf867('0x42')](handleError(_0x86d79c,null));};exports[_0xf867('0x47')]=function(_0x38fd9b,_0x5ca8a7){return db[_0xf867('0x2c')][_0xf867('0x47')](_0x38fd9b[_0xf867('0x48')],{})['then'](respondWithResult(_0x5ca8a7,0xc9))[_0xf867('0x42')](handleError(_0x5ca8a7,null));};exports['update']=function(_0xc01c03,_0x2d56c0){if(_0xc01c03[_0xf867('0x48')]['id']){delete _0xc01c03[_0xf867('0x48')]['id'];}return db[_0xf867('0x2c')][_0xf867('0x46')]({'where':{'id':_0xc01c03[_0xf867('0x43')]['id']}})[_0xf867('0x3e')](handleEntityNotFound(_0x2d56c0,null))['then'](saveUpdates(_0xc01c03['body'],null))[_0xf867('0x3e')](respondWithResult(_0x2d56c0,null))[_0xf867('0x42')](handleError(_0x2d56c0,null));};exports[_0xf867('0x23')]=function(_0x199ce0,_0x2e9093){return db[_0xf867('0x2c')][_0xf867('0x46')]({'where':{'id':_0x199ce0['params']['id']}})[_0xf867('0x3e')](handleEntityNotFound(_0x2e9093,null))[_0xf867('0x3e')](removeEntity(_0x2e9093,null))[_0xf867('0x42')](handleError(_0x2e9093,null));};exports[_0xf867('0x49')]=function(_0x52d4bf,_0x32386e){return db[_0xf867('0x2c')]['describe']()['then'](respondWithResult(_0x32386e,null))['catch'](handleError(_0x32386e,null));};
\ No newline at end of file