Built motion from commit 5b01f56.|0.0.106
[motion.git] / server / api / chat_website / chat_website.controller.js
1 var _0xe787=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x6D\x75\x73\x74\x61\x63\x68\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x55\x73\x65\x72","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64","\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x43\x68\x61\x74\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x73\x6E\x69\x70\x70\x65\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x78\x63\x68\x61\x74\x74\x79","\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","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x67\x65\x74\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x73","\x6C\x65\x6E\x67\x74\x68","\x67\x65\x74\x43\x68\x61\x74\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x69\x73\x70\x49\x64","\x64\x65\x73\x74\x72\x6F\x79\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x73\x68\x6F\x77\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x6C\x6F\x67","\x6E\x61\x6D\x65","\x67\x65\x74\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73","\x67\x65\x74\x43\x68\x61\x74\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73","\x67\x65\x74\x53\x6E\x69\x70\x70\x65\x74\x43\x6F\x64\x65","\x72\x65\x6D\x6F\x74\x65","\x72\x65\x6E\x64\x65\x72","\x75\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x77\x65\x62\x73\x69\x74\x65\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x69\x64\x73","\x64\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x61\x70\x70\x49\x64","\x67\x65\x74\x46\x6F\x72\x6D\x73","\x6A\x73\x6F\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x74\x79\x70\x65","\x73\x63\x6F\x70\x65","\x75\x70\x64\x61\x74\x65\x46\x6F\x72\x6D\x73","\x6F\x6E\x6C\x69\x6E\x65","\x4F\x6E\x6C\x69\x6E\x65\x49\x64","\x6F\x66\x66\x6C\x69\x6E\x65","\x4F\x66\x66\x6C\x69\x6E\x65\x49\x64","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E\x73","\x64\x65\x73\x74\x72\x6F\x79\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x70\x61\x63\x74\x69\x6F\x6E\x49\x64","\x63\x72\x65\x61\x74\x65\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65\x50\x72\x6F\x61\x63\x74\x69\x76\x65\x41\x63\x74\x69\x6F\x6E"];_0xe787[0];var _=require(_0xe787[1]);var util=require(_0xe787[2]);var async=require(_0xe787[3]);var Mustache=require(_0xe787[4]);var Util=require(_0xe787[5]);var sequelize=require(_0xe787[7])[_0xe787[6]];var ChatWebsite=require(_0xe787[7])[_0xe787[8]];var ChatQueue=require(_0xe787[7])[_0xe787[9]];var User=require(_0xe787[7])[_0xe787[10]];var ChatApplication=require(_0xe787[7])[_0xe787[11]];var ChatWebsitesField=require(_0xe787[7])[_0xe787[12]];var ChatProactiveAction=require(_0xe787[7])[_0xe787[13]];var ChatDisposition=require(_0xe787[7])[_0xe787[14]];var snippet=require(_0xe787[16])[_0xe787[15]];exports[_0xe787[17]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatWebsite[_0xe787[24]](Util[_0xe787[23]](_0x4708xf[_0xe787[22]]))[_0xe787[21]](function(_0x4708x13){_0x4708x10[_0xe787[20]](200)[_0xe787[19]](_0x4708x13)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[25]]=function(_0x4708xf,_0x4708x10){return ChatWebsite[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[27]])[_0xe787[21]](function(_0x4708x14){if(!_0x4708x14){return _0x4708x10[_0xe787[26]](404)};return _0x4708x10[_0xe787[19]](_0x4708x14)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[30]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatWebsite[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[27]])[_0xe787[21]](function(_0x4708x14){if(!_0x4708x14){return _0x4708x10[_0xe787[26]](404)};return _0x4708x14[_0xe787[32]]()})[_0xe787[21]](function(_0x4708x15){return _0x4708x10[_0xe787[20]](200)[_0xe787[19]]({rows:_0x4708x15,count:_0x4708x15[_0xe787[31]]})})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[33]]=function(_0x4708xf,_0x4708x10,_0x4708x11){_0x4708xf[_0xe787[35]][_0xe787[34]]=_0x4708xf[_0xe787[28]][_0xe787[27]];return ChatDisposition[_0xe787[36]](_0x4708xf[_0xe787[35]])[_0xe787[21]](function(_0x4708x16){return _0x4708x10[_0xe787[20]](201)[_0xe787[19]](_0x4708x16)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[37]]=function(_0x4708xf,_0x4708x10){if(_0x4708xf[_0xe787[35]][_0xe787[27]]){delete _0x4708xf[_0xe787[35]][_0xe787[27]]};return ChatDisposition[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[40]])[_0xe787[21]](function(_0x4708x16){if(!_0x4708x16){return _0x4708x10[_0xe787[26]](404)};var _0x4708x17=_[_0xe787[38]](_0x4708x16,_0x4708xf[_0xe787[35]]);return _0x4708x17[_0xe787[39]]()})[_0xe787[21]](function(_0x4708x14){return _0x4708x10[_0xe787[20]](200)[_0xe787[19]](_0x4708x14)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[41]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatDisposition[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[40]])[_0xe787[21]](function(_0x4708x18){if(!_0x4708x18){return _0x4708x10[_0xe787[26]](404)};return _0x4708x18[_0xe787[42]]()})[_0xe787[21]](function(){return _0x4708x10[_0xe787[26]](204)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[43]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatWebsite[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[27]])[_0xe787[21]](function(_0x4708x1a){if(!_0x4708x1a){return _0x4708x10[_0xe787[26]](404)};return _0x4708x1a[_0xe787[46]](_[_0xe787[38]](Util[_0xe787[23]](_0x4708xf[_0xe787[22]]),{include:[{model:ChatQueue,attributes:[_0xe787[27],_0xe787[45]]},{model:User,attributes:[_0xe787[27],_0xe787[45]]}]}))})[_0xe787[21]](function(_0x4708x19){return _0x4708x10[_0xe787[19]]({count:_0x4708x19[_0xe787[31]],rows:_0x4708x19})})[_0xe787[18]](function(_0x4708x12){console[_0xe787[44]](_0x4708x12);return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[47]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatWebsite[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[27]])[_0xe787[21]](function(_0x4708x1a){if(!_0x4708x1a){return _0x4708x10[_0xe787[26]](404)};return _0x4708x1a[_0xe787[48]](Util[_0xe787[23]](_0x4708xf[_0xe787[22]]))})[_0xe787[21]](function(_0x4708x1b){return _0x4708x10[_0xe787[19]]({count:_0x4708x1b[_0xe787[31]],rows:_0x4708x1b})})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[49]]=function(_0x4708xf,_0x4708x10){return ChatWebsite[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[27]])[_0xe787[21]](function(_0x4708x14){var _0x4708x1c={remote:_0x4708x14[_0xe787[50]],websiteId:_0x4708xf[_0xe787[28]][_0xe787[27]]};var _0x4708x1d=Mustache[_0xe787[51]](snippet,_0x4708x1c);return _0x4708x10[_0xe787[20]](200)[_0xe787[19]]({html:_0x4708x1d})})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[36]]=function(_0x4708xf,_0x4708x10){return ChatWebsite[_0xe787[36]](_0x4708xf[_0xe787[35]])[_0xe787[21]](function(_0x4708x14){return _0x4708x10[_0xe787[20]](201)[_0xe787[19]](_0x4708x14)})[_0xe787[18]](function(_0x4708x12){console[_0xe787[44]](_0x4708x12);return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[52]]=function(_0x4708xf,_0x4708x10){if(_0x4708xf[_0xe787[35]][_0xe787[27]]){delete _0x4708xf[_0xe787[35]][_0xe787[27]]};return ChatWebsite[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[27]])[_0xe787[21]](function(_0x4708x14){if(!_0x4708x14){return _0x4708x10[_0xe787[26]](404)};return _0x4708x14[_0xe787[52]](_0x4708xf[_0xe787[35]])})[_0xe787[21]](function(_0x4708x14){return _0x4708x10[_0xe787[20]](200)[_0xe787[19]](_0x4708x14)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[53]]=function(_0x4708xf,_0x4708x10){var _0x4708x1e=0;var _0x4708x1f=_0x4708xf[_0xe787[35]];_0x4708x1f[_0xe787[57]](function(_0x4708x20){delete _0x4708x20[_0xe787[27]];delete _0x4708x20[_0xe787[54]];delete _0x4708x20[_0xe787[55]];_0x4708x20[_0xe787[56]]= ++_0x4708x1e});return sequelize[_0xe787[59]](function(_0x4708x21){return ChatApplication[_0xe787[42]]({where:{ChatWebsiteId:_0x4708xf[_0xe787[28]][_0xe787[27]]},individualHooks:true,transaction:_0x4708x21})[_0xe787[21]](function(){return ChatApplication[_0xe787[58]](_0x4708x1f,{individualHooks:true,transaction:_0x4708x21})})})[_0xe787[21]](function(_0x4708x19){return _0x4708x10[_0xe787[20]](200)[_0xe787[19]]({count:_0x4708x19[_0xe787[31]],rows:_0x4708x19})})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[42]]=function(_0x4708xf,_0x4708x10){return ChatWebsite[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[27]])[_0xe787[21]](function(_0x4708x14){if(!_0x4708x14){return _0x4708x10[_0xe787[26]](404)};return _0x4708x14[_0xe787[42]]()})[_0xe787[21]](function(){return _0x4708x10[_0xe787[26]](204)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[60]]=function(_0x4708xf,_0x4708x10){return ChatWebsite[_0xe787[42]]({where:{id:_0x4708xf[_0xe787[22]][_0xe787[61]]},individualHooks:true})[_0xe787[21]](function(){return _0x4708x10[_0xe787[26]](204)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[62]]=function(_0x4708xf,_0x4708x10){return ChatApplication[_0xe787[42]]({where:{id:_0x4708xf[_0xe787[22]][_0xe787[63]]},individualHooks:true})[_0xe787[21]](function(){return _0x4708x10[_0xe787[26]](204)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[64]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatApplication[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[65]])[_0xe787[21]](function(_0x4708x22){if(!_0x4708x22){return _0x4708x10[_0xe787[26]](404)};return _0x4708x22[_0xe787[42]]()})[_0xe787[21]](function(){return _0x4708x10[_0xe787[26]](204)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[66]]=function(_0x4708xf,_0x4708x10){return ChatWebsitesField[_0xe787[70]]({method:[_0x4708xf[_0xe787[28]][_0xe787[69]],_0x4708xf[_0xe787[28]][_0xe787[27]]]})[_0xe787[68]]()[_0xe787[21]](function(_0x4708x23){return _0x4708x10[_0xe787[20]](200)[_0xe787[67]](_0x4708x23)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[71]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatWebsitesField[_0xe787[42]]({where:_0x4708xf[_0xe787[28]][_0xe787[69]]===_0xe787[72]?{OnlineId:_0x4708xf[_0xe787[28]][_0xe787[27]]}:{OfflineId:_0x4708xf[_0xe787[28]][_0xe787[27]]}})[_0xe787[21]](function(){_[_0xe787[57]](_0x4708xf[_0xe787[35]],function(_0x4708x25){if(_0x4708xf[_0xe787[28]][_0xe787[69]]===_0xe787[72]){_0x4708x25[_0xe787[73]]=_0x4708xf[_0xe787[28]][_0xe787[27]]}else {if(_0x4708xf[_0xe787[28]][_0xe787[69]]===_0xe787[74]){_0x4708x25[_0xe787[75]]=_0x4708xf[_0xe787[28]][_0xe787[27]]}}});return ChatWebsitesField[_0xe787[58]](_0x4708xf[_0xe787[35]])})[_0xe787[21]](function(_0x4708x24){_0x4708x10[_0xe787[20]](201)[_0xe787[67]](_0x4708x24)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[76]]=function(_0x4708xf,_0x4708x10){return ChatProactiveAction[_0xe787[42]]({where:{id:_0x4708xf[_0xe787[22]][_0xe787[63]]},individualHooks:true})[_0xe787[21]](function(){return _0x4708x10[_0xe787[26]](204)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[77]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatProactiveAction[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[78]])[_0xe787[21]](function(_0x4708x26){if(!_0x4708x26){return _0x4708x10[_0xe787[26]](404)};return _0x4708x26[_0xe787[42]]()})[_0xe787[21]](function(){return _0x4708x10[_0xe787[26]](204)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[79]]=function(_0x4708xf,_0x4708x10,_0x4708x11){return ChatWebsite[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[27]])[_0xe787[21]](function(_0x4708x1a){if(!_0x4708x1a){return _0x4708x10[_0xe787[26]](404)};_0x4708xf[_0xe787[35]][_0xe787[34]]=_0x4708x1a[_0xe787[27]];return ChatProactiveAction[_0xe787[36]](_0x4708xf[_0xe787[35]])})[_0xe787[21]](function(_0x4708x26){return _0x4708x10[_0xe787[20]](201)[_0xe787[19]](_0x4708x26)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};exports[_0xe787[80]]=function(_0x4708xf,_0x4708x10){if(_0x4708xf[_0xe787[35]][_0xe787[27]]){delete _0x4708xf[_0xe787[35]][_0xe787[27]]};return ChatProactiveAction[_0xe787[29]](_0x4708xf[_0xe787[28]][_0xe787[78]])[_0xe787[21]](function(_0x4708x26){if(!_0x4708x26){return _0x4708x10[_0xe787[26]](404)};return _0x4708x26[_0xe787[52]](_0x4708xf[_0xe787[35]])})[_0xe787[21]](function(_0x4708x26){console[_0xe787[44]](_0x4708x26);return _0x4708x10[_0xe787[20]](200)[_0xe787[19]](_0x4708x26)})[_0xe787[18]](function(_0x4708x12){return handleError(_0x4708x10,_0x4708x12)})};function handleError(_0x4708x10,_0x4708x12){return _0x4708x10[_0xe787[20]](500)[_0xe787[19]](_0x4708x12)}