Built motion from commit 25580385.|2.6.2
[motion2.git] / server / api / openchannelQueueReport / openchannelQueueReport.controller.js
index a876aac..d2c98e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1738=['VIRTUAL','options','OpenchannelQueueReport','count','include','catch','create','body','update','find','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map'];(function(_0x31a649,_0x45a497){var _0x41cd34=function(_0x3d0a97){while(--_0x3d0a97){_0x31a649['push'](_0x31a649['shift']());}};_0x41cd34(++_0x45a497);}(_0x1738,0x1bc));var _0x8173=function(_0x5717fa,_0x4c0526){_0x5717fa=_0x5717fa-0x0;var _0xcfcaa3=_0x1738[_0x5717fa];return _0xcfcaa3;};'use strict';var pdf=require(_0x8173('0x0'));var emlformat=require(_0x8173('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8173('0x2'));var rp=require(_0x8173('0x3'));var moment=require(_0x8173('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8173('0x5'));var path=require(_0x8173('0x6'));var sox=require(_0x8173('0x7'));var csv=require(_0x8173('0x8'));var ejs=require(_0x8173('0x9'));var fs=require('fs');var _=require(_0x8173('0xa'));var squel=require(_0x8173('0xb'));var crypto=require(_0x8173('0xc'));var jsforce=require(_0x8173('0xd'));var deskjs=require(_0x8173('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8173('0xf'));var Redis=require(_0x8173('0x10'));var authService=require(_0x8173('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8173('0x12'));var logger=require(_0x8173('0x13'))(_0x8173('0x14'));var utils=require(_0x8173('0x15'));var config=require(_0x8173('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8173('0x17'))['db'];function respondWithStatusCode(_0x56f877,_0x25f678){_0x25f678=_0x25f678||0xcc;return function(_0x135911){if(_0x135911){return _0x56f877[_0x8173('0x18')](_0x25f678);}return _0x56f877[_0x8173('0x19')](_0x25f678)[_0x8173('0x1a')]();};}function respondWithResult(_0x4c7bc5,_0x40bb6b){_0x40bb6b=_0x40bb6b||0xc8;return function(_0x12c705){if(_0x12c705){return _0x4c7bc5[_0x8173('0x19')](_0x40bb6b)['json'](_0x12c705);}};}function respondWithFilteredResult(_0x5a3870,_0xd37c80){return function(_0x40bf0e){if(_0x40bf0e){var _0x2e7ca5=_0x40bf0e['count'],_0x58fcf1=_0xd37c80[_0x8173('0x1b')],_0x2932b2=_0xd37c80[_0x8173('0x1b')]+_0xd37c80[_0x8173('0x1c')],_0x114b42;if(_0x2932b2>=_0x2e7ca5){_0x2932b2=_0x2e7ca5;_0x114b42=0xc8;}else{_0x114b42=0xce;}_0x5a3870[_0x8173('0x19')](_0x114b42);return _0x5a3870[_0x8173('0x1d')]('Content-Range',_0x58fcf1+'-'+_0x2932b2+'/'+_0x2e7ca5)[_0x8173('0x1e')](_0x40bf0e);}return null;};}function patchUpdates(_0x15265a){return function(_0xce80fe){try{jsonpatch[_0x8173('0x1f')](_0xce80fe,_0x15265a,!![]);}catch(_0x29eb66){return BPromise[_0x8173('0x20')](_0x29eb66);}return _0xce80fe[_0x8173('0x21')]();};}function saveUpdates(_0x167845,_0x1ed102){return function(_0x2e6747){if(_0x2e6747){return _0x2e6747['update'](_0x167845)[_0x8173('0x22')](function(_0x19a4a7){return _0x19a4a7;});}return null;};}function removeEntity(_0x4c0556,_0x3f613f){return function(_0x5c6d79){if(_0x5c6d79){return _0x5c6d79[_0x8173('0x23')]()['then'](function(){_0x4c0556[_0x8173('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x117ca6,_0x4545db){return function(_0x5f2044){if(!_0x5f2044){_0x117ca6[_0x8173('0x18')](0x194);}return _0x5f2044;};}function handleError(_0x4df8ef,_0x2f258d){_0x2f258d=_0x2f258d||0x1f4;return function(_0x189acd){logger[_0x8173('0x24')](_0x189acd[_0x8173('0x25')]);if(_0x189acd[_0x8173('0x26')]){delete _0x189acd[_0x8173('0x26')];}_0x4df8ef[_0x8173('0x19')](_0x2f258d)['send'](_0x189acd);};}exports[_0x8173('0x27')]=function(_0x8fcf1e,_0x4fbe19){var _0x52c249={},_0x2eea21={},_0xa6389f={'count':0x0,'rows':[]};var _0x394f65=_['map'](db['OpenchannelQueueReport'][_0x8173('0x28')],function(_0x469a51){return{'name':_0x469a51[_0x8173('0x29')],'type':_0x469a51[_0x8173('0x2a')]['key']};});_0x2eea21[_0x8173('0x2b')]=_['map'](_0x394f65,'name');_0x2eea21[_0x8173('0x2c')]=_[_0x8173('0x2d')](_0x8fcf1e['query']);_0x2eea21['filters']=_[_0x8173('0x2e')](_0x2eea21[_0x8173('0x2b')],_0x2eea21[_0x8173('0x2c')]);_0x52c249['attributes']=_[_0x8173('0x2e')](_0x2eea21[_0x8173('0x2b')],qs[_0x8173('0x2f')](_0x8fcf1e[_0x8173('0x2c')][_0x8173('0x2f')]));_0x52c249['attributes']=_0x52c249[_0x8173('0x30')][_0x8173('0x31')]?_0x52c249[_0x8173('0x30')]:_0x2eea21['model'];if(!_0x8fcf1e[_0x8173('0x2c')][_0x8173('0x32')](_0x8173('0x33'))){_0x52c249[_0x8173('0x1c')]=qs[_0x8173('0x1c')](_0x8fcf1e[_0x8173('0x2c')][_0x8173('0x1c')]);_0x52c249[_0x8173('0x1b')]=qs[_0x8173('0x1b')](_0x8fcf1e['query'][_0x8173('0x1b')]);}_0x52c249[_0x8173('0x34')]=qs[_0x8173('0x35')](_0x8fcf1e[_0x8173('0x2c')]['sort']);_0x52c249[_0x8173('0x36')]=qs[_0x8173('0x37')](_[_0x8173('0x38')](_0x8fcf1e[_0x8173('0x2c')],_0x2eea21['filters']),_0x394f65);if(_0x8fcf1e[_0x8173('0x2c')][_0x8173('0x39')]){_0x52c249[_0x8173('0x36')]=_[_0x8173('0x3a')](_0x52c249['where'],{'$or':_[_0x8173('0x3b')](_0x394f65,function(_0x2ab1e4){if(_0x2ab1e4[_0x8173('0x2a')]!==_0x8173('0x3c')){var _0x56581d={};_0x56581d[_0x2ab1e4['name']]={'$like':'%'+_0x8fcf1e['query'][_0x8173('0x39')]+'%'};return _0x56581d;}})});}_0x52c249=_['merge']({},_0x52c249,_0x8fcf1e[_0x8173('0x3d')]);var _0x4c36ae={'where':_0x52c249['where']};return db[_0x8173('0x3e')][_0x8173('0x3f')](_0x4c36ae)[_0x8173('0x22')](function(_0x143c42){_0xa6389f[_0x8173('0x3f')]=_0x143c42;if(_0x8fcf1e[_0x8173('0x2c')]['includeAll']){_0x52c249[_0x8173('0x40')]=[{'all':!![]}];}return db[_0x8173('0x3e')]['findAll'](_0x52c249);})[_0x8173('0x22')](function(_0x2a482d){_0xa6389f['rows']=_0x2a482d;return _0xa6389f;})[_0x8173('0x22')](respondWithFilteredResult(_0x4fbe19,_0x52c249))['catch'](handleError(_0x4fbe19,null));};exports['show']=function(_0x5ddf95,_0x264c9e){var _0x372927={'raw':!![],'where':{'id':_0x5ddf95['params']['id']}},_0x1d7e07={};_0x1d7e07[_0x8173('0x2b')]=_[_0x8173('0x2d')](db[_0x8173('0x3e')][_0x8173('0x28')]);_0x1d7e07[_0x8173('0x2c')]=_[_0x8173('0x2d')](_0x5ddf95[_0x8173('0x2c')]);_0x1d7e07['filters']=_[_0x8173('0x2e')](_0x1d7e07[_0x8173('0x2b')],_0x1d7e07[_0x8173('0x2c')]);_0x372927[_0x8173('0x30')]=_[_0x8173('0x2e')](_0x1d7e07[_0x8173('0x2b')],qs[_0x8173('0x2f')](_0x5ddf95['query'][_0x8173('0x2f')]));_0x372927[_0x8173('0x30')]=_0x372927[_0x8173('0x30')][_0x8173('0x31')]?_0x372927[_0x8173('0x30')]:_0x1d7e07[_0x8173('0x2b')];if(_0x5ddf95['query']['includeAll']){_0x372927[_0x8173('0x40')]=[{'all':!![]}];}_0x372927=_[_0x8173('0x3a')]({},_0x372927,_0x5ddf95['options']);return db[_0x8173('0x3e')]['find'](_0x372927)['then'](handleEntityNotFound(_0x264c9e,null))[_0x8173('0x22')](respondWithResult(_0x264c9e,null))[_0x8173('0x41')](handleError(_0x264c9e,null));};exports[_0x8173('0x42')]=function(_0x27b304,_0x252491){return db[_0x8173('0x3e')][_0x8173('0x42')](_0x27b304[_0x8173('0x43')],{})[_0x8173('0x22')](respondWithResult(_0x252491,0xc9))[_0x8173('0x41')](handleError(_0x252491,null));};exports[_0x8173('0x44')]=function(_0x22d907,_0x5e3914){if(_0x22d907['body']['id']){delete _0x22d907[_0x8173('0x43')]['id'];}return db[_0x8173('0x3e')][_0x8173('0x45')]({'where':{'id':_0x22d907[_0x8173('0x46')]['id']}})[_0x8173('0x22')](handleEntityNotFound(_0x5e3914,null))[_0x8173('0x22')](saveUpdates(_0x22d907[_0x8173('0x43')],null))[_0x8173('0x22')](respondWithResult(_0x5e3914,null))[_0x8173('0x41')](handleError(_0x5e3914,null));};exports[_0x8173('0x23')]=function(_0x35b0f5,_0x4e3a70){return db[_0x8173('0x3e')]['find']({'where':{'id':_0x35b0f5[_0x8173('0x46')]['id']}})[_0x8173('0x22')](handleEntityNotFound(_0x4e3a70,null))['then'](removeEntity(_0x4e3a70,null))['catch'](handleError(_0x4e3a70,null));};exports[_0x8173('0x47')]=function(_0x24cf60,_0x4ba94e){return db[_0x8173('0x3e')]['describe']()['then'](respondWithResult(_0x4ba94e,null))['catch'](handleError(_0x4ba94e,null));};
\ No newline at end of file
+var _0x3400=['stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error'];(function(_0x47a909,_0x2506d1){var _0x193070=function(_0x38ecae){while(--_0x38ecae){_0x47a909['push'](_0x47a909['shift']());}};_0x193070(++_0x2506d1);}(_0x3400,0x104));var _0x0340=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x3400[_0x3da832];return _0xe602f2;};'use strict';var emlformat=require(_0x0340('0x0'));var rimraf=require(_0x0340('0x1'));var zipdir=require(_0x0340('0x2'));var jsonpatch=require(_0x0340('0x3'));var rp=require(_0x0340('0x4'));var moment=require(_0x0340('0x5'));var BPromise=require(_0x0340('0x6'));var Mustache=require(_0x0340('0x7'));var util=require(_0x0340('0x8'));var path=require(_0x0340('0x9'));var sox=require(_0x0340('0xa'));var csv=require('to-csv');var ejs=require(_0x0340('0xb'));var fs=require('fs');var fs_extra=require(_0x0340('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0340('0xd'));var deskjs=require(_0x0340('0xe'));var toCsv=require(_0x0340('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0340('0x10'));var authService=require(_0x0340('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0340('0x12'));var hardwareService=require(_0x0340('0x13'));var logger=require('../../config/logger')(_0x0340('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0340('0x15'));var db=require(_0x0340('0x16'))['db'];function respondWithStatusCode(_0x5da049,_0x6e8c19){_0x6e8c19=_0x6e8c19||0xcc;return function(_0x4fcb11){if(_0x4fcb11){return _0x5da049['sendStatus'](_0x6e8c19);}return _0x5da049['status'](_0x6e8c19)[_0x0340('0x17')]();};}function respondWithResult(_0x285d22,_0x4b9969){_0x4b9969=_0x4b9969||0xc8;return function(_0x2a212e){if(_0x2a212e){return _0x285d22['status'](_0x4b9969)[_0x0340('0x18')](_0x2a212e);}};}function respondWithFilteredResult(_0x4e48d7,_0x28fa33){return function(_0x3c3186){if(_0x3c3186){var _0x390288=typeof _0x28fa33[_0x0340('0x19')]===_0x0340('0x1a')&&typeof _0x28fa33[_0x0340('0x1b')]==='undefined';var _0x46c9f6=_0x3c3186[_0x0340('0x1c')];var _0x46d0cb=_0x390288?0x0:_0x28fa33[_0x0340('0x19')];var _0xe157d3=_0x390288?_0x3c3186[_0x0340('0x1c')]:_0x28fa33[_0x0340('0x19')]+_0x28fa33[_0x0340('0x1b')];var _0xc01f56;if(_0xe157d3>=_0x46c9f6){_0xe157d3=_0x46c9f6;_0xc01f56=0xc8;}else{_0xc01f56=0xce;}_0x4e48d7['status'](_0xc01f56);return _0x4e48d7[_0x0340('0x1d')](_0x0340('0x1e'),_0x46d0cb+'-'+_0xe157d3+'/'+_0x46c9f6)['json'](_0x3c3186);}return null;};}function patchUpdates(_0x1b5048){return function(_0x30e09c){try{jsonpatch[_0x0340('0x1f')](_0x30e09c,_0x1b5048,!![]);}catch(_0x4b8cdb){return BPromise[_0x0340('0x20')](_0x4b8cdb);}return _0x30e09c[_0x0340('0x21')]();};}function saveUpdates(_0x4b1cbb,_0x2ff5ec){return function(_0x21830f){if(_0x21830f){return _0x21830f[_0x0340('0x22')](_0x4b1cbb)[_0x0340('0x23')](function(_0x1edcdb){return _0x1edcdb;});}return null;};}function removeEntity(_0x122e5f,_0x562760){return function(_0x6aea1d){if(_0x6aea1d){return _0x6aea1d[_0x0340('0x24')]()[_0x0340('0x23')](function(){_0x122e5f[_0x0340('0x25')](0xcc)[_0x0340('0x17')]();});}};}function handleEntityNotFound(_0x6cd62b,_0x2a3e8e){return function(_0x2688e2){if(!_0x2688e2){_0x6cd62b[_0x0340('0x26')](0x194);}return _0x2688e2;};}function handleError(_0x4530f4,_0x2a1ba4){_0x2a1ba4=_0x2a1ba4||0x1f4;return function(_0x1c16ae){logger[_0x0340('0x27')](_0x1c16ae[_0x0340('0x28')]);if(_0x1c16ae['name']){delete _0x1c16ae['name'];}_0x4530f4['status'](_0x2a1ba4)[_0x0340('0x29')](_0x1c16ae);};}exports[_0x0340('0x2a')]=function(_0x241a29,_0x4fb54b){var _0x188ad2={},_0x4c1f37={},_0x38d9be={'count':0x0,'rows':[]};var _0x26475f=_[_0x0340('0x2b')](db['OpenchannelQueueReport'][_0x0340('0x2c')],function(_0x257423){return{'name':_0x257423[_0x0340('0x2d')],'type':_0x257423[_0x0340('0x2e')][_0x0340('0x2f')]};});_0x4c1f37[_0x0340('0x30')]=_[_0x0340('0x2b')](_0x26475f,_0x0340('0x31'));_0x4c1f37[_0x0340('0x32')]=_[_0x0340('0x33')](_0x241a29['query']);_0x4c1f37['filters']=_[_0x0340('0x34')](_0x4c1f37[_0x0340('0x30')],_0x4c1f37['query']);_0x188ad2[_0x0340('0x35')]=_['intersection'](_0x4c1f37[_0x0340('0x30')],qs[_0x0340('0x36')](_0x241a29[_0x0340('0x32')]['fields']));_0x188ad2['attributes']=_0x188ad2['attributes']['length']?_0x188ad2['attributes']:_0x4c1f37[_0x0340('0x30')];if(!_0x241a29[_0x0340('0x32')][_0x0340('0x37')]('nolimit')){_0x188ad2[_0x0340('0x1b')]=qs[_0x0340('0x1b')](_0x241a29[_0x0340('0x32')][_0x0340('0x1b')]);_0x188ad2[_0x0340('0x19')]=qs[_0x0340('0x19')](_0x241a29[_0x0340('0x32')][_0x0340('0x19')]);}_0x188ad2['order']=qs[_0x0340('0x38')](_0x241a29['query']['sort']);_0x188ad2[_0x0340('0x39')]=qs[_0x0340('0x3a')](_[_0x0340('0x3b')](_0x241a29[_0x0340('0x32')],_0x4c1f37[_0x0340('0x3a')]),_0x26475f);if(_0x241a29[_0x0340('0x32')][_0x0340('0x3c')]){_0x188ad2[_0x0340('0x39')]=_[_0x0340('0x3d')](_0x188ad2[_0x0340('0x39')],{'$or':_['map'](_0x26475f,function(_0x2afbf7){if(_0x2afbf7[_0x0340('0x2e')]!=='VIRTUAL'){var _0x1c3d35={};_0x1c3d35[_0x2afbf7[_0x0340('0x31')]]={'$like':'%'+_0x241a29['query'][_0x0340('0x3c')]+'%'};return _0x1c3d35;}})});}_0x188ad2=_[_0x0340('0x3d')]({},_0x188ad2,_0x241a29[_0x0340('0x3e')]);var _0x10e49b={'where':_0x188ad2[_0x0340('0x39')]};return db[_0x0340('0x3f')][_0x0340('0x1c')](_0x10e49b)[_0x0340('0x23')](function(_0x162333){_0x38d9be[_0x0340('0x1c')]=_0x162333;if(_0x241a29[_0x0340('0x32')][_0x0340('0x40')]){_0x188ad2[_0x0340('0x41')]=[{'all':!![]}];}return db[_0x0340('0x3f')][_0x0340('0x42')](_0x188ad2);})[_0x0340('0x23')](function(_0x4dcff8){_0x38d9be[_0x0340('0x43')]=_0x4dcff8;return _0x38d9be;})[_0x0340('0x23')](respondWithFilteredResult(_0x4fb54b,_0x188ad2))[_0x0340('0x44')](handleError(_0x4fb54b,null));};exports[_0x0340('0x45')]=function(_0x411fd7,_0x3d6e01){var _0x5c4da5={'raw':!![],'where':{'id':_0x411fd7['params']['id']}},_0x56c3cc={};_0x56c3cc['model']=_[_0x0340('0x33')](db['OpenchannelQueueReport'][_0x0340('0x2c')]);_0x56c3cc[_0x0340('0x32')]=_['keys'](_0x411fd7[_0x0340('0x32')]);_0x56c3cc[_0x0340('0x3a')]=_['intersection'](_0x56c3cc[_0x0340('0x30')],_0x56c3cc[_0x0340('0x32')]);_0x5c4da5[_0x0340('0x35')]=_[_0x0340('0x34')](_0x56c3cc[_0x0340('0x30')],qs['fields'](_0x411fd7[_0x0340('0x32')][_0x0340('0x36')]));_0x5c4da5[_0x0340('0x35')]=_0x5c4da5[_0x0340('0x35')][_0x0340('0x46')]?_0x5c4da5[_0x0340('0x35')]:_0x56c3cc[_0x0340('0x30')];if(_0x411fd7[_0x0340('0x32')][_0x0340('0x40')]){_0x5c4da5[_0x0340('0x41')]=[{'all':!![]}];}_0x5c4da5=_['merge']({},_0x5c4da5,_0x411fd7[_0x0340('0x3e')]);return db['OpenchannelQueueReport'][_0x0340('0x47')](_0x5c4da5)[_0x0340('0x23')](handleEntityNotFound(_0x3d6e01,null))[_0x0340('0x23')](respondWithResult(_0x3d6e01,null))['catch'](handleError(_0x3d6e01,null));};exports[_0x0340('0x48')]=function(_0x5e287a,_0x3f56a9){return db['OpenchannelQueueReport'][_0x0340('0x48')](_0x5e287a['body'],{})[_0x0340('0x23')](respondWithResult(_0x3f56a9,0xc9))[_0x0340('0x44')](handleError(_0x3f56a9,null));};exports['update']=function(_0x56c232,_0x178148){if(_0x56c232[_0x0340('0x49')]['id']){delete _0x56c232[_0x0340('0x49')]['id'];}return db[_0x0340('0x3f')][_0x0340('0x47')]({'where':{'id':_0x56c232[_0x0340('0x4a')]['id']}})[_0x0340('0x23')](handleEntityNotFound(_0x178148,null))[_0x0340('0x23')](saveUpdates(_0x56c232[_0x0340('0x49')],null))[_0x0340('0x23')](respondWithResult(_0x178148,null))[_0x0340('0x44')](handleError(_0x178148,null));};exports[_0x0340('0x24')]=function(_0x599217,_0x25d31d){return db[_0x0340('0x3f')][_0x0340('0x47')]({'where':{'id':_0x599217[_0x0340('0x4a')]['id']}})[_0x0340('0x23')](handleEntityNotFound(_0x25d31d,null))[_0x0340('0x23')](removeEntity(_0x25d31d,null))['catch'](handleError(_0x25d31d,null));};exports['describe']=function(_0x462821,_0x20f341){return db[_0x0340('0x3f')]['describe']()['then'](respondWithResult(_0x20f341,null))[_0x0340('0x44')](handleError(_0x20f341,null));};
\ No newline at end of file