Built motion from commit 95b01fa.|0.0.70
[motion.git] / server / api / chat_room / chat_room.controller.js
1 var _0x592f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x64\x35","\x6D\x6F\x6D\x65\x6E\x74","\x74\x6F\x2D\x63\x73\x76","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x69\x6E\x64\x65\x78","\x6C\x6F\x67","\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","\x69\x64","\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x72\x6F\x6C\x65","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x6D\x65","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x67\x65\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D\x73","\x75\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77","\x70\x61\x72\x61\x6D\x73","\x75\x73\x65\x72\x70\x69\x63","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x55\x73\x65\x72\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x67\x65\x74\x55\x73\x65\x72\x73","\x75\x73\x65\x72\x73","\x73\x65\x74\x55\x73\x65\x72\x73","\x73\x70\x72\x65\x61\x64","\x62\x61\x73\x65\x36\x34","\x73\x6F\x72\x74","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x4F\x50\x45\x4E","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74","\x20","\x72\x65\x70\x6C\x61\x63\x65","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x43\x68\x61\x74\x4D\x65\x73\x73\x61\x67\x65\x73","\x74\x65\x78\x74\x2F\x63\x73\x76","\x74\x79\x70\x65","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x54\x79\x70\x65","\x67\x65\x74\x52\x6F\x6F\x6D\x47\x72\x6F\x75\x70\x73","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79"];_0x592f[0];var _=require(_0x592f[1]);var md5=require(_0x592f[2]);var moment=require(_0x592f[3]);var csv=require(_0x592f[4]);var Util=require(_0x592f[5]);var User=require(_0x592f[7])[_0x592f[6]];var ChatRoom=require(_0x592f[7])[_0x592f[8]];var ChatMessage=require(_0x592f[7])[_0x592f[9]];var ChatVisitor=require(_0x592f[7])[_0x592f[10]];var UserHasChatRoom=require(_0x592f[7])[_0x592f[11]];exports[_0x592f[12]]=function(_0x4505xb,_0x4505xc,_0x4505xd){return ChatRoom[_0x592f[27]](_[_0x592f[26]](Util[_0x592f[19]](_0x4505xb[_0x592f[18]]),{include:[{model:User,attributes:[_0x592f[20],_0x592f[21],_0x592f[22],_0x592f[23],_0x592f[24],_0x592f[25]]},{model:ChatMessage},{model:ChatVisitor}]}))[_0x592f[17]](function(_0x4505xf){_0x4505xc[_0x592f[16]](200)[_0x592f[15]](_0x4505xf)})[_0x592f[14]](function(_0x4505xe){console[_0x592f[13]](_0x4505xe);return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[28]]=function(_0x4505xb,_0x4505xc){return User[_0x592f[33]](_0x4505xb[_0x592f[32]][_0x592f[20]])[_0x592f[17]](function(_0x4505x11){return _0x4505x11[_0x592f[31]]({include:[{model:ChatVisitor,attributes:[_0x592f[20],_0x592f[22],_0x592f[23]]},{model:User,attributes:[_0x592f[20],_0x592f[21],_0x592f[22],_0x592f[23],_0x592f[24],_0x592f[25]]}]})})[_0x592f[17]](function(_0x4505x10){if(!_0x4505x10){return _0x4505xc[_0x592f[30]](404)};return _0x4505xc[_0x592f[15]](_0x4505x10)})[_0x592f[14]](function(_0x4505xe){console[_0x592f[29]](_0x4505xe);return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[34]]=function(_0x4505xb,_0x4505xc){return ChatRoom[_0x592f[33]](_0x4505xb[_0x592f[35]][_0x592f[20]],{include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x592f[20],_0x592f[23],_0x592f[22]]},{model:User,attributes:[_0x592f[20],_0x592f[23],_0x592f[21],_0x592f[22],_0x592f[36]]}]},{model:User,attributes:[_0x592f[20],_0x592f[23],_0x592f[21],_0x592f[22]]},{model:ChatVisitor}]})[_0x592f[17]](function(_0x4505x12){if(!_0x4505x12){return _0x4505xc[_0x592f[30]](404)};return _0x4505xc[_0x592f[15]](_0x4505x12)})[_0x592f[14]](function(_0x4505xe){return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[37]]=function(_0x4505xb,_0x4505xc,_0x4505xd){var _0x4505x13;return ChatRoom[_0x592f[47]]({where:{token:md5(JSON[_0x592f[45]](_0x4505xb[_0x592f[18]][_0x592f[40]][_0x592f[44]]())).toString(_0x592f[43])},defaults:{type:_0x592f[25],token:md5(JSON[_0x592f[45]](_0x4505xb[_0x592f[18]][_0x592f[40]][_0x592f[44]]())).toString(_0x592f[43]),status:_0x592f[46]},include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x592f[20],_0x592f[23],_0x592f[22]]},{model:User,attributes:[_0x592f[20],_0x592f[21],_0x592f[22],_0x592f[23],_0x592f[24],_0x592f[25]]}]},{model:User,attributes:[_0x592f[20],_0x592f[21],_0x592f[22],_0x592f[23],_0x592f[24],_0x592f[25]]}]})[_0x592f[42]](function(_0x4505x12,_0x4505x15){_0x4505x13=_0x4505x12;if(_0x4505x15){return _0x4505x13[_0x592f[41]](_0x4505xb[_0x592f[18]][_0x592f[40]])}else {return}})[_0x592f[17]](function(){return _0x4505x13[_0x592f[39]]()})[_0x592f[17]](function(_0x4505x14){return _0x4505xc[_0x592f[16]](200)[_0x592f[15]](_[_0x592f[26]](_0x4505x13[_0x592f[38]],{Users:_0x4505x14}))})[_0x592f[14]](function(_0x4505xe){return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[48]]=function(_0x4505xb,_0x4505xc,_0x4505xd){return ChatRoom[_0x592f[33]](_0x4505xb[_0x592f[35]][_0x592f[20]],{include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x592f[20],_0x592f[22]]},{model:User,attributes:[_0x592f[20],_0x592f[22]]}]}]})[_0x592f[17]](function(_0x4505x12){var _0x4505x16=[];_0x4505x12[_0x592f[55]][_0x592f[54]](function(_0x4505x17){_0x4505x16[_0x592f[53]]({name:_0x4505x17[_0x592f[6]]?_0x4505x17[_0x592f[6]][_0x592f[22]]:_0x4505x17[_0x592f[10]][_0x592f[22]],text:_0x4505x17[_0x592f[51]][_0x592f[50]](/(\r\n|\n|\r)/gm,_0x592f[49]),date:_0x4505x17[_0x592f[52]]})});return _0x4505xc[_0x592f[57]](_0x592f[56])[_0x592f[16]](200)[_0x592f[15]](csv(_0x4505x16))})[_0x592f[14]](function(_0x4505xe){return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[58]]=function(_0x4505xb,_0x4505xc){return User[_0x592f[33]](_0x4505xb[_0x592f[32]][_0x592f[20]])[_0x592f[17]](function(_0x4505x11){return _0x4505x11[_0x592f[31]]({where:{type:_0x4505xb[_0x592f[35]][_0x592f[57]]},include:[{model:ChatVisitor,attributes:[_0x592f[20],_0x592f[22],_0x592f[23]]}]})})[_0x592f[17]](function(_0x4505x10){if(!_0x4505x10){return _0x4505xc[_0x592f[30]](404)};return _0x4505xc[_0x592f[15]](_0x4505x10)})[_0x592f[14]](function(_0x4505xe){return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[59]]=function(_0x4505xb,_0x4505xc){return User[_0x592f[33]](_0x4505xb[_0x592f[32]][_0x592f[20]])[_0x592f[17]](function(_0x4505x11){return _0x4505x11[_0x592f[31]]({include:[{model:ChatVisitor,attributes:[_0x592f[20],_0x592f[22],_0x592f[23]]},{model:User,attributes:[_0x592f[20],_0x592f[21],_0x592f[22],_0x592f[23],_0x592f[24],_0x592f[25]]}]})})[_0x592f[17]](function(_0x4505x10){if(!_0x4505x10){return _0x4505xc[_0x592f[30]](404)};return _0x4505xc[_0x592f[15]](_0x4505x10)})[_0x592f[14]](function(_0x4505xe){return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[60]]=function(_0x4505xb,_0x4505xc){};exports[_0x592f[61]]=function(_0x4505xb,_0x4505xc){if(_0x4505xb[_0x592f[51]][_0x592f[20]]){delete _0x4505xb[_0x592f[51]][_0x592f[20]]};return ChatRoom[_0x592f[33]](_0x4505xb[_0x592f[35]][_0x592f[20]])[_0x592f[17]](function(_0x4505x12){if(!_0x4505x12){return _0x4505xc[_0x592f[30]](404)};var _0x4505x18=_[_0x592f[26]](_0x4505x12,_0x4505xb[_0x592f[51]]);return _0x4505x18[_0x592f[62]]()})[_0x592f[17]](function(_0x4505x12){return _0x4505xc[_0x592f[16]](200)[_0x592f[15]](_0x4505x12)})[_0x592f[14]](function(_0x4505xe){return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[63]]=function(_0x4505xb,_0x4505xc){var _0x4505x13;if(_0x4505xb[_0x592f[51]][_0x592f[20]]){delete _0x4505xb[_0x592f[51]][_0x592f[20]]};return ChatRoom[_0x592f[33]](_0x4505xb[_0x592f[35]][_0x592f[20]])[_0x592f[17]](function(_0x4505x12){if(!_0x4505x12||!_0x4505xb[_0x592f[51]][_0x592f[40]]){return _0x4505xc[_0x592f[30]](404)};return _0x4505x12})[_0x592f[17]](function(_0x4505x12){return _0x4505x12[_0x592f[61]]({token:md5(JSON[_0x592f[45]](_0x4505xb[_0x592f[51]][_0x592f[40]][_0x592f[44]]())).toString(_0x592f[43])})})[_0x592f[17]](function(_0x4505x12){_0x4505x13=_0x4505x12;return _0x4505x12[_0x592f[41]](_0x4505xb[_0x592f[51]][_0x592f[40]][_0x592f[44]](),{individualHooks:true})})[_0x592f[17]](function(){return _0x4505x13[_0x592f[39]]()})[_0x592f[17]](function(_0x4505x14){return _0x4505xc[_0x592f[16]](200)[_0x592f[15]](_[_0x592f[26]](_0x4505x13[_0x592f[38]],{Users:_0x4505x14,ChatMessages:[]}))})[_0x592f[14]](function(_0x4505xe){return handleError(_0x4505xc,_0x4505xe)})};exports[_0x592f[64]]=function(_0x4505xb,_0x4505xc){return ChatRoom[_0x592f[33]](_0x4505xb[_0x592f[35]][_0x592f[20]])[_0x592f[17]](function(_0x4505x12){if(!_0x4505x12){return _0x4505xc[_0x592f[30]](404)};return _0x4505x12[_0x592f[64]]()})[_0x592f[17]](function(){return _0x4505xc[_0x592f[30]](204)})[_0x592f[14]](function(_0x4505xe){return handleError(_0x4505xc,_0x4505xe)})};function handleError(_0x4505xc,_0x4505xe){return _0x4505xc[_0x592f[16]](500)[_0x592f[15]](_0x4505xe)}