ff1d38e30516e5936614a14279c4c6f187fdc5e9
[motion.git] / server / api / report_chat_session / report_chat_session.controller.js
1 var _0xc659=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x62\x6C\x75\x65\x62\x69\x72\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x69\x64","\x6D\x61\x70","\x75\x6E\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x72\x6F\x77\x73","\x67\x65\x74\x43\x68\x61\x74\x51\x75\x65\x75\x65\x73\x49\x64\x42\x79\x55\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x75\x73\x65\x72","\x67\x65\x74\x43\x68\x61\x74\x51\x75\x65\x75\x65\x73","\x61\x67\x65\x6E\x74","\x72\x6F\x6C\x65","\x77\x61\x69\x74\x69\x6E\x67\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x6C\x6C","\x6F\x70\x65\x6E","\x64\x61\x79","\x73\x74\x61\x72\x74\x4F\x66","\x63\x6F\x75\x6E\x74","\x77\x61\x69\x74\x69\x6E\x67","\x63\x6C\x6F\x73\x65\x64","\x74\x69\x6D\x65\x6F\x75\x74","\x61\x62\x61\x6E\x64\x6F\x6E\x65\x64","\x67\x65\x74\x44\x61\x73\x68\x62\x6F\x61\x72\x64\x56\x61\x6C\x75\x65\x73","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72"];_0xc659[0];var _=require(_0xc659[1]);var ReportChatSession=require(_0xc659[3])[_0xc659[2]];var User=require(_0xc659[3])[_0xc659[4]];var ReportChatSessionHistory=require(_0xc659[3])[_0xc659[6]][_0xc659[5]];var Promise=require(_0xc659[7]);var Util=require(_0xc659[8]);var moment=require(_0xc659[9]);var logger=require(_0xc659[11])(_0xc659[10]);exports[_0xc659[12]]= function(_0xa43dx9,_0xa43dxa,_0xa43dxb){return ReportChatSession[_0xc659[19]](Util[_0xc659[18]](_0xa43dx9[_0xc659[17]]))[_0xc659[16]](function(_0xa43dxd){_0xa43dxa[_0xc659[15]](200)[_0xc659[14]](_0xa43dxd)})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};exports[_0xc659[20]]= function(_0xa43dx9,_0xa43dxa){return ReportChatSessionHistory[_0xc659[20]]()[_0xc659[16]](function(_0xa43dxe){return _0xa43dxa[_0xc659[15]](200)[_0xc659[14]](_0xa43dxe)})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};function getChatQueues(_0xa43dx10){return function(){switch(_0xa43dx10[_0xc659[31]]){case _0xc659[28]:return User[_0xc659[27]](_0xa43dx10[_0xc659[21]],{attributes:[_0xc659[21]]})[_0xc659[16]](Util[_0xc659[26]]({},{attributes:[_0xc659[21]],include:[{raw:true,model:User,attributes:[_0xc659[21]]}]}))[_0xc659[16]](function(_0xa43dx11){var _0xa43dx12=[];_0xa43dx11[_0xc659[25]][_0xc659[24]](function(_0xa43dx13){_0xa43dx12= _[_0xc659[23]](_0xa43dx12,_[_0xc659[22]](_0xa43dx13.Users,_0xc659[21]))});return {$or:{queue:_[_0xc659[22]](_0xa43dx11[_0xc659[25]],_0xc659[21]),memberid:_0xa43dx12}}});case _0xc659[30]:return User[_0xc659[27]](_0xa43dx10[_0xc659[21]],{attributes:[_0xc659[21]]})[_0xc659[16]](function(_0xa43dx14){return _0xa43dx14[_0xc659[29]]({attributes:[_0xc659[21]]})})[_0xc659[16]](function(_0xa43dx11){return {$or:{queue:_[_0xc659[22]](_0xa43dx11,_0xc659[21]),memberid:_0xa43dx10[_0xc659[21]]}}});default:return {}}}}exports[_0xc659[32]]= function(_0xa43dx9,_0xa43dxa){return Promise[_0xc659[35]]([])[_0xc659[16]](getChatQueues(_0xa43dx9[_0xc659[28]]))[_0xc659[16]](function(_0xa43dx16){return ReportChatSession[_0xc659[34]](Util[_0xc659[18]](_0xa43dx9[_0xc659[17]],_[_0xc659[33]]({leaveAt:null},_0xa43dx16)))})[_0xc659[16]](function(_0xa43dx15){return _0xa43dxa[_0xc659[15]](200)[_0xc659[14]]({rows:_0xa43dx15})})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};exports[_0xc659[36]]= function(_0xa43dx9,_0xa43dxa){return Promise[_0xc659[35]]([])[_0xc659[16]](getChatQueues(_0xa43dx9[_0xc659[28]]))[_0xc659[16]](function(_0xa43dx16){return ReportChatSession[_0xc659[39]](Util[_0xc659[18]](_0xa43dx9[_0xc659[17]],_[_0xc659[33]]({leaveAt:{$ne:null},complete:null,abandon:null,timeout:null,createdAt:{$gte:moment()[_0xc659[38]](_0xc659[37])}},_0xa43dx16)))})[_0xc659[16]](function(_0xa43dx15){return _0xa43dxa[_0xc659[15]](200)[_0xc659[14]]({value:_0xa43dx15})})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};exports[_0xc659[40]]= function(_0xa43dx9,_0xa43dxa){return Promise[_0xc659[35]]([])[_0xc659[16]](getChatQueues(_0xa43dx9[_0xc659[28]]))[_0xc659[16]](function(_0xa43dx16){return ReportChatSession[_0xc659[39]](Util[_0xc659[18]](_0xa43dx9[_0xc659[17]],_[_0xc659[33]]({leaveAt:null,createdAt:{$gte:moment()[_0xc659[38]](_0xc659[37])}},_0xa43dx16)))})[_0xc659[16]](function(_0xa43dx15){return _0xa43dxa[_0xc659[15]](200)[_0xc659[14]]({value:_0xa43dx15})})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};exports[_0xc659[41]]= function(_0xa43dx9,_0xa43dxa){return Promise[_0xc659[35]]([])[_0xc659[16]](getChatQueues(_0xa43dx9[_0xc659[28]]))[_0xc659[16]](function(_0xa43dx16){return ReportChatSession[_0xc659[39]](Util[_0xc659[18]](_0xa43dx9[_0xc659[17]],_[_0xc659[33]]({complete:true,createdAt:{$gte:moment()[_0xc659[38]](_0xc659[37])}},_0xa43dx16)))})[_0xc659[16]](function(_0xa43dx15){return _0xa43dxa[_0xc659[15]](200)[_0xc659[14]]({value:_0xa43dx15})})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};exports[_0xc659[42]]= function(_0xa43dx9,_0xa43dxa){return Promise[_0xc659[35]]([])[_0xc659[16]](getChatQueues(_0xa43dx9[_0xc659[28]]))[_0xc659[16]](function(_0xa43dx16){return ReportChatSession[_0xc659[39]](Util[_0xc659[18]](_0xa43dx9[_0xc659[17]],_[_0xc659[33]]({timeout:true,createdAt:{$gte:moment()[_0xc659[38]](_0xc659[37])}},_0xa43dx16)))})[_0xc659[16]](function(_0xa43dx15){return _0xa43dxa[_0xc659[15]](200)[_0xc659[14]]({value:_0xa43dx15})})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};exports[_0xc659[43]]= function(_0xa43dx9,_0xa43dxa){return Promise[_0xc659[35]]([])[_0xc659[16]](getChatQueues(_0xa43dx9[_0xc659[28]]))[_0xc659[16]](function(_0xa43dx16){return ReportChatSession[_0xc659[39]](Util[_0xc659[18]](_0xa43dx9[_0xc659[17]],_[_0xc659[33]]({abandon:true,createdAt:{$gte:moment()[_0xc659[38]](_0xc659[37])}},_0xa43dx16)))})[_0xc659[16]](function(_0xa43dx15){return _0xa43dxa[_0xc659[15]](200)[_0xc659[14]]({value:_0xa43dx15})})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};exports[_0xc659[44]]= function(_0xa43dx9,_0xa43dxa){var _0xa43dx17={timeout:0,waiting:0};return ReportChatSession[_0xc659[39]]({where:{leaveAt:null,createdAt:{$gte:moment()[_0xc659[38]](_0xc659[37])}}})[_0xc659[16]](function(_0xa43dxd){if(_0xa43dxd){_0xa43dx17[_0xc659[40]]= _0xa43dxd};return ReportChatSession[_0xc659[39]]({where:{timeout:true,createdAt:{$gte:moment()[_0xc659[38]](_0xc659[37])}}})})[_0xc659[16]](function(_0xa43dxd){if(_0xa43dxd){_0xa43dx17[_0xc659[42]]= _0xa43dxd};return _0xa43dxa[_0xc659[15]](200)[_0xc659[14]](_0xa43dx17)})[_0xc659[13]](function(_0xa43dxc){return handleError(_0xa43dxa,_0xa43dxc)})};function handleError(_0xa43dxa,_0xa43dxc){logger[_0xc659[46]](_0xa43dxc[_0xc659[45]]);return _0xa43dxa[_0xc659[15]](500)[_0xc659[14]](_0xa43dxc)}