Built motion from commit (unavailable).|2.4.0
[motion2.git] / server / api / chatQueueReport / chatQueueReport.controller.js
index 3a6c8d8..254d8e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c4b=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','map','type','field','options','ChatQueueReport','includeAll','include','findAll','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x537b36,_0x5a3e4e){var _0x13e302=function(_0x1e15cf){while(--_0x1e15cf){_0x537b36['push'](_0x537b36['shift']());}};_0x13e302(++_0x5a3e4e);}(_0x6c4b,0x1df));var _0xb6c4=function(_0x4a8d6e,_0x45b402){_0x4a8d6e=_0x4a8d6e-0x0;var _0x4d679b=_0x6c4b[_0x4a8d6e];return _0x4d679b;};'use strict';var pdf=require(_0xb6c4('0x0'));var emlformat=require(_0xb6c4('0x1'));var rimraf=require(_0xb6c4('0x2'));var zipdir=require(_0xb6c4('0x3'));var jsonpatch=require(_0xb6c4('0x4'));var rp=require(_0xb6c4('0x5'));var moment=require(_0xb6c4('0x6'));var BPromise=require(_0xb6c4('0x7'));var Mustache=require(_0xb6c4('0x8'));var util=require(_0xb6c4('0x9'));var path=require(_0xb6c4('0xa'));var sox=require('sox');var csv=require(_0xb6c4('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb6c4('0xc'));var crypto=require(_0xb6c4('0xd'));var jsforce=require(_0xb6c4('0xe'));var deskjs=require(_0xb6c4('0xf'));var toCsv=require(_0xb6c4('0xb'));var querystring=require('querystring');var Papa=require(_0xb6c4('0x10'));var authService=require(_0xb6c4('0x11'));var hardwareService=require(_0xb6c4('0x12'));var Redis=require(_0xb6c4('0x13'));var qs=require(_0xb6c4('0x14'));var logger=require(_0xb6c4('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb6c4('0x16'));var db=require(_0xb6c4('0x17'))['db'];function respondWithStatusCode(_0x37b088,_0x2016b3){_0x2016b3=_0x2016b3||0xcc;return function(_0x150aa3){if(_0x150aa3){return _0x37b088['sendStatus'](_0x2016b3);}return _0x37b088[_0xb6c4('0x18')](_0x2016b3)[_0xb6c4('0x19')]();};}function respondWithResult(_0x4cd30c,_0x2b869f){_0x2b869f=_0x2b869f||0xc8;return function(_0x472ddb){if(_0x472ddb){return _0x4cd30c[_0xb6c4('0x18')](_0x2b869f)[_0xb6c4('0x1a')](_0x472ddb);}};}function respondWithFilteredResult(_0x1d3b6d,_0x35eec8){return function(_0x520f05){if(_0x520f05){var _0x3705d5=_0x520f05[_0xb6c4('0x1b')],_0x42a2a8=_0x35eec8[_0xb6c4('0x1c')],_0x4c8a8e=_0x35eec8[_0xb6c4('0x1c')]+_0x35eec8[_0xb6c4('0x1d')],_0x473e65;if(_0x4c8a8e>=_0x3705d5){_0x4c8a8e=_0x3705d5;_0x473e65=0xc8;}else{_0x473e65=0xce;}_0x1d3b6d[_0xb6c4('0x18')](_0x473e65);return _0x1d3b6d[_0xb6c4('0x1e')]('Content-Range',_0x42a2a8+'-'+_0x4c8a8e+'/'+_0x3705d5)[_0xb6c4('0x1a')](_0x520f05);}return null;};}function patchUpdates(_0x50b943){return function(_0xd55eed){try{jsonpatch['apply'](_0xd55eed,_0x50b943,!![]);}catch(_0x56241e){return BPromise['reject'](_0x56241e);}return _0xd55eed['save']();};}function saveUpdates(_0x4b8dad,_0x6bfc70){return function(_0x33acf5){if(_0x33acf5){return _0x33acf5[_0xb6c4('0x1f')](_0x4b8dad)[_0xb6c4('0x20')](function(_0x22e66e){return _0x22e66e;});}return null;};}function removeEntity(_0x5397fc,_0x51dc5b){return function(_0x5e33d6){if(_0x5e33d6){return _0x5e33d6[_0xb6c4('0x21')]()[_0xb6c4('0x20')](function(){_0x5397fc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x484d6d,_0x5d5919){return function(_0x184c89){if(!_0x184c89){_0x484d6d[_0xb6c4('0x22')](0x194);}return _0x184c89;};}function handleError(_0x3f9f08,_0x491881){_0x491881=_0x491881||0x1f4;return function(_0xa5ea3d){logger['error'](_0xa5ea3d[_0xb6c4('0x23')]);if(_0xa5ea3d[_0xb6c4('0x24')]){delete _0xa5ea3d[_0xb6c4('0x24')];}_0x3f9f08[_0xb6c4('0x18')](_0x491881)[_0xb6c4('0x25')](_0xa5ea3d);};}exports[_0xb6c4('0x26')]=function(_0xdc39f7,_0x16cadb){var _0x518856={},_0x340b9a={},_0x1bb7a3={'count':0x0,'rows':[]};var _0x18fcc8=db['ChatQueueReport'][_0xb6c4('0x27')];_0x340b9a[_0xb6c4('0x28')]=_[_0xb6c4('0x29')](_0x18fcc8);_0x340b9a[_0xb6c4('0x2a')]=_[_0xb6c4('0x29')](_0xdc39f7['query']);_0x340b9a[_0xb6c4('0x2b')]=_[_0xb6c4('0x2c')](_0x340b9a[_0xb6c4('0x28')],_0x340b9a[_0xb6c4('0x2a')]);_0x518856['attributes']=_['intersection'](_0x340b9a['model'],qs[_0xb6c4('0x2d')](_0xdc39f7[_0xb6c4('0x2a')]['fields']));_0x518856[_0xb6c4('0x2e')]=_0x518856[_0xb6c4('0x2e')][_0xb6c4('0x2f')]?_0x518856[_0xb6c4('0x2e')]:_0x340b9a[_0xb6c4('0x28')];if(!_0xdc39f7['query'][_0xb6c4('0x30')]('nolimit')){_0x518856[_0xb6c4('0x1d')]=qs[_0xb6c4('0x1d')](_0xdc39f7[_0xb6c4('0x2a')][_0xb6c4('0x1d')]);_0x518856[_0xb6c4('0x1c')]=qs['offset'](_0xdc39f7['query']['offset']);}_0x518856[_0xb6c4('0x31')]=qs[_0xb6c4('0x32')](_0xdc39f7[_0xb6c4('0x2a')][_0xb6c4('0x32')]);_0x518856['where']=qs['filters'](_[_0xb6c4('0x33')](_0xdc39f7[_0xb6c4('0x2a')],_0x340b9a[_0xb6c4('0x2b')]));if(_0xdc39f7['query']['filter']){_0x518856[_0xb6c4('0x34')]=_[_0xb6c4('0x35')](_0x518856['where'],{'$or':_[_0xb6c4('0x36')](_0x18fcc8,function(_0xb5b6){if(_0xb5b6[_0xb6c4('0x37')]['key']!=='VIRTUAL'){var _0x4d1195={};_0x4d1195[_0xb5b6[_0xb6c4('0x38')]]={'$like':'%'+_0xdc39f7['query']['filter']+'%'};return _0x4d1195;}})});}_0x518856=_[_0xb6c4('0x35')]({},_0x518856,_0xdc39f7[_0xb6c4('0x39')]);var _0x32de5b={'where':_0x518856[_0xb6c4('0x34')]};return db[_0xb6c4('0x3a')][_0xb6c4('0x1b')](_0x32de5b)[_0xb6c4('0x20')](function(_0x59406d){_0x1bb7a3['count']=_0x59406d;if(_0xdc39f7[_0xb6c4('0x2a')][_0xb6c4('0x3b')]){_0x518856[_0xb6c4('0x3c')]=[{'all':!![]}];}return db[_0xb6c4('0x3a')][_0xb6c4('0x3d')](_0x518856);})[_0xb6c4('0x20')](function(_0x37d252){_0x1bb7a3['rows']=_0x37d252;return _0x1bb7a3;})[_0xb6c4('0x20')](respondWithFilteredResult(_0x16cadb,_0x518856))[_0xb6c4('0x3e')](handleError(_0x16cadb,null));};exports[_0xb6c4('0x3f')]=function(_0x21f819,_0x30a302){var _0x285bb1={'raw':!![],'where':{'id':_0x21f819['params']['id']}},_0x354413={};_0x354413[_0xb6c4('0x28')]=_[_0xb6c4('0x29')](db[_0xb6c4('0x3a')][_0xb6c4('0x27')]);_0x354413[_0xb6c4('0x2a')]=_[_0xb6c4('0x29')](_0x21f819[_0xb6c4('0x2a')]);_0x354413['filters']=_[_0xb6c4('0x2c')](_0x354413[_0xb6c4('0x28')],_0x354413[_0xb6c4('0x2a')]);_0x285bb1[_0xb6c4('0x2e')]=_[_0xb6c4('0x2c')](_0x354413[_0xb6c4('0x28')],qs['fields'](_0x21f819['query']['fields']));_0x285bb1[_0xb6c4('0x2e')]=_0x285bb1[_0xb6c4('0x2e')][_0xb6c4('0x2f')]?_0x285bb1[_0xb6c4('0x2e')]:_0x354413[_0xb6c4('0x28')];if(_0x21f819[_0xb6c4('0x2a')][_0xb6c4('0x3b')]){_0x285bb1['include']=[{'all':!![]}];}_0x285bb1=_[_0xb6c4('0x35')]({},_0x285bb1,_0x21f819[_0xb6c4('0x39')]);return db['ChatQueueReport'][_0xb6c4('0x40')](_0x285bb1)[_0xb6c4('0x20')](handleEntityNotFound(_0x30a302,null))[_0xb6c4('0x20')](respondWithResult(_0x30a302,null))[_0xb6c4('0x3e')](handleError(_0x30a302,null));};exports[_0xb6c4('0x41')]=function(_0x238ed3,_0x585769){return db[_0xb6c4('0x3a')][_0xb6c4('0x41')](_0x238ed3[_0xb6c4('0x42')],{})['then'](respondWithResult(_0x585769,0xc9))['catch'](handleError(_0x585769,null));};exports['update']=function(_0x9f56b6,_0x242642){if(_0x9f56b6[_0xb6c4('0x42')]['id']){delete _0x9f56b6[_0xb6c4('0x42')]['id'];}return db[_0xb6c4('0x3a')][_0xb6c4('0x40')]({'where':{'id':_0x9f56b6['params']['id']}})[_0xb6c4('0x20')](handleEntityNotFound(_0x242642,null))[_0xb6c4('0x20')](saveUpdates(_0x9f56b6['body'],null))[_0xb6c4('0x20')](respondWithResult(_0x242642,null))['catch'](handleError(_0x242642,null));};exports[_0xb6c4('0x21')]=function(_0x42a234,_0x130a90){return db[_0xb6c4('0x3a')][_0xb6c4('0x40')]({'where':{'id':_0x42a234[_0xb6c4('0x43')]['id']}})[_0xb6c4('0x20')](handleEntityNotFound(_0x130a90,null))[_0xb6c4('0x20')](removeEntity(_0x130a90,null))[_0xb6c4('0x3e')](handleError(_0x130a90,null));};exports[_0xb6c4('0x44')]=function(_0x352351,_0x7bfe64){return db['ChatQueueReport']['describe']()[_0xb6c4('0x20')](respondWithResult(_0x7bfe64,null))['catch'](handleError(_0x7bfe64,null));};
\ No newline at end of file
+var _0x0f79=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','error','name','send','index','ChatQueueReport','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','field','options','includeAll','include','findAll','catch','params','intersection','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x4c9485,_0x64ea54){var _0x5a3534=function(_0x3de70d){while(--_0x3de70d){_0x4c9485['push'](_0x4c9485['shift']());}};_0x5a3534(++_0x64ea54);}(_0x0f79,0x7c));var _0x90f7=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x0f79[_0x280f4a];return _0x1bb157;};'use strict';var pdf=require(_0x90f7('0x0'));var emlformat=require(_0x90f7('0x1'));var rimraf=require(_0x90f7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90f7('0x3'));var rp=require(_0x90f7('0x4'));var moment=require(_0x90f7('0x5'));var BPromise=require(_0x90f7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x90f7('0x7'));var sox=require(_0x90f7('0x8'));var csv=require(_0x90f7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x90f7('0xa'));var squel=require(_0x90f7('0xb'));var crypto=require(_0x90f7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x90f7('0xd'));var toCsv=require(_0x90f7('0x9'));var querystring=require(_0x90f7('0xe'));var Papa=require('papaparse');var Redis=require(_0x90f7('0xf'));var authService=require(_0x90f7('0x10'));var qs=require(_0x90f7('0x11'));var hardwareService=require(_0x90f7('0x12'));var logger=require(_0x90f7('0x13'))(_0x90f7('0x14'));var utils=require(_0x90f7('0x15'));var config=require(_0x90f7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x362e7b,_0x4be401){_0x4be401=_0x4be401||0xcc;return function(_0x2107d6){if(_0x2107d6){return _0x362e7b[_0x90f7('0x17')](_0x4be401);}return _0x362e7b[_0x90f7('0x18')](_0x4be401)[_0x90f7('0x19')]();};}function respondWithResult(_0x2dcb94,_0x2fc12e){_0x2fc12e=_0x2fc12e||0xc8;return function(_0x54059c){if(_0x54059c){return _0x2dcb94[_0x90f7('0x18')](_0x2fc12e)[_0x90f7('0x1a')](_0x54059c);}};}function respondWithFilteredResult(_0x353827,_0xd29e29){return function(_0x3f69c5){if(_0x3f69c5){var _0x4bc6bb=_0x3f69c5[_0x90f7('0x1b')],_0x2a36b7=_0xd29e29[_0x90f7('0x1c')],_0x33fd79=_0xd29e29['offset']+_0xd29e29[_0x90f7('0x1d')],_0x10d176;if(_0x33fd79>=_0x4bc6bb){_0x33fd79=_0x4bc6bb;_0x10d176=0xc8;}else{_0x10d176=0xce;}_0x353827['status'](_0x10d176);return _0x353827['set']('Content-Range',_0x2a36b7+'-'+_0x33fd79+'/'+_0x4bc6bb)[_0x90f7('0x1a')](_0x3f69c5);}return null;};}function patchUpdates(_0x2c805b){return function(_0x3b426e){try{jsonpatch['apply'](_0x3b426e,_0x2c805b,!![]);}catch(_0x4b5fad){return BPromise[_0x90f7('0x1e')](_0x4b5fad);}return _0x3b426e[_0x90f7('0x1f')]();};}function saveUpdates(_0x3167bd,_0x383dde){return function(_0x250b1c){if(_0x250b1c){return _0x250b1c[_0x90f7('0x20')](_0x3167bd)[_0x90f7('0x21')](function(_0x1a0f42){return _0x1a0f42;});}return null;};}function removeEntity(_0x5e433f,_0x3a8e6b){return function(_0x1f4d46){if(_0x1f4d46){return _0x1f4d46[_0x90f7('0x22')]()[_0x90f7('0x21')](function(){_0x5e433f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ca62d,_0x34518e){return function(_0x5a7ee9){if(!_0x5a7ee9){_0x4ca62d[_0x90f7('0x17')](0x194);}return _0x5a7ee9;};}function handleError(_0x1b7712,_0x100330){_0x100330=_0x100330||0x1f4;return function(_0x2416a9){logger[_0x90f7('0x23')](_0x2416a9['stack']);if(_0x2416a9[_0x90f7('0x24')]){delete _0x2416a9[_0x90f7('0x24')];}_0x1b7712[_0x90f7('0x18')](_0x100330)[_0x90f7('0x25')](_0x2416a9);};}exports[_0x90f7('0x26')]=function(_0x209e83,_0x4a91f4){var _0x4cac03={},_0x4144c5={},_0x1b845b={'count':0x0,'rows':[]};var _0x4264a7=db[_0x90f7('0x27')][_0x90f7('0x28')];_0x4144c5[_0x90f7('0x29')]=_[_0x90f7('0x2a')](_0x4264a7);_0x4144c5[_0x90f7('0x2b')]=_['keys'](_0x209e83[_0x90f7('0x2b')]);_0x4144c5[_0x90f7('0x2c')]=_['intersection'](_0x4144c5[_0x90f7('0x29')],_0x4144c5[_0x90f7('0x2b')]);_0x4cac03[_0x90f7('0x2d')]=_['intersection'](_0x4144c5[_0x90f7('0x29')],qs[_0x90f7('0x2e')](_0x209e83[_0x90f7('0x2b')][_0x90f7('0x2e')]));_0x4cac03[_0x90f7('0x2d')]=_0x4cac03[_0x90f7('0x2d')][_0x90f7('0x2f')]?_0x4cac03[_0x90f7('0x2d')]:_0x4144c5[_0x90f7('0x29')];if(!_0x209e83[_0x90f7('0x2b')][_0x90f7('0x30')]('nolimit')){_0x4cac03[_0x90f7('0x1d')]=qs[_0x90f7('0x1d')](_0x209e83['query'][_0x90f7('0x1d')]);_0x4cac03[_0x90f7('0x1c')]=qs[_0x90f7('0x1c')](_0x209e83[_0x90f7('0x2b')][_0x90f7('0x1c')]);}_0x4cac03[_0x90f7('0x31')]=qs[_0x90f7('0x32')](_0x209e83[_0x90f7('0x2b')]['sort']);_0x4cac03['where']=qs[_0x90f7('0x2c')](_[_0x90f7('0x33')](_0x209e83['query'],_0x4144c5['filters']));if(_0x209e83[_0x90f7('0x2b')][_0x90f7('0x34')]){_0x4cac03[_0x90f7('0x35')]=_[_0x90f7('0x36')](_0x4cac03[_0x90f7('0x35')],{'$or':_[_0x90f7('0x37')](_0x4264a7,function(_0x523c41){if(_0x523c41[_0x90f7('0x38')]['key']!==_0x90f7('0x39')){var _0x5d6d45={};_0x5d6d45[_0x523c41[_0x90f7('0x3a')]]={'$like':'%'+_0x209e83[_0x90f7('0x2b')][_0x90f7('0x34')]+'%'};return _0x5d6d45;}})});}_0x4cac03=_[_0x90f7('0x36')]({},_0x4cac03,_0x209e83[_0x90f7('0x3b')]);var _0x256639={'where':_0x4cac03[_0x90f7('0x35')]};return db[_0x90f7('0x27')][_0x90f7('0x1b')](_0x256639)[_0x90f7('0x21')](function(_0x20dfe3){_0x1b845b[_0x90f7('0x1b')]=_0x20dfe3;if(_0x209e83[_0x90f7('0x2b')][_0x90f7('0x3c')]){_0x4cac03[_0x90f7('0x3d')]=[{'all':!![]}];}return db[_0x90f7('0x27')][_0x90f7('0x3e')](_0x4cac03);})[_0x90f7('0x21')](function(_0x3c8b52){_0x1b845b['rows']=_0x3c8b52;return _0x1b845b;})[_0x90f7('0x21')](respondWithFilteredResult(_0x4a91f4,_0x4cac03))[_0x90f7('0x3f')](handleError(_0x4a91f4,null));};exports['show']=function(_0x31f35d,_0x56068c){var _0x2bf3a2={'raw':!![],'where':{'id':_0x31f35d[_0x90f7('0x40')]['id']}},_0x1c754e={};_0x1c754e[_0x90f7('0x29')]=_['keys'](db[_0x90f7('0x27')][_0x90f7('0x28')]);_0x1c754e[_0x90f7('0x2b')]=_[_0x90f7('0x2a')](_0x31f35d[_0x90f7('0x2b')]);_0x1c754e['filters']=_[_0x90f7('0x41')](_0x1c754e[_0x90f7('0x29')],_0x1c754e[_0x90f7('0x2b')]);_0x2bf3a2[_0x90f7('0x2d')]=_[_0x90f7('0x41')](_0x1c754e['model'],qs[_0x90f7('0x2e')](_0x31f35d[_0x90f7('0x2b')]['fields']));_0x2bf3a2[_0x90f7('0x2d')]=_0x2bf3a2[_0x90f7('0x2d')]['length']?_0x2bf3a2['attributes']:_0x1c754e['model'];if(_0x31f35d[_0x90f7('0x2b')][_0x90f7('0x3c')]){_0x2bf3a2[_0x90f7('0x3d')]=[{'all':!![]}];}_0x2bf3a2=_[_0x90f7('0x36')]({},_0x2bf3a2,_0x31f35d[_0x90f7('0x3b')]);return db[_0x90f7('0x27')][_0x90f7('0x42')](_0x2bf3a2)[_0x90f7('0x21')](handleEntityNotFound(_0x56068c,null))[_0x90f7('0x21')](respondWithResult(_0x56068c,null))[_0x90f7('0x3f')](handleError(_0x56068c,null));};exports[_0x90f7('0x43')]=function(_0x2ee9b0,_0xb2233){return db['ChatQueueReport'][_0x90f7('0x43')](_0x2ee9b0[_0x90f7('0x44')],{})[_0x90f7('0x21')](respondWithResult(_0xb2233,0xc9))[_0x90f7('0x3f')](handleError(_0xb2233,null));};exports['update']=function(_0x4c52d5,_0x55ab91){if(_0x4c52d5['body']['id']){delete _0x4c52d5['body']['id'];}return db[_0x90f7('0x27')][_0x90f7('0x42')]({'where':{'id':_0x4c52d5[_0x90f7('0x40')]['id']}})['then'](handleEntityNotFound(_0x55ab91,null))[_0x90f7('0x21')](saveUpdates(_0x4c52d5[_0x90f7('0x44')],null))[_0x90f7('0x21')](respondWithResult(_0x55ab91,null))[_0x90f7('0x3f')](handleError(_0x55ab91,null));};exports['destroy']=function(_0x18636f,_0x27cb34){return db['ChatQueueReport']['find']({'where':{'id':_0x18636f['params']['id']}})[_0x90f7('0x21')](handleEntityNotFound(_0x27cb34,null))['then'](removeEntity(_0x27cb34,null))[_0x90f7('0x3f')](handleError(_0x27cb34,null));};exports['describe']=function(_0x41d212,_0x18b19d){return db['ChatQueueReport']['describe']()[_0x90f7('0x21')](respondWithResult(_0x18b19d,null))[_0x90f7('0x3f')](handleError(_0x18b19d,null));};
\ No newline at end of file