Built motion from commit 9e1399f3.|2.5.37
[motion2.git] / server / api / chatQueueReport / chatQueueReport.controller.js
index 0a024c1..f7028fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22b7=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4d1451,_0x26b0a6){var _0x3b16d4=function(_0x1b98ad){while(--_0x1b98ad){_0x4d1451['push'](_0x4d1451['shift']());}};_0x3b16d4(++_0x26b0a6);}(_0x22b7,0x81));var _0x722b=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0x22b7[_0x4ce1b9];return _0x2bb15d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x722b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x722b('0x1'));var jsonpatch=require(_0x722b('0x2'));var rp=require(_0x722b('0x3'));var moment=require(_0x722b('0x4'));var BPromise=require(_0x722b('0x5'));var Mustache=require(_0x722b('0x6'));var util=require(_0x722b('0x7'));var path=require(_0x722b('0x8'));var sox=require('sox');var csv=require(_0x722b('0x9'));var ejs=require(_0x722b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x722b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x722b('0x9'));var querystring=require(_0x722b('0xc'));var Papa=require(_0x722b('0xd'));var Redis=require(_0x722b('0xe'));var authService=require(_0x722b('0xf'));var qs=require(_0x722b('0x10'));var as=require(_0x722b('0x11'));var hardwareService=require(_0x722b('0x12'));var logger=require(_0x722b('0x13'))(_0x722b('0x14'));var utils=require(_0x722b('0x15'));var config=require(_0x722b('0x16'));var licenseUtil=require(_0x722b('0x17'));var db=require(_0x722b('0x18'))['db'];function respondWithStatusCode(_0x5c23d7,_0x2b6535){_0x2b6535=_0x2b6535||0xcc;return function(_0x41ac4b){if(_0x41ac4b){return _0x5c23d7[_0x722b('0x19')](_0x2b6535);}return _0x5c23d7[_0x722b('0x1a')](_0x2b6535)[_0x722b('0x1b')]();};}function respondWithResult(_0x1ccd87,_0x1d6c92){_0x1d6c92=_0x1d6c92||0xc8;return function(_0x47f55e){if(_0x47f55e){return _0x1ccd87[_0x722b('0x1a')](_0x1d6c92)[_0x722b('0x1c')](_0x47f55e);}};}function respondWithFilteredResult(_0xa15e61,_0x3f59ce){return function(_0xb936ea){if(_0xb936ea){var _0xa8e5ba=_0xb936ea[_0x722b('0x1d')],_0x4c78b7=_0x3f59ce[_0x722b('0x1e')],_0x9e3c5f=_0x3f59ce[_0x722b('0x1e')]+_0x3f59ce[_0x722b('0x1f')],_0x5f0351;if(_0x9e3c5f>=_0xa8e5ba){_0x9e3c5f=_0xa8e5ba;_0x5f0351=0xc8;}else{_0x5f0351=0xce;}_0xa15e61['status'](_0x5f0351);return _0xa15e61[_0x722b('0x20')]('Content-Range',_0x4c78b7+'-'+_0x9e3c5f+'/'+_0xa8e5ba)['json'](_0xb936ea);}return null;};}function patchUpdates(_0x3dde52){return function(_0x41e4c7){try{jsonpatch[_0x722b('0x21')](_0x41e4c7,_0x3dde52,!![]);}catch(_0x1d5788){return BPromise[_0x722b('0x22')](_0x1d5788);}return _0x41e4c7['save']();};}function saveUpdates(_0x56c93b,_0x3bf0a2){return function(_0x540f73){if(_0x540f73){return _0x540f73[_0x722b('0x23')](_0x56c93b)[_0x722b('0x24')](function(_0x2e9086){return _0x2e9086;});}return null;};}function removeEntity(_0x521b9e,_0x482bdd){return function(_0x502d5c){if(_0x502d5c){return _0x502d5c[_0x722b('0x25')]()['then'](function(){_0x521b9e[_0x722b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf7fb,_0x193a3d){return function(_0x59cb5e){if(!_0x59cb5e){_0x5bf7fb[_0x722b('0x19')](0x194);}return _0x59cb5e;};}function handleError(_0x25c9ab,_0x15d2e6){_0x15d2e6=_0x15d2e6||0x1f4;return function(_0x4db5cb){logger['error'](_0x4db5cb['stack']);if(_0x4db5cb['name']){delete _0x4db5cb[_0x722b('0x26')];}_0x25c9ab[_0x722b('0x1a')](_0x15d2e6)[_0x722b('0x27')](_0x4db5cb);};}exports[_0x722b('0x28')]=function(_0x224fcf,_0xbac3c4){var _0x198564={},_0x6b15f9={},_0x5951f1={'count':0x0,'rows':[]};var _0x1c91b4=_['map'](db[_0x722b('0x29')][_0x722b('0x2a')],function(_0x2663df){return{'name':_0x2663df[_0x722b('0x2b')],'type':_0x2663df[_0x722b('0x2c')][_0x722b('0x2d')]};});_0x6b15f9['model']=_[_0x722b('0x2e')](_0x1c91b4,_0x722b('0x26'));_0x6b15f9['query']=_[_0x722b('0x2f')](_0x224fcf[_0x722b('0x30')]);_0x6b15f9[_0x722b('0x31')]=_[_0x722b('0x32')](_0x6b15f9[_0x722b('0x33')],_0x6b15f9[_0x722b('0x30')]);_0x198564['attributes']=_[_0x722b('0x32')](_0x6b15f9[_0x722b('0x33')],qs[_0x722b('0x34')](_0x224fcf[_0x722b('0x30')]['fields']));_0x198564[_0x722b('0x35')]=_0x198564[_0x722b('0x35')]['length']?_0x198564[_0x722b('0x35')]:_0x6b15f9[_0x722b('0x33')];if(!_0x224fcf[_0x722b('0x30')]['hasOwnProperty'](_0x722b('0x36'))){_0x198564[_0x722b('0x1f')]=qs[_0x722b('0x1f')](_0x224fcf[_0x722b('0x30')][_0x722b('0x1f')]);_0x198564[_0x722b('0x1e')]=qs[_0x722b('0x1e')](_0x224fcf[_0x722b('0x30')]['offset']);}_0x198564[_0x722b('0x37')]=qs[_0x722b('0x38')](_0x224fcf[_0x722b('0x30')][_0x722b('0x38')]);_0x198564[_0x722b('0x39')]=qs[_0x722b('0x31')](_[_0x722b('0x3a')](_0x224fcf[_0x722b('0x30')],_0x6b15f9[_0x722b('0x31')]),_0x1c91b4);if(_0x224fcf[_0x722b('0x30')]['filter']){_0x198564[_0x722b('0x39')]=_[_0x722b('0x3b')](_0x198564[_0x722b('0x39')],{'$or':_[_0x722b('0x2e')](_0x1c91b4,function(_0x21fdc4){if(_0x21fdc4[_0x722b('0x2c')]!==_0x722b('0x3c')){var _0x573e47={};_0x573e47[_0x21fdc4['name']]={'$like':'%'+_0x224fcf[_0x722b('0x30')]['filter']+'%'};return _0x573e47;}})});}_0x198564=_[_0x722b('0x3b')]({},_0x198564,_0x224fcf[_0x722b('0x3d')]);var _0x3c2351={'where':_0x198564[_0x722b('0x39')]};return db[_0x722b('0x29')]['count'](_0x3c2351)[_0x722b('0x24')](function(_0x5ae352){_0x5951f1[_0x722b('0x1d')]=_0x5ae352;if(_0x224fcf[_0x722b('0x30')][_0x722b('0x3e')]){_0x198564['include']=[{'all':!![]}];}return db[_0x722b('0x29')][_0x722b('0x3f')](_0x198564);})['then'](function(_0x364385){_0x5951f1[_0x722b('0x40')]=_0x364385;return _0x5951f1;})['then'](respondWithFilteredResult(_0xbac3c4,_0x198564))[_0x722b('0x41')](handleError(_0xbac3c4,null));};exports[_0x722b('0x42')]=function(_0x77efb0,_0x1c4fee){var _0x639aff={'raw':!![],'where':{'id':_0x77efb0[_0x722b('0x43')]['id']}},_0x41c9c9={};_0x41c9c9[_0x722b('0x33')]=_[_0x722b('0x2f')](db['ChatQueueReport'][_0x722b('0x2a')]);_0x41c9c9['query']=_[_0x722b('0x2f')](_0x77efb0[_0x722b('0x30')]);_0x41c9c9[_0x722b('0x31')]=_[_0x722b('0x32')](_0x41c9c9['model'],_0x41c9c9[_0x722b('0x30')]);_0x639aff['attributes']=_[_0x722b('0x32')](_0x41c9c9[_0x722b('0x33')],qs[_0x722b('0x34')](_0x77efb0[_0x722b('0x30')][_0x722b('0x34')]));_0x639aff['attributes']=_0x639aff['attributes'][_0x722b('0x44')]?_0x639aff[_0x722b('0x35')]:_0x41c9c9[_0x722b('0x33')];if(_0x77efb0[_0x722b('0x30')]['includeAll']){_0x639aff[_0x722b('0x45')]=[{'all':!![]}];}_0x639aff=_[_0x722b('0x3b')]({},_0x639aff,_0x77efb0['options']);return db[_0x722b('0x29')][_0x722b('0x46')](_0x639aff)[_0x722b('0x24')](handleEntityNotFound(_0x1c4fee,null))[_0x722b('0x24')](respondWithResult(_0x1c4fee,null))[_0x722b('0x41')](handleError(_0x1c4fee,null));};exports[_0x722b('0x47')]=function(_0x16dbe2,_0x57eba1){return db['ChatQueueReport']['create'](_0x16dbe2['body'],{})[_0x722b('0x24')](respondWithResult(_0x57eba1,0xc9))[_0x722b('0x41')](handleError(_0x57eba1,null));};exports[_0x722b('0x23')]=function(_0xb8a06e,_0x54448e){if(_0xb8a06e[_0x722b('0x48')]['id']){delete _0xb8a06e['body']['id'];}return db[_0x722b('0x29')][_0x722b('0x46')]({'where':{'id':_0xb8a06e[_0x722b('0x43')]['id']}})[_0x722b('0x24')](handleEntityNotFound(_0x54448e,null))[_0x722b('0x24')](saveUpdates(_0xb8a06e[_0x722b('0x48')],null))['then'](respondWithResult(_0x54448e,null))['catch'](handleError(_0x54448e,null));};exports[_0x722b('0x25')]=function(_0xae767f,_0x241493){return db['ChatQueueReport'][_0x722b('0x46')]({'where':{'id':_0xae767f['params']['id']}})['then'](handleEntityNotFound(_0x241493,null))[_0x722b('0x24')](removeEntity(_0x241493,null))[_0x722b('0x41')](handleError(_0x241493,null));};exports[_0x722b('0x49')]=function(_0xc52f7f,_0x5f21d2){return db[_0x722b('0x29')][_0x722b('0x49')]()[_0x722b('0x24')](respondWithResult(_0x5f21d2,null))['catch'](handleError(_0x5f21d2,null));};
\ No newline at end of file
+var _0x7524=['../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7524,0xce));var _0x4752=function(_0x41534c,_0x56359f){_0x41534c=_0x41534c-0x0;var _0x4e059b=_0x7524[_0x41534c];return _0x4e059b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4752('0x0'));var zipdir=require(_0x4752('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4752('0x2'));var moment=require(_0x4752('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4752('0x4'));var path=require('path');var sox=require(_0x4752('0x5'));var csv=require(_0x4752('0x6'));var ejs=require(_0x4752('0x7'));var fs=require('fs');var fs_extra=require(_0x4752('0x8'));var _=require(_0x4752('0x9'));var squel=require('squel');var crypto=require(_0x4752('0xa'));var jsforce=require(_0x4752('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4752('0xc'));var Papa=require(_0x4752('0xd'));var Redis=require(_0x4752('0xe'));var authService=require(_0x4752('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4752('0x10'));var hardwareService=require(_0x4752('0x11'));var logger=require(_0x4752('0x12'))(_0x4752('0x13'));var utils=require(_0x4752('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4752('0x15'));var db=require(_0x4752('0x16'))['db'];function respondWithStatusCode(_0x404e5a,_0x2724dd){_0x2724dd=_0x2724dd||0xcc;return function(_0xe6023b){if(_0xe6023b){return _0x404e5a[_0x4752('0x17')](_0x2724dd);}return _0x404e5a[_0x4752('0x18')](_0x2724dd)['end']();};}function respondWithResult(_0xefacbb,_0x479a02){_0x479a02=_0x479a02||0xc8;return function(_0x38e6bb){if(_0x38e6bb){return _0xefacbb[_0x4752('0x18')](_0x479a02)[_0x4752('0x19')](_0x38e6bb);}};}function respondWithFilteredResult(_0x17a8b8,_0x2e53e4){return function(_0x33131a){if(_0x33131a){var _0x410f88=typeof _0x2e53e4['offset']===_0x4752('0x1a')&&typeof _0x2e53e4[_0x4752('0x1b')]==='undefined';var _0x2b80b7=_0x33131a['count'];var _0x1429f4=_0x410f88?0x0:_0x2e53e4[_0x4752('0x1c')];var _0x516f3e=_0x410f88?_0x33131a[_0x4752('0x1d')]:_0x2e53e4['offset']+_0x2e53e4['limit'];var _0x285688;if(_0x516f3e>=_0x2b80b7){_0x516f3e=_0x2b80b7;_0x285688=0xc8;}else{_0x285688=0xce;}_0x17a8b8[_0x4752('0x18')](_0x285688);return _0x17a8b8[_0x4752('0x1e')](_0x4752('0x1f'),_0x1429f4+'-'+_0x516f3e+'/'+_0x2b80b7)[_0x4752('0x19')](_0x33131a);}return null;};}function patchUpdates(_0x3142b){return function(_0x55c67c){try{jsonpatch[_0x4752('0x20')](_0x55c67c,_0x3142b,!![]);}catch(_0x2d2f9e){return BPromise[_0x4752('0x21')](_0x2d2f9e);}return _0x55c67c[_0x4752('0x22')]();};}function saveUpdates(_0x3facf5,_0xaa95a4){return function(_0x593c2d){if(_0x593c2d){return _0x593c2d[_0x4752('0x23')](_0x3facf5)[_0x4752('0x24')](function(_0x54a0bd){return _0x54a0bd;});}return null;};}function removeEntity(_0x11725c,_0x403005){return function(_0x1e4e86){if(_0x1e4e86){return _0x1e4e86[_0x4752('0x25')]()[_0x4752('0x24')](function(){_0x11725c[_0x4752('0x18')](0xcc)[_0x4752('0x26')]();});}};}function handleEntityNotFound(_0x45c557,_0xca8dd1){return function(_0x2c259a){if(!_0x2c259a){_0x45c557['sendStatus'](0x194);}return _0x2c259a;};}function handleError(_0x113cd5,_0x560df8){_0x560df8=_0x560df8||0x1f4;return function(_0x4b2635){logger['error'](_0x4b2635[_0x4752('0x27')]);if(_0x4b2635[_0x4752('0x28')]){delete _0x4b2635[_0x4752('0x28')];}_0x113cd5[_0x4752('0x18')](_0x560df8)[_0x4752('0x29')](_0x4b2635);};}exports[_0x4752('0x2a')]=function(_0xd27309,_0x1dbba0){var _0x486c11={},_0x5745c0={},_0x2e0811={'count':0x0,'rows':[]};var _0x2c3d6d=_[_0x4752('0x2b')](db[_0x4752('0x2c')][_0x4752('0x2d')],function(_0xf8c5f9){return{'name':_0xf8c5f9[_0x4752('0x2e')],'type':_0xf8c5f9[_0x4752('0x2f')][_0x4752('0x30')]};});_0x5745c0[_0x4752('0x31')]=_[_0x4752('0x2b')](_0x2c3d6d,_0x4752('0x28'));_0x5745c0[_0x4752('0x32')]=_[_0x4752('0x33')](_0xd27309[_0x4752('0x32')]);_0x5745c0[_0x4752('0x34')]=_['intersection'](_0x5745c0['model'],_0x5745c0[_0x4752('0x32')]);_0x486c11[_0x4752('0x35')]=_[_0x4752('0x36')](_0x5745c0[_0x4752('0x31')],qs[_0x4752('0x37')](_0xd27309[_0x4752('0x32')][_0x4752('0x37')]));_0x486c11[_0x4752('0x35')]=_0x486c11[_0x4752('0x35')][_0x4752('0x38')]?_0x486c11['attributes']:_0x5745c0[_0x4752('0x31')];if(!_0xd27309['query'][_0x4752('0x39')](_0x4752('0x3a'))){_0x486c11[_0x4752('0x1b')]=qs[_0x4752('0x1b')](_0xd27309[_0x4752('0x32')]['limit']);_0x486c11[_0x4752('0x1c')]=qs['offset'](_0xd27309[_0x4752('0x32')][_0x4752('0x1c')]);}_0x486c11[_0x4752('0x3b')]=qs[_0x4752('0x3c')](_0xd27309[_0x4752('0x32')][_0x4752('0x3c')]);_0x486c11[_0x4752('0x3d')]=qs[_0x4752('0x34')](_[_0x4752('0x3e')](_0xd27309[_0x4752('0x32')],_0x5745c0['filters']),_0x2c3d6d);if(_0xd27309[_0x4752('0x32')][_0x4752('0x3f')]){_0x486c11[_0x4752('0x3d')]=_[_0x4752('0x40')](_0x486c11[_0x4752('0x3d')],{'$or':_[_0x4752('0x2b')](_0x2c3d6d,function(_0x317547){if(_0x317547[_0x4752('0x2f')]!=='VIRTUAL'){var _0x2f6928={};_0x2f6928[_0x317547['name']]={'$like':'%'+_0xd27309[_0x4752('0x32')][_0x4752('0x3f')]+'%'};return _0x2f6928;}})});}_0x486c11=_[_0x4752('0x40')]({},_0x486c11,_0xd27309[_0x4752('0x41')]);var _0x5e32c4={'where':_0x486c11['where']};return db['ChatQueueReport']['count'](_0x5e32c4)[_0x4752('0x24')](function(_0x81303e){_0x2e0811['count']=_0x81303e;if(_0xd27309[_0x4752('0x32')][_0x4752('0x42')]){_0x486c11[_0x4752('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x4752('0x44')](_0x486c11);})[_0x4752('0x24')](function(_0x1ad9d2){_0x2e0811[_0x4752('0x45')]=_0x1ad9d2;return _0x2e0811;})[_0x4752('0x24')](respondWithFilteredResult(_0x1dbba0,_0x486c11))['catch'](handleError(_0x1dbba0,null));};exports['show']=function(_0x3fdbff,_0x31cef5){var _0x828534={'raw':!![],'where':{'id':_0x3fdbff[_0x4752('0x46')]['id']}},_0x222f82={};_0x222f82[_0x4752('0x31')]=_[_0x4752('0x33')](db[_0x4752('0x2c')][_0x4752('0x2d')]);_0x222f82[_0x4752('0x32')]=_[_0x4752('0x33')](_0x3fdbff[_0x4752('0x32')]);_0x222f82['filters']=_[_0x4752('0x36')](_0x222f82['model'],_0x222f82[_0x4752('0x32')]);_0x828534[_0x4752('0x35')]=_['intersection'](_0x222f82[_0x4752('0x31')],qs[_0x4752('0x37')](_0x3fdbff[_0x4752('0x32')][_0x4752('0x37')]));_0x828534[_0x4752('0x35')]=_0x828534[_0x4752('0x35')]['length']?_0x828534[_0x4752('0x35')]:_0x222f82[_0x4752('0x31')];if(_0x3fdbff[_0x4752('0x32')][_0x4752('0x42')]){_0x828534[_0x4752('0x43')]=[{'all':!![]}];}_0x828534=_[_0x4752('0x40')]({},_0x828534,_0x3fdbff['options']);return db[_0x4752('0x2c')][_0x4752('0x47')](_0x828534)[_0x4752('0x24')](handleEntityNotFound(_0x31cef5,null))[_0x4752('0x24')](respondWithResult(_0x31cef5,null))[_0x4752('0x48')](handleError(_0x31cef5,null));};exports[_0x4752('0x49')]=function(_0x47d096,_0x335912){return db['ChatQueueReport']['create'](_0x47d096[_0x4752('0x4a')],{})[_0x4752('0x24')](respondWithResult(_0x335912,0xc9))[_0x4752('0x48')](handleError(_0x335912,null));};exports['update']=function(_0x1a92c6,_0x1ebb03){if(_0x1a92c6['body']['id']){delete _0x1a92c6[_0x4752('0x4a')]['id'];}return db[_0x4752('0x2c')][_0x4752('0x47')]({'where':{'id':_0x1a92c6['params']['id']}})[_0x4752('0x24')](handleEntityNotFound(_0x1ebb03,null))[_0x4752('0x24')](saveUpdates(_0x1a92c6[_0x4752('0x4a')],null))[_0x4752('0x24')](respondWithResult(_0x1ebb03,null))[_0x4752('0x48')](handleError(_0x1ebb03,null));};exports[_0x4752('0x25')]=function(_0x54389f,_0x3b7db0){return db['ChatQueueReport'][_0x4752('0x47')]({'where':{'id':_0x54389f[_0x4752('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b7db0,null))['then'](removeEntity(_0x3b7db0,null))['catch'](handleError(_0x3b7db0,null));};exports['describe']=function(_0x4cf5ac,_0x3ebf27){return db[_0x4752('0x2c')][_0x4752('0x4b')]()[_0x4752('0x24')](respondWithResult(_0x3ebf27,null))['catch'](handleError(_0x3ebf27,null));};
\ No newline at end of file