Built motion from commit e1760111.|2.6.18
[motion2.git] / server / api / faxQueueReport / faxQueueReport.controller.js
index 194acd3..1581997 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb656=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','status','set','apply','save','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','body','destroy','describe','html-pdf','zip-dir','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce'];(function(_0x186500,_0x599e52){var _0x3cd160=function(_0x505ac1){while(--_0x505ac1){_0x186500['push'](_0x186500['shift']());}};_0x3cd160(++_0x599e52);}(_0xb656,0x1e7));var _0x6b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb656[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6b65('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6b65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b65('0x2'));var Mustache=require(_0x6b65('0x3'));var util=require('util');var path=require(_0x6b65('0x4'));var sox=require(_0x6b65('0x5'));var csv=require(_0x6b65('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6b65('0x7'));var crypto=require(_0x6b65('0x8'));var jsforce=require(_0x6b65('0x9'));var deskjs=require(_0x6b65('0xa'));var toCsv=require(_0x6b65('0x6'));var querystring=require(_0x6b65('0xb'));var Papa=require('papaparse');var Redis=require(_0x6b65('0xc'));var authService=require(_0x6b65('0xd'));var qs=require(_0x6b65('0xe'));var as=require(_0x6b65('0xf'));var hardwareService=require(_0x6b65('0x10'));var logger=require(_0x6b65('0x11'))(_0x6b65('0x12'));var utils=require(_0x6b65('0x13'));var config=require(_0x6b65('0x14'));var db=require(_0x6b65('0x15'))['db'];function respondWithStatusCode(_0x2ecc64,_0x54ae95){_0x54ae95=_0x54ae95||0xcc;return function(_0x4b8d91){if(_0x4b8d91){return _0x2ecc64[_0x6b65('0x16')](_0x54ae95);}return _0x2ecc64['status'](_0x54ae95)[_0x6b65('0x17')]();};}function respondWithResult(_0x35521a,_0x2e7c72){_0x2e7c72=_0x2e7c72||0xc8;return function(_0x24e4dd){if(_0x24e4dd){return _0x35521a['status'](_0x2e7c72)[_0x6b65('0x18')](_0x24e4dd);}};}function respondWithFilteredResult(_0x278b99,_0x4d1038){return function(_0x146918){if(_0x146918){var _0x18f972=_0x146918['count'],_0x3364a9=_0x4d1038[_0x6b65('0x19')],_0x4b3380=_0x4d1038[_0x6b65('0x19')]+_0x4d1038[_0x6b65('0x1a')],_0xee5375;if(_0x4b3380>=_0x18f972){_0x4b3380=_0x18f972;_0xee5375=0xc8;}else{_0xee5375=0xce;}_0x278b99[_0x6b65('0x1b')](_0xee5375);return _0x278b99[_0x6b65('0x1c')]('Content-Range',_0x3364a9+'-'+_0x4b3380+'/'+_0x18f972)[_0x6b65('0x18')](_0x146918);}return null;};}function patchUpdates(_0x52348c){return function(_0xc2057d){try{jsonpatch[_0x6b65('0x1d')](_0xc2057d,_0x52348c,!![]);}catch(_0x3175b2){return BPromise['reject'](_0x3175b2);}return _0xc2057d[_0x6b65('0x1e')]();};}function saveUpdates(_0x2ff7d8,_0x429439){return function(_0x10e37d){if(_0x10e37d){return _0x10e37d[_0x6b65('0x1f')](_0x2ff7d8)[_0x6b65('0x20')](function(_0x488cb8){return _0x488cb8;});}return null;};}function removeEntity(_0x2036ef,_0x5f3978){return function(_0x28a62d){if(_0x28a62d){return _0x28a62d['destroy']()[_0x6b65('0x20')](function(){_0x2036ef[_0x6b65('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e44f,_0x48b5ee){return function(_0x3a85fc){if(!_0x3a85fc){_0x34e44f[_0x6b65('0x16')](0x194);}return _0x3a85fc;};}function handleError(_0x4f184a,_0x1b2076){_0x1b2076=_0x1b2076||0x1f4;return function(_0x708f90){logger[_0x6b65('0x21')](_0x708f90[_0x6b65('0x22')]);if(_0x708f90[_0x6b65('0x23')]){delete _0x708f90[_0x6b65('0x23')];}_0x4f184a[_0x6b65('0x1b')](_0x1b2076)[_0x6b65('0x24')](_0x708f90);};}exports[_0x6b65('0x25')]=function(_0x498a54,_0x37fe3a){var _0x1634f8={},_0xc2d816={},_0x199080={'count':0x0,'rows':[]};var _0x46d020=_[_0x6b65('0x26')](db[_0x6b65('0x27')][_0x6b65('0x28')],function(_0x363fd8){return{'name':_0x363fd8[_0x6b65('0x29')],'type':_0x363fd8[_0x6b65('0x2a')][_0x6b65('0x2b')]};});_0xc2d816['model']=_[_0x6b65('0x26')](_0x46d020,_0x6b65('0x23'));_0xc2d816['query']=_['keys'](_0x498a54[_0x6b65('0x2c')]);_0xc2d816['filters']=_['intersection'](_0xc2d816[_0x6b65('0x2d')],_0xc2d816[_0x6b65('0x2c')]);_0x1634f8[_0x6b65('0x2e')]=_[_0x6b65('0x2f')](_0xc2d816[_0x6b65('0x2d')],qs[_0x6b65('0x30')](_0x498a54['query'][_0x6b65('0x30')]));_0x1634f8[_0x6b65('0x2e')]=_0x1634f8['attributes'][_0x6b65('0x31')]?_0x1634f8[_0x6b65('0x2e')]:_0xc2d816['model'];if(!_0x498a54[_0x6b65('0x2c')]['hasOwnProperty'](_0x6b65('0x32'))){_0x1634f8[_0x6b65('0x1a')]=qs[_0x6b65('0x1a')](_0x498a54[_0x6b65('0x2c')][_0x6b65('0x1a')]);_0x1634f8[_0x6b65('0x19')]=qs[_0x6b65('0x19')](_0x498a54[_0x6b65('0x2c')][_0x6b65('0x19')]);}_0x1634f8[_0x6b65('0x33')]=qs['sort'](_0x498a54[_0x6b65('0x2c')][_0x6b65('0x34')]);_0x1634f8[_0x6b65('0x35')]=qs[_0x6b65('0x36')](_[_0x6b65('0x37')](_0x498a54[_0x6b65('0x2c')],_0xc2d816['filters']),_0x46d020);if(_0x498a54['query'][_0x6b65('0x38')]){_0x1634f8[_0x6b65('0x35')]=_[_0x6b65('0x39')](_0x1634f8[_0x6b65('0x35')],{'$or':_[_0x6b65('0x26')](_0x46d020,function(_0x5f3dd5){if(_0x5f3dd5[_0x6b65('0x2a')]!==_0x6b65('0x3a')){var _0x2be083={};_0x2be083[_0x5f3dd5['name']]={'$like':'%'+_0x498a54[_0x6b65('0x2c')][_0x6b65('0x38')]+'%'};return _0x2be083;}})});}_0x1634f8=_[_0x6b65('0x39')]({},_0x1634f8,_0x498a54[_0x6b65('0x3b')]);var _0x293515={'where':_0x1634f8[_0x6b65('0x35')]};return db[_0x6b65('0x27')][_0x6b65('0x3c')](_0x293515)[_0x6b65('0x20')](function(_0x569dad){_0x199080[_0x6b65('0x3c')]=_0x569dad;if(_0x498a54['query'][_0x6b65('0x3d')]){_0x1634f8[_0x6b65('0x3e')]=[{'all':!![]}];}return db[_0x6b65('0x27')]['findAll'](_0x1634f8);})[_0x6b65('0x20')](function(_0x1891f2){_0x199080['rows']=_0x1891f2;return _0x199080;})[_0x6b65('0x20')](respondWithFilteredResult(_0x37fe3a,_0x1634f8))[_0x6b65('0x3f')](handleError(_0x37fe3a,null));};exports[_0x6b65('0x40')]=function(_0x403b9a,_0x10714b){var _0x8d2505={'raw':!![],'where':{'id':_0x403b9a[_0x6b65('0x41')]['id']}},_0x1565b3={};_0x1565b3['model']=_['keys'](db[_0x6b65('0x27')][_0x6b65('0x28')]);_0x1565b3[_0x6b65('0x2c')]=_['keys'](_0x403b9a[_0x6b65('0x2c')]);_0x1565b3[_0x6b65('0x36')]=_[_0x6b65('0x2f')](_0x1565b3[_0x6b65('0x2d')],_0x1565b3[_0x6b65('0x2c')]);_0x8d2505['attributes']=_[_0x6b65('0x2f')](_0x1565b3['model'],qs[_0x6b65('0x30')](_0x403b9a[_0x6b65('0x2c')]['fields']));_0x8d2505['attributes']=_0x8d2505[_0x6b65('0x2e')][_0x6b65('0x31')]?_0x8d2505['attributes']:_0x1565b3[_0x6b65('0x2d')];if(_0x403b9a['query'][_0x6b65('0x3d')]){_0x8d2505[_0x6b65('0x3e')]=[{'all':!![]}];}_0x8d2505=_[_0x6b65('0x39')]({},_0x8d2505,_0x403b9a['options']);return db[_0x6b65('0x27')][_0x6b65('0x42')](_0x8d2505)[_0x6b65('0x20')](handleEntityNotFound(_0x10714b,null))['then'](respondWithResult(_0x10714b,null))[_0x6b65('0x3f')](handleError(_0x10714b,null));};exports[_0x6b65('0x43')]=function(_0x65dfbb,_0x4f6748){return db[_0x6b65('0x27')][_0x6b65('0x43')](_0x65dfbb['body'],{})['then'](respondWithResult(_0x4f6748,0xc9))[_0x6b65('0x3f')](handleError(_0x4f6748,null));};exports[_0x6b65('0x1f')]=function(_0x22777f,_0x13626b){if(_0x22777f[_0x6b65('0x44')]['id']){delete _0x22777f[_0x6b65('0x44')]['id'];}return db[_0x6b65('0x27')]['find']({'where':{'id':_0x22777f['params']['id']}})[_0x6b65('0x20')](handleEntityNotFound(_0x13626b,null))[_0x6b65('0x20')](saveUpdates(_0x22777f['body'],null))[_0x6b65('0x20')](respondWithResult(_0x13626b,null))['catch'](handleError(_0x13626b,null));};exports[_0x6b65('0x45')]=function(_0x4ef243,_0x5c08ce){return db['FaxQueueReport'][_0x6b65('0x42')]({'where':{'id':_0x4ef243[_0x6b65('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c08ce,null))[_0x6b65('0x20')](removeEntity(_0x5c08ce,null))['catch'](handleError(_0x5c08ce,null));};exports[_0x6b65('0x46')]=function(_0x3a8992,_0x351d5a){return db[_0x6b65('0x27')][_0x6b65('0x46')]()['then'](respondWithResult(_0x351d5a,null))[_0x6b65('0x3f')](handleError(_0x351d5a,null));};
\ No newline at end of file
+var _0x87f8=['offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','send','index','map','FaxQueueReport','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','params','describe','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x352b44,_0x4a91a1){var _0x3e8baa=function(_0xed4bc3){while(--_0xed4bc3){_0x352b44['push'](_0x352b44['shift']());}};_0x3e8baa(++_0x4a91a1);}(_0x87f8,0x152));var _0x887f=function(_0x593121,_0x3a4ecf){_0x593121=_0x593121-0x0;var _0x35c6e4=_0x87f8[_0x593121];return _0x35c6e4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x887f('0x0'));var rp=require(_0x887f('0x1'));var moment=require('moment');var BPromise=require(_0x887f('0x2'));var Mustache=require('mustache');var util=require(_0x887f('0x3'));var path=require(_0x887f('0x4'));var sox=require(_0x887f('0x5'));var csv=require(_0x887f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x887f('0x7'));var _=require(_0x887f('0x8'));var squel=require(_0x887f('0x9'));var crypto=require(_0x887f('0xa'));var jsforce=require(_0x887f('0xb'));var deskjs=require(_0x887f('0xc'));var toCsv=require(_0x887f('0x6'));var querystring=require('querystring');var Papa=require(_0x887f('0xd'));var Redis=require('ioredis');var authService=require(_0x887f('0xe'));var qs=require(_0x887f('0xf'));var as=require(_0x887f('0x10'));var hardwareService=require(_0x887f('0x11'));var logger=require('../../config/logger')(_0x887f('0x12'));var utils=require(_0x887f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x887f('0x14'))['db'];function respondWithStatusCode(_0x32b6c4,_0x32e050){_0x32e050=_0x32e050||0xcc;return function(_0x589e92){if(_0x589e92){return _0x32b6c4[_0x887f('0x15')](_0x32e050);}return _0x32b6c4[_0x887f('0x16')](_0x32e050)['end']();};}function respondWithResult(_0x16bbc4,_0x58152e){_0x58152e=_0x58152e||0xc8;return function(_0x59b7ab){if(_0x59b7ab){return _0x16bbc4[_0x887f('0x16')](_0x58152e)[_0x887f('0x17')](_0x59b7ab);}};}function respondWithFilteredResult(_0x59ed6c,_0x3f189a){return function(_0xf69779){if(_0xf69779){var _0x9f5d78=typeof _0x3f189a['offset']===_0x887f('0x18')&&typeof _0x3f189a[_0x887f('0x19')]==='undefined';var _0x2e8999=_0xf69779[_0x887f('0x1a')];var _0x3ab397=_0x9f5d78?0x0:_0x3f189a[_0x887f('0x1b')];var _0x2399a5=_0x9f5d78?_0xf69779[_0x887f('0x1a')]:_0x3f189a[_0x887f('0x1b')]+_0x3f189a[_0x887f('0x19')];var _0x342e8e;if(_0x2399a5>=_0x2e8999){_0x2399a5=_0x2e8999;_0x342e8e=0xc8;}else{_0x342e8e=0xce;}_0x59ed6c[_0x887f('0x16')](_0x342e8e);return _0x59ed6c[_0x887f('0x1c')](_0x887f('0x1d'),_0x3ab397+'-'+_0x2399a5+'/'+_0x2e8999)[_0x887f('0x17')](_0xf69779);}return null;};}function patchUpdates(_0x4deddd){return function(_0x129106){try{jsonpatch[_0x887f('0x1e')](_0x129106,_0x4deddd,!![]);}catch(_0x49af51){return BPromise[_0x887f('0x1f')](_0x49af51);}return _0x129106[_0x887f('0x20')]();};}function saveUpdates(_0x48fd49,_0xc09608){return function(_0x56beaa){if(_0x56beaa){return _0x56beaa[_0x887f('0x21')](_0x48fd49)[_0x887f('0x22')](function(_0x566fb9){return _0x566fb9;});}return null;};}function removeEntity(_0x338777,_0x3af68e){return function(_0x3d6948){if(_0x3d6948){return _0x3d6948[_0x887f('0x23')]()['then'](function(){_0x338777[_0x887f('0x16')](0xcc)[_0x887f('0x24')]();});}};}function handleEntityNotFound(_0x5c7f41,_0x1a1657){return function(_0x42c8bd){if(!_0x42c8bd){_0x5c7f41['sendStatus'](0x194);}return _0x42c8bd;};}function handleError(_0x1811e6,_0x7eef96){_0x7eef96=_0x7eef96||0x1f4;return function(_0x108890){logger['error'](_0x108890[_0x887f('0x25')]);if(_0x108890['name']){delete _0x108890['name'];}_0x1811e6[_0x887f('0x16')](_0x7eef96)[_0x887f('0x26')](_0x108890);};}exports[_0x887f('0x27')]=function(_0x2f20ce,_0x1c5ce3){var _0x4e1fe1={},_0x59d489={},_0x4238e0={'count':0x0,'rows':[]};var _0xca31ec=_[_0x887f('0x28')](db[_0x887f('0x29')]['rawAttributes'],function(_0x39a9ce){return{'name':_0x39a9ce['fieldName'],'type':_0x39a9ce[_0x887f('0x2a')]['key']};});_0x59d489[_0x887f('0x2b')]=_[_0x887f('0x28')](_0xca31ec,_0x887f('0x2c'));_0x59d489[_0x887f('0x2d')]=_[_0x887f('0x2e')](_0x2f20ce[_0x887f('0x2d')]);_0x59d489[_0x887f('0x2f')]=_[_0x887f('0x30')](_0x59d489['model'],_0x59d489[_0x887f('0x2d')]);_0x4e1fe1[_0x887f('0x31')]=_[_0x887f('0x30')](_0x59d489[_0x887f('0x2b')],qs[_0x887f('0x32')](_0x2f20ce[_0x887f('0x2d')]['fields']));_0x4e1fe1[_0x887f('0x31')]=_0x4e1fe1[_0x887f('0x31')][_0x887f('0x33')]?_0x4e1fe1[_0x887f('0x31')]:_0x59d489[_0x887f('0x2b')];if(!_0x2f20ce['query'][_0x887f('0x34')](_0x887f('0x35'))){_0x4e1fe1['limit']=qs[_0x887f('0x19')](_0x2f20ce[_0x887f('0x2d')][_0x887f('0x19')]);_0x4e1fe1['offset']=qs[_0x887f('0x1b')](_0x2f20ce[_0x887f('0x2d')][_0x887f('0x1b')]);}_0x4e1fe1[_0x887f('0x36')]=qs['sort'](_0x2f20ce[_0x887f('0x2d')][_0x887f('0x37')]);_0x4e1fe1['where']=qs['filters'](_[_0x887f('0x38')](_0x2f20ce[_0x887f('0x2d')],_0x59d489[_0x887f('0x2f')]),_0xca31ec);if(_0x2f20ce['query'][_0x887f('0x39')]){_0x4e1fe1['where']=_['merge'](_0x4e1fe1[_0x887f('0x3a')],{'$or':_[_0x887f('0x28')](_0xca31ec,function(_0x436486){if(_0x436486['type']!==_0x887f('0x3b')){var _0xc2df3b={};_0xc2df3b[_0x436486[_0x887f('0x2c')]]={'$like':'%'+_0x2f20ce['query'][_0x887f('0x39')]+'%'};return _0xc2df3b;}})});}_0x4e1fe1=_[_0x887f('0x3c')]({},_0x4e1fe1,_0x2f20ce['options']);var _0x4022fa={'where':_0x4e1fe1[_0x887f('0x3a')]};return db[_0x887f('0x29')][_0x887f('0x1a')](_0x4022fa)[_0x887f('0x22')](function(_0xd6bf57){_0x4238e0['count']=_0xd6bf57;if(_0x2f20ce[_0x887f('0x2d')][_0x887f('0x3d')]){_0x4e1fe1[_0x887f('0x3e')]=[{'all':!![]}];}return db[_0x887f('0x29')][_0x887f('0x3f')](_0x4e1fe1);})[_0x887f('0x22')](function(_0x2be724){_0x4238e0['rows']=_0x2be724;return _0x4238e0;})[_0x887f('0x22')](respondWithFilteredResult(_0x1c5ce3,_0x4e1fe1))[_0x887f('0x40')](handleError(_0x1c5ce3,null));};exports[_0x887f('0x41')]=function(_0x34594a,_0x55e700){var _0x134f2e={'raw':!![],'where':{'id':_0x34594a['params']['id']}},_0x79cf46={};_0x79cf46[_0x887f('0x2b')]=_['keys'](db['FaxQueueReport'][_0x887f('0x42')]);_0x79cf46[_0x887f('0x2d')]=_[_0x887f('0x2e')](_0x34594a[_0x887f('0x2d')]);_0x79cf46[_0x887f('0x2f')]=_[_0x887f('0x30')](_0x79cf46['model'],_0x79cf46[_0x887f('0x2d')]);_0x134f2e[_0x887f('0x31')]=_[_0x887f('0x30')](_0x79cf46[_0x887f('0x2b')],qs[_0x887f('0x32')](_0x34594a[_0x887f('0x2d')][_0x887f('0x32')]));_0x134f2e[_0x887f('0x31')]=_0x134f2e[_0x887f('0x31')][_0x887f('0x33')]?_0x134f2e['attributes']:_0x79cf46[_0x887f('0x2b')];if(_0x34594a[_0x887f('0x2d')][_0x887f('0x3d')]){_0x134f2e['include']=[{'all':!![]}];}_0x134f2e=_[_0x887f('0x3c')]({},_0x134f2e,_0x34594a[_0x887f('0x43')]);return db['FaxQueueReport'][_0x887f('0x44')](_0x134f2e)[_0x887f('0x22')](handleEntityNotFound(_0x55e700,null))[_0x887f('0x22')](respondWithResult(_0x55e700,null))[_0x887f('0x40')](handleError(_0x55e700,null));};exports[_0x887f('0x45')]=function(_0xbd961e,_0x22b11f){return db['FaxQueueReport']['create'](_0xbd961e[_0x887f('0x46')],{})[_0x887f('0x22')](respondWithResult(_0x22b11f,0xc9))['catch'](handleError(_0x22b11f,null));};exports[_0x887f('0x21')]=function(_0x3fcd12,_0x2bdd65){if(_0x3fcd12[_0x887f('0x46')]['id']){delete _0x3fcd12[_0x887f('0x46')]['id'];}return db[_0x887f('0x29')]['find']({'where':{'id':_0x3fcd12['params']['id']}})[_0x887f('0x22')](handleEntityNotFound(_0x2bdd65,null))['then'](saveUpdates(_0x3fcd12[_0x887f('0x46')],null))['then'](respondWithResult(_0x2bdd65,null))[_0x887f('0x40')](handleError(_0x2bdd65,null));};exports[_0x887f('0x23')]=function(_0x32e630,_0x417c8d){return db[_0x887f('0x29')]['find']({'where':{'id':_0x32e630[_0x887f('0x47')]['id']}})[_0x887f('0x22')](handleEntityNotFound(_0x417c8d,null))[_0x887f('0x22')](removeEntity(_0x417c8d,null))[_0x887f('0x40')](handleError(_0x417c8d,null));};exports[_0x887f('0x48')]=function(_0x809211,_0x320f54){return db[_0x887f('0x29')]['describe']()[_0x887f('0x22')](respondWithResult(_0x320f54,null))[_0x887f('0x40')](handleError(_0x320f54,null));};
\ No newline at end of file