Built motion from commit 42469bf.|0.0.59
[motion.git] / server / api / chat_room / chat_room.controller.js
1 var _0x1f69=["\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","\x4F\x50\x45\x4E","\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"];_0x1f69[0];var _=require(_0x1f69[1]);var md5=require(_0x1f69[2]);var moment=require(_0x1f69[3]);var User=require(_0x1f69[5])[_0x1f69[4]];var ChatRoom=require(_0x1f69[5])[_0x1f69[6]];var ChatMessage=require(_0x1f69[5])[_0x1f69[7]];var ChatVisitor=require(_0x1f69[5])[_0x1f69[8]];var UserHasChatRoom=require(_0x1f69[5])[_0x1f69[9]];exports[_0x1f69[10]]=function(_0x1101x9,_0x1101xa){return ChatRoom[_0x1f69[21]]({include:[{model:User,attributes:[_0x1f69[15],_0x1f69[16],_0x1f69[17],_0x1f69[18],_0x1f69[19],_0x1f69[20]]},{model:ChatMessage},{model:ChatVisitor}]})[_0x1f69[14]](function(_0x1101xc){return _0x1101xa[_0x1f69[13]](200)[_0x1f69[12]](_0x1101xc)})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};exports[_0x1f69[22]]=function(_0x1101x9,_0x1101xa){return User[_0x1f69[26]](_0x1101x9[_0x1f69[25]][_0x1f69[15]])[_0x1f69[14]](function(_0x1101xe){return _0x1101xe[_0x1f69[24]]({include:[{model:ChatVisitor,attributes:[_0x1f69[15],_0x1f69[17],_0x1f69[18]]},{model:User,attributes:[_0x1f69[15],_0x1f69[16],_0x1f69[17],_0x1f69[18],_0x1f69[19],_0x1f69[20]]}]})})[_0x1f69[14]](function(_0x1101xd){if(!_0x1101xd){return _0x1101xa[_0x1f69[23]](404)};return _0x1101xa[_0x1f69[12]](_0x1101xd)})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};exports[_0x1f69[27]]=function(_0x1101x9,_0x1101xa){return ChatRoom[_0x1f69[26]](_0x1101x9[_0x1f69[28]][_0x1f69[15]],{include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x1f69[15],_0x1f69[18],_0x1f69[17]]},{model:User,attributes:[_0x1f69[15],_0x1f69[18],_0x1f69[16],_0x1f69[17]]}]},{model:User,attributes:[_0x1f69[15],_0x1f69[18],_0x1f69[16],_0x1f69[17]]}]})[_0x1f69[14]](function(_0x1101xf){if(!_0x1101xf){return _0x1101xa[_0x1f69[23]](404)};return _0x1101xa[_0x1f69[12]](_0x1101xf)})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};exports[_0x1f69[29]]=function(_0x1101x9,_0x1101xa,_0x1101x10){var _0x1101x11;return ChatRoom[_0x1f69[41]]({where:{token:md5(JSON[_0x1f69[39]](_0x1101x9[_0x1f69[34]][_0x1f69[33]][_0x1f69[38]]())).toString(_0x1f69[37])},defaults:{type:_0x1f69[20],token:md5(JSON[_0x1f69[39]](_0x1101x9[_0x1f69[34]][_0x1f69[33]][_0x1f69[38]]())).toString(_0x1f69[37]),status:_0x1f69[40]},include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x1f69[15],_0x1f69[18],_0x1f69[17]]},{model:User,attributes:[_0x1f69[15],_0x1f69[16],_0x1f69[17],_0x1f69[18],_0x1f69[19],_0x1f69[20]]}]},{model:User,attributes:[_0x1f69[15],_0x1f69[16],_0x1f69[17],_0x1f69[18],_0x1f69[19],_0x1f69[20]]}]})[_0x1f69[36]](function(_0x1101xf,_0x1101x13){_0x1101x11=_0x1101xf;if(_0x1101x13){return _0x1101x11[_0x1f69[35]](_0x1101x9[_0x1f69[34]][_0x1f69[33]])}else {return}})[_0x1f69[14]](function(){return _0x1101x11[_0x1f69[32]]()})[_0x1f69[14]](function(_0x1101x12){return _0x1101xa[_0x1f69[13]](200)[_0x1f69[12]](_[_0x1f69[31]](_0x1101x11[_0x1f69[30]],{Users:_0x1101x12}))})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};exports[_0x1f69[42]]=function(_0x1101x9,_0x1101xa){User[_0x1f69[26]](_0x1101x9[_0x1f69[25]][_0x1f69[15]])[_0x1f69[14]](function(_0x1101xe){_0x1101xe[_0x1f69[24]]({where:{type:_0x1101x9[_0x1f69[28]][_0x1f69[43]]},include:[{model:ChatVisitor,attributes:[_0x1f69[15],_0x1f69[17],_0x1f69[18]]}]})[_0x1f69[14]](function(_0x1101xd){if(!_0x1101xd){return _0x1101xa[_0x1f69[23]](404)};return _0x1101xa[_0x1f69[12]](_0x1101xd)})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};exports[_0x1f69[44]]=function(_0x1101x9,_0x1101xa){User[_0x1f69[26]](_0x1101x9[_0x1f69[25]][_0x1f69[15]])[_0x1f69[14]](function(_0x1101xe){_0x1101xe[_0x1f69[24]]({include:[{model:ChatVisitor,attributes:[_0x1f69[15],_0x1f69[17],_0x1f69[18]]},{model:User,attributes:[_0x1f69[15],_0x1f69[16],_0x1f69[17],_0x1f69[18],_0x1f69[19],_0x1f69[20]]}]})[_0x1f69[14]](function(_0x1101xd){if(!_0x1101xd){return _0x1101xa[_0x1f69[23]](404)};return _0x1101xa[_0x1f69[12]](_0x1101xd)})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};exports[_0x1f69[45]]=function(_0x1101x9,_0x1101xa){};exports[_0x1f69[46]]=function(_0x1101x9,_0x1101xa){if(_0x1101x9[_0x1f69[47]][_0x1f69[15]]){delete _0x1101x9[_0x1f69[47]][_0x1f69[15]]};ChatRoom[_0x1f69[26]](_0x1101x9[_0x1f69[28]][_0x1f69[15]])[_0x1f69[14]](function(_0x1101xf){if(!_0x1101xf){return _0x1101xa[_0x1f69[23]](404)};var _0x1101x14=_[_0x1f69[31]](_0x1101xf,_0x1101x9[_0x1f69[47]]);_0x1101x14[_0x1f69[48]]()[_0x1f69[14]](function(){return _0x1101xa[_0x1f69[13]](200)[_0x1f69[12]](_0x1101xf)})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};exports[_0x1f69[49]]=function(_0x1101x9,_0x1101xa){var _0x1101x11;if(_0x1101x9[_0x1f69[47]][_0x1f69[15]]){delete _0x1101x9[_0x1f69[47]][_0x1f69[15]]};return ChatRoom[_0x1f69[26]](_0x1101x9[_0x1f69[28]][_0x1f69[15]])[_0x1f69[14]](function(_0x1101xf){if(!_0x1101xf||!_0x1101x9[_0x1f69[47]][_0x1f69[33]]){return _0x1101xa[_0x1f69[23]](404)};return _0x1101xf})[_0x1f69[14]](function(_0x1101xf){return _0x1101xf[_0x1f69[46]]({token:md5(JSON[_0x1f69[39]](_0x1101x9[_0x1f69[47]][_0x1f69[33]][_0x1f69[38]]())).toString(_0x1f69[37])})})[_0x1f69[14]](function(_0x1101xf){_0x1101x11=_0x1101xf;return _0x1101xf[_0x1f69[35]](_0x1101x9[_0x1f69[47]][_0x1f69[33]][_0x1f69[38]](),{individualHooks:true})})[_0x1f69[14]](function(){return _0x1101x11[_0x1f69[32]]()})[_0x1f69[14]](function(_0x1101x12){return _0x1101xa[_0x1f69[13]](200)[_0x1f69[12]](_[_0x1f69[31]](_0x1101x11[_0x1f69[30]],{Users:_0x1101x12,ChatMessages:[]}))})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};exports[_0x1f69[50]]=function(_0x1101x9,_0x1101xa){ChatRoom[_0x1f69[26]](_0x1101x9[_0x1f69[28]][_0x1f69[15]])[_0x1f69[14]](function(_0x1101xf){if(!_0x1101xf){return _0x1101xa[_0x1f69[23]](404)};_0x1101xf[_0x1f69[50]]()[_0x1f69[14]](function(){return _0x1101xa[_0x1f69[23]](204)})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})})[_0x1f69[11]](function(_0x1101xb){return handleError(_0x1101xa,_0x1101xb)})};function handleError(_0x1101xa,_0x1101xb){return _0x1101xa[_0x1f69[13]](500)[_0x1f69[12]](_0x1101xb)}