Built motion from commit bcd50b9.|0.0.29
[motion.git] / server / api / chat_room / chat_room.controller.js
1 var _0xccc8=["\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","\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","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\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","\x66\x69\x6E\x64\x41\x6C\x6C","\x6D\x65","\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","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x55\x73\x65\x72\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6D\x65\x72\x67\x65","\x67\x65\x74\x55\x73\x65\x72\x73","\x75\x73\x65\x72\x73","\x71\x75\x65\x72\x79","\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","\x6F\x70\x65\x6E","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x67\x65\x74\x52\x6F\x6F\x6D\x42\x79\x54\x79\x70\x65","\x74\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","\x62\x6F\x64\x79","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x55\x73\x65\x72\x73","\x64\x65\x73\x74\x72\x6F\x79"];_0xccc8[0];var _=require(_0xccc8[1]);var md5=require(_0xccc8[2]);var moment=require(_0xccc8[3]);var User=require(_0xccc8[5])[_0xccc8[4]];var ChatRoom=require(_0xccc8[5])[_0xccc8[6]];var ChatMessage=require(_0xccc8[5])[_0xccc8[7]];var ChatVisitor=require(_0xccc8[5])[_0xccc8[8]];var UserHasChatRoom=require(_0xccc8[5])[_0xccc8[9]];exports[_0xccc8[10]]=function(_0x1a87x9,_0x1a87xa){return ChatRoom[_0xccc8[21]]({include:[{model:User,attributes:[_0xccc8[15],_0xccc8[16],_0xccc8[17],_0xccc8[18],_0xccc8[19],_0xccc8[20]]},{model:ChatMessage},{model:ChatVisitor}]})[_0xccc8[14]](function(_0x1a87xc){return _0x1a87xa[_0xccc8[13]](200)[_0xccc8[12]](_0x1a87xc)})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)})};exports[_0xccc8[22]]=function(_0x1a87x9,_0x1a87xa){return User[_0xccc8[26]](_0x1a87x9[_0xccc8[25]][_0xccc8[15]])[_0xccc8[14]](function(_0x1a87xe){return _0x1a87xe[_0xccc8[24]]({include:[{model:ChatVisitor,attributes:[_0xccc8[15],_0xccc8[17],_0xccc8[18]]},{model:User,attributes:[_0xccc8[15],_0xccc8[16],_0xccc8[17],_0xccc8[18],_0xccc8[19],_0xccc8[20]]}]})})[_0xccc8[14]](function(_0x1a87xd){if(!_0x1a87xd){return _0x1a87xa[_0xccc8[23]](404)};return _0x1a87xa[_0xccc8[12]](_0x1a87xd);})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)})};exports[_0xccc8[27]]=function(_0x1a87x9,_0x1a87xa){return ChatRoom[_0xccc8[26]](_0x1a87x9[_0xccc8[28]][_0xccc8[15]],{include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0xccc8[15],_0xccc8[18],_0xccc8[17]]},{model:User,attributes:[_0xccc8[15],_0xccc8[18],_0xccc8[16],_0xccc8[17]]}]},{model:User,attributes:[_0xccc8[15],_0xccc8[18],_0xccc8[16],_0xccc8[17]]}]})[_0xccc8[14]](function(_0x1a87xf){if(!_0x1a87xf){return _0x1a87xa[_0xccc8[23]](404)};return _0x1a87xa[_0xccc8[12]](_0x1a87xf);})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)})};exports[_0xccc8[29]]=function(_0x1a87x9,_0x1a87xa,_0x1a87x10){var _0x1a87x11;return ChatRoom[_0xccc8[41]]({where:{token:md5(JSON[_0xccc8[39]](_0x1a87x9[_0xccc8[34]][_0xccc8[33]][_0xccc8[38]]())).toString(_0xccc8[37])},defaults:{type:_0xccc8[20],token:md5(JSON[_0xccc8[39]](_0x1a87x9[_0xccc8[34]][_0xccc8[33]][_0xccc8[38]]())).toString(_0xccc8[37]),status:_0xccc8[40]},include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0xccc8[15],_0xccc8[18],_0xccc8[17]]},{model:User,attributes:[_0xccc8[15],_0xccc8[16],_0xccc8[17],_0xccc8[18],_0xccc8[19],_0xccc8[20]]}]},{model:User,attributes:[_0xccc8[15],_0xccc8[16],_0xccc8[17],_0xccc8[18],_0xccc8[19],_0xccc8[20]]}]})[_0xccc8[36]](function(_0x1a87xf,_0x1a87x13){_0x1a87x11=_0x1a87xf;if(_0x1a87x13){return _0x1a87x11[_0xccc8[35]](_0x1a87x9[_0xccc8[34]][_0xccc8[33]])}else {return };})[_0xccc8[14]](function(){return _0x1a87x11[_0xccc8[32]]()})[_0xccc8[14]](function(_0x1a87x12){return _0x1a87xa[_0xccc8[13]](200)[_0xccc8[12]](_[_0xccc8[31]](_0x1a87x11[_0xccc8[30]],{Users:_0x1a87x12}))})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)});};exports[_0xccc8[42]]=function(_0x1a87x9,_0x1a87xa){User[_0xccc8[26]](_0x1a87x9[_0xccc8[25]][_0xccc8[15]])[_0xccc8[14]](function(_0x1a87xe){_0x1a87xe[_0xccc8[24]]({where:{type:_0x1a87x9[_0xccc8[28]][_0xccc8[43]]},include:[{model:ChatVisitor,attributes:[_0xccc8[15],_0xccc8[17],_0xccc8[18]]}]})[_0xccc8[14]](function(_0x1a87xd){if(!_0x1a87xd){return _0x1a87xa[_0xccc8[23]](404)};return _0x1a87xa[_0xccc8[12]](_0x1a87xd);})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)})})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)})};exports[_0xccc8[44]]=function(_0x1a87x9,_0x1a87xa){User[_0xccc8[26]](_0x1a87x9[_0xccc8[25]][_0xccc8[15]])[_0xccc8[14]](function(_0x1a87xe){_0x1a87xe[_0xccc8[24]]({include:[{model:ChatVisitor,attributes:[_0xccc8[15],_0xccc8[17],_0xccc8[18]]},{model:User,attributes:[_0xccc8[15],_0xccc8[16],_0xccc8[17],_0xccc8[18],_0xccc8[19],_0xccc8[20]]}]})[_0xccc8[14]](function(_0x1a87xd){if(!_0x1a87xd){return _0x1a87xa[_0xccc8[23]](404)};return _0x1a87xa[_0xccc8[12]](_0x1a87xd);})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)})})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)})};exports[_0xccc8[45]]=function(_0x1a87x9,_0x1a87xa){};exports[_0xccc8[46]]=function(_0x1a87x9,_0x1a87xa){if(_0x1a87x9[_0xccc8[47]][_0xccc8[15]]){delete _0x1a87x9[_0xccc8[47]][_0xccc8[15]]};ChatRoom[_0xccc8[26]](_0x1a87x9[_0xccc8[28]][_0xccc8[15]])[_0xccc8[14]](function(_0x1a87xf){if(!_0x1a87xf){return _0x1a87xa[_0xccc8[23]](404)};var _0x1a87x14=_[_0xccc8[31]](_0x1a87xf,_0x1a87x9[_0xccc8[47]]);_0x1a87x14[_0xccc8[48]]()[_0xccc8[14]](function(){return _0x1a87xa[_0xccc8[13]](200)[_0xccc8[12]](_0x1a87xf)})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)});})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)});};exports[_0xccc8[49]]=function(_0x1a87x9,_0x1a87xa){var _0x1a87x11;if(_0x1a87x9[_0xccc8[47]][_0xccc8[15]]){delete _0x1a87x9[_0xccc8[47]][_0xccc8[15]]};return ChatRoom[_0xccc8[26]](_0x1a87x9[_0xccc8[28]][_0xccc8[15]])[_0xccc8[14]](function(_0x1a87xf){if(!_0x1a87xf||!_0x1a87x9[_0xccc8[47]][_0xccc8[33]]){return _0x1a87xa[_0xccc8[23]](404)};return _0x1a87xf;})[_0xccc8[14]](function(_0x1a87xf){return _0x1a87xf[_0xccc8[46]]({token:md5(JSON[_0xccc8[39]](_0x1a87x9[_0xccc8[47]][_0xccc8[33]][_0xccc8[38]]())).toString(_0xccc8[37])})})[_0xccc8[14]](function(_0x1a87xf){_0x1a87x11=_0x1a87xf;return _0x1a87xf[_0xccc8[35]](_0x1a87x9[_0xccc8[47]][_0xccc8[33]][_0xccc8[38]](),{individualHooks:true});})[_0xccc8[14]](function(){return _0x1a87x11[_0xccc8[32]]()})[_0xccc8[14]](function(_0x1a87x12){return _0x1a87xa[_0xccc8[13]](200)[_0xccc8[12]](_[_0xccc8[31]](_0x1a87x11[_0xccc8[30]],{Users:_0x1a87x12,ChatMessages:[]}))})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)});};exports[_0xccc8[50]]=function(_0x1a87x9,_0x1a87xa){ChatRoom[_0xccc8[26]](_0x1a87x9[_0xccc8[28]][_0xccc8[15]])[_0xccc8[14]](function(_0x1a87xf){if(!_0x1a87xf){return _0x1a87xa[_0xccc8[23]](404)};_0x1a87xf[_0xccc8[50]]()[_0xccc8[14]](function(){return _0x1a87xa[_0xccc8[23]](204)})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)});})[_0xccc8[11]](function(_0x1a87xb){return handleError(_0x1a87xa,_0x1a87xb)})};function handleError(_0x1a87xa,_0x1a87xb){return _0x1a87xa[_0xccc8[13]](500)[_0xccc8[12]](_0x1a87xb)}