Built motion from commit de2cb856.|2.0.35
[motion2.git] / server / api / chatQueueReport / chatQueueReport.controller.js
1 var _0xeeb2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x61\x73\x74\x2D\x6A\x73\x6F\x6E\x2D\x70\x61\x74\x63\x68","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x6D\x6F\x6D\x65\x6E\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x75\x73\x74\x61\x63\x68\x65","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x73\x6F\x78","\x74\x6F\x2D\x63\x73\x76","\x65\x6A\x73","\x66\x73","\x6C\x6F\x64\x61\x73\x68","\x73\x71\x75\x65\x6C","\x63\x72\x79\x70\x74\x6F","\x6A\x73\x66\x6F\x72\x63\x65","\x64\x65\x73\x6B\x2E\x6A\x73","\x71\x75\x65\x72\x79\x73\x74\x72\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x70\x61\x72\x73\x65\x72\x73\x2F\x71\x73","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x64\x62","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x79\x73\x71\x6C\x64\x62","\x43\x68\x61\x74\x51\x75\x65\x75\x65\x52\x65\x70\x6F\x72\x74\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73","\x6E\x6F\x20\x63\x6F\x6E\x74\x65\x6E\x74","\x69\x6E\x66\x6F","\x43\x68\x61\x74\x51\x75\x65\x75\x65\x52\x65\x70\x6F\x72\x74\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73","\x64\x65\x62\x75\x67","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x65\x6E\x74\x69\x74\x79\x20\x66\x6F\x75\x6E\x64","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x6A\x73\x6F\x6E","\x63\x6F\x75\x6E\x74","\x6F\x66\x66\x73\x65\x74","\x6C\x69\x6D\x69\x74","\x65\x6E\x74\x69\x74\x69\x65\x73\x20\x66\x6F\x75\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x52\x61\x6E\x67\x65","\x2D","\x2F","\x73\x65\x74","\x61\x70\x70\x6C\x79","\x72\x65\x6A\x65\x63\x74","\x73\x61\x76\x65","\x65\x6E\x74\x69\x74\x79\x20\x75\x70\x64\x61\x74\x65\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65","\x65\x6E\x74\x69\x74\x79\x20\x72\x65\x6D\x6F\x76\x65\x64","\x64\x65\x73\x74\x72\x6F\x79","\x65\x6E\x74\x69\x74\x79\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x65\x72\x72\x6F\x72","\x69\x6E\x73\x70\x65\x63\x74","\x6E\x61\x6D\x65","\x73\x65\x6E\x64","\x69\x6E\x64\x65\x78","\x6D\x6F\x64\x65\x6C","\x72\x61\x77\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x43\x68\x61\x74\x51\x75\x65\x75\x65\x52\x65\x70\x6F\x72\x74","\x6B\x65\x79\x73","\x71\x75\x65\x72\x79","\x66\x69\x6C\x74\x65\x72\x73","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x69\x6F\x6E","\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x66\x69\x65\x6C\x64\x73","\x6C\x65\x6E\x67\x74\x68","\x6E\x6F\x6C\x69\x6D\x69\x74","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x6F\x72\x64\x65\x72","\x73\x6F\x72\x74","\x77\x68\x65\x72\x65","\x70\x69\x63\x6B","\x66\x69\x6C\x74\x65\x72","\x25","\x6D\x61\x70","\x6D\x65\x72\x67\x65","\x6F\x70\x74\x69\x6F\x6E\x73","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x64\x65\x73\x63\x72\x69\x62\x65"];_0xeeb2[0];var jsonpatch=require(_0xeeb2[1]);var rp=require(_0xeeb2[2]);var moment=require(_0xeeb2[3]);var BPromise=require(_0xeeb2[4]);var Mustache=require(_0xeeb2[5]);var util=require(_0xeeb2[6]);var path=require(_0xeeb2[7]);var sox=require(_0xeeb2[8]);var csv=require(_0xeeb2[9]);var ejs=require(_0xeeb2[10]);var fs=require(_0xeeb2[11]);var _=require(_0xeeb2[12]);var squel=require(_0xeeb2[13]);var crypto=require(_0xeeb2[14]);var jsforce=require(_0xeeb2[15]);var deskjs=require(_0xeeb2[16]);var toCsv=require(_0xeeb2[9]);var querystring=require(_0xeeb2[17]);var qs=require(_0xeeb2[18]);var logger=require(_0xeeb2[20])(_0xeeb2[19]);var utils=require(_0xeeb2[21]);var config=require(_0xeeb2[22]);var db=require(_0xeeb2[24])[_0xeeb2[23]];function respondWithStatusCode(_0xf54ex19,_0xf54ex1a,_0xf54ex1b){_0xf54ex1a= _0xf54ex1a|| 204;return function(_0xf54ex1c){if(_0xf54ex1c){logger[_0xeeb2[27]](_0xeeb2[25],_0xf54ex1b,_0xf54ex1a,_0xeeb2[26]);logger[_0xeeb2[29]](_0xeeb2[28],_0xf54ex1b,_0xf54ex1a,_0xeeb2[26]);return _0xf54ex19[_0xeeb2[30]](_0xf54ex1a)};return _0xf54ex19[_0xeeb2[32]](_0xf54ex1a)[_0xeeb2[31]]()}}function respondWithResult(_0xf54ex19,_0xf54ex1a,_0xf54ex1b){_0xf54ex1a= _0xf54ex1a|| 200;return function(_0xf54ex1c){if(_0xf54ex1c){logger[_0xeeb2[27]](_0xeeb2[25],_0xf54ex1b,_0xf54ex1a,_0xeeb2[33]);logger[_0xeeb2[29]](_0xeeb2[28],_0xf54ex1b,_0xf54ex1a,_0xeeb2[33],JSON[_0xeeb2[34]](_0xf54ex1c));return _0xf54ex19[_0xeeb2[32]](_0xf54ex1a)[_0xeeb2[35]](_0xf54ex1c)}}}function respondWithFilteredResult(_0xf54ex19,_0xf54ex1f,_0xf54ex1b){return function(_0xf54ex1c){if(_0xf54ex1c){var _0xf54ex20=_0xf54ex1c[_0xeeb2[36]],_0xf54ex21=_0xf54ex1f[_0xeeb2[37]],_0xf54ex22=_0xf54ex1f[_0xeeb2[37]]+ _0xf54ex1f[_0xeeb2[38]],_0xf54ex1a;if(_0xf54ex22>= _0xf54ex20){_0xf54ex22= _0xf54ex20;_0xf54ex1a= 200}else {_0xf54ex1a= 206};_0xf54ex19[_0xeeb2[32]](_0xf54ex1a);logger[_0xeeb2[27]](_0xeeb2[25],_0xf54ex1b,_0xf54ex1a,_0xeeb2[39]);logger[_0xeeb2[29]](_0xeeb2[28],_0xf54ex1b,_0xf54ex1a,_0xeeb2[33],JSON[_0xeeb2[34]](_0xf54ex1c));return _0xf54ex19[_0xeeb2[43]](_0xeeb2[40],_0xf54ex21+ _0xeeb2[41]+ _0xf54ex22+ _0xeeb2[42]+ _0xf54ex20)[_0xeeb2[35]](_0xf54ex1c)};return null}}function patchUpdates(_0xf54ex24){return function(_0xf54ex1c){try{jsonpatch[_0xeeb2[44]](_0xf54ex1c,_0xf54ex24,true)}catch(err){return BPromise[_0xeeb2[45]](err)};return _0xf54ex1c[_0xeeb2[46]]()}}function saveUpdates(_0xf54ex26,_0xf54ex1a,_0xf54ex1b){return function(_0xf54ex1c){if(_0xf54ex1c){return _0xf54ex1c[_0xeeb2[49]](_0xf54ex26)[_0xeeb2[48]](function(_0xf54ex27){logger[_0xeeb2[27]](_0xeeb2[25],_0xf54ex1b,_0xf54ex1a,_0xeeb2[47]);logger[_0xeeb2[29]](_0xeeb2[28],_0xf54ex1b,_0xf54ex1a,_0xeeb2[47],JSON[_0xeeb2[34]](_0xf54ex1c));return _0xf54ex27})};return null}}function removeEntity(_0xf54ex19,_0xf54ex1a,_0xf54ex1b){return function(_0xf54ex1c){if(_0xf54ex1c){return _0xf54ex1c[_0xeeb2[51]]()[_0xeeb2[48]](function(){logger[_0xeeb2[27]](_0xeeb2[25],_0xf54ex1b,_0xf54ex1a,_0xeeb2[50]);logger[_0xeeb2[29]](_0xeeb2[28],_0xf54ex1b,_0xf54ex1a,_0xeeb2[50],JSON[_0xeeb2[34]](_0xf54ex1c));_0xf54ex19[_0xeeb2[32]](204)[_0xeeb2[31]]()})}}}function handleEntityNotFound(_0xf54ex19,_0xf54ex1a,_0xf54ex1b){return function(_0xf54ex1c){if(!_0xf54ex1c){logger[_0xeeb2[53]](_0xeeb2[25],_0xf54ex1b,404,_0xeeb2[52]);_0xf54ex19[_0xeeb2[30]](404)};return _0xf54ex1c}}function handleError(_0xf54ex19,_0xf54ex1a,_0xf54ex1b){_0xf54ex1a= _0xf54ex1a|| 500;return function(_0xf54ex2b){logger[_0xeeb2[53]](_0xeeb2[25],_0xf54ex1b,_0xf54ex1a,util[_0xeeb2[54]](_0xf54ex2b,{showHidden:false,depth:null}));delete _0xf54ex2b[_0xeeb2[55]];_0xf54ex19[_0xeeb2[32]](_0xf54ex1a)[_0xeeb2[56]](_0xf54ex2b)}}exports[_0xeeb2[57]]= function(_0xf54ex2c,_0xf54ex19){var _0xf54ex1f={},_0xf54ex2d={};_0xf54ex2d[_0xeeb2[58]]= _[_0xeeb2[61]](db[_0xeeb2[60]][_0xeeb2[59]]);_0xf54ex2d[_0xeeb2[62]]= _[_0xeeb2[61]](_0xf54ex2c[_0xeeb2[62]]);_0xf54ex2d[_0xeeb2[63]]= _[_0xeeb2[64]](_0xf54ex2d[_0xeeb2[58]],_0xf54ex2d[_0xeeb2[62]]);_0xf54ex1f[_0xeeb2[65]]= _[_0xeeb2[64]](_0xf54ex2d[_0xeeb2[58]],qs[_0xeeb2[66]](_0xf54ex2c[_0xeeb2[62]][_0xeeb2[66]]));_0xf54ex1f[_0xeeb2[65]]= (_0xf54ex1f[_0xeeb2[65]][_0xeeb2[67]])?_0xf54ex1f[_0xeeb2[65]]:_0xf54ex2d[_0xeeb2[58]];if(!_0xf54ex2c[_0xeeb2[62]][_0xeeb2[69]](_0xeeb2[68])){_0xf54ex1f[_0xeeb2[38]]= qs[_0xeeb2[38]](_0xf54ex2c[_0xeeb2[62]][_0xeeb2[38]]);_0xf54ex1f[_0xeeb2[37]]= qs[_0xeeb2[37]](_0xf54ex2c[_0xeeb2[62]][_0xeeb2[37]])};_0xf54ex1f[_0xeeb2[70]]= qs[_0xeeb2[71]](_0xf54ex2c[_0xeeb2[62]][_0xeeb2[71]]);_0xf54ex1f[_0xeeb2[72]]= qs[_0xeeb2[63]](_[_0xeeb2[73]](_0xf54ex2c[_0xeeb2[62]],_0xf54ex2d[_0xeeb2[63]]));if(_0xf54ex2c[_0xeeb2[62]][_0xeeb2[74]]){_0xf54ex1f[_0xeeb2[72]]= _[_0xeeb2[77]](_0xf54ex1f[_0xeeb2[72]],{$or:_[_0xeeb2[76]](_0xf54ex1f[_0xeeb2[65]],function(_0xf54ex2e){var _0xf54ex2f={};_0xf54ex2f[_0xf54ex2e]= {$like:_0xeeb2[75]+ _0xf54ex2c[_0xeeb2[62]][_0xeeb2[74]]+ _0xeeb2[75]};return _0xf54ex2f})})};_0xf54ex1f= _[_0xeeb2[77]]({},_0xf54ex1f,_0xf54ex2c[_0xeeb2[78]]);return db[_0xeeb2[60]][_0xeeb2[80]](_0xf54ex1f)[_0xeeb2[48]](respondWithFilteredResult(_0xf54ex19,_0xf54ex1f,_0xeeb2[57]))[_0xeeb2[79]](handleError(_0xf54ex19,null,_0xeeb2[57]))};exports[_0xeeb2[81]]= function(_0xf54ex2c,_0xf54ex19){var _0xf54ex1f={raw:true,where:{id:_0xf54ex2c[_0xeeb2[83]][_0xeeb2[82]]}},_0xf54ex2d={};_0xf54ex2d[_0xeeb2[58]]= _[_0xeeb2[61]](db[_0xeeb2[60]][_0xeeb2[59]]);_0xf54ex2d[_0xeeb2[62]]= _[_0xeeb2[61]](_0xf54ex2c[_0xeeb2[62]]);_0xf54ex2d[_0xeeb2[63]]= _[_0xeeb2[64]](_0xf54ex2d[_0xeeb2[58]],_0xf54ex2d[_0xeeb2[62]]);_0xf54ex1f[_0xeeb2[65]]= _[_0xeeb2[64]](_0xf54ex2d[_0xeeb2[58]],qs[_0xeeb2[66]](_0xf54ex2c[_0xeeb2[62]][_0xeeb2[66]]));_0xf54ex1f[_0xeeb2[65]]= (_0xf54ex1f[_0xeeb2[65]][_0xeeb2[67]])?_0xf54ex1f[_0xeeb2[65]]:_0xf54ex2d[_0xeeb2[58]];_0xf54ex1f= _[_0xeeb2[77]]({},_0xf54ex1f,_0xf54ex2c[_0xeeb2[78]]);return db[_0xeeb2[60]][_0xeeb2[84]](_0xf54ex1f)[_0xeeb2[48]](handleEntityNotFound(_0xf54ex19,null,_0xeeb2[81]))[_0xeeb2[48]](respondWithResult(_0xf54ex19,null,_0xeeb2[81]))[_0xeeb2[79]](handleError(_0xf54ex19,null,_0xeeb2[81]))};exports[_0xeeb2[85]]= function(_0xf54ex2c,_0xf54ex19){return db[_0xeeb2[60]][_0xeeb2[85]](_0xf54ex2c[_0xeeb2[86]],{})[_0xeeb2[48]](respondWithResult(_0xf54ex19,201,_0xeeb2[85]))[_0xeeb2[79]](handleError(_0xf54ex19,null,_0xeeb2[85]))};exports[_0xeeb2[49]]= function(_0xf54ex2c,_0xf54ex19){if(_0xf54ex2c[_0xeeb2[86]][_0xeeb2[82]]){delete _0xf54ex2c[_0xeeb2[86]][_0xeeb2[82]]};return db[_0xeeb2[60]][_0xeeb2[84]]({where:{id:_0xf54ex2c[_0xeeb2[83]][_0xeeb2[82]]}})[_0xeeb2[48]](handleEntityNotFound(_0xf54ex19,null,_0xeeb2[49]))[_0xeeb2[48]](saveUpdates(_0xf54ex2c[_0xeeb2[86]],null,_0xeeb2[49]))[_0xeeb2[48]](respondWithResult(_0xf54ex19,null,_0xeeb2[49]))[_0xeeb2[79]](handleError(_0xf54ex19,null,_0xeeb2[49]))};exports[_0xeeb2[51]]= function(_0xf54ex2c,_0xf54ex19){return db[_0xeeb2[60]][_0xeeb2[84]]({where:{id:_0xf54ex2c[_0xeeb2[83]][_0xeeb2[82]]}})[_0xeeb2[48]](handleEntityNotFound(_0xf54ex19,null,_0xeeb2[51]))[_0xeeb2[48]](removeEntity(_0xf54ex19,null,_0xeeb2[51]))[_0xeeb2[79]](handleError(_0xf54ex19,null,_0xeeb2[51]))};exports[_0xeeb2[87]]= function(_0xf54ex2c,_0xf54ex19){return db[_0xeeb2[60]][_0xeeb2[87]]()[_0xeeb2[48]](respondWithResult(_0xf54ex19,null,_0xeeb2[87]))[_0xeeb2[79]](handleError(_0xf54ex19,null,_0xeeb2[87]))}