Built motion from commit d2dc7dd.|0.0.66
[motion.git] / server / api / chat_room / chat_room.controller.js
1 var _0x7886=["\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"];_0x7886[0];var _=require(_0x7886[1]);var md5=require(_0x7886[2]);var moment=require(_0x7886[3]);var csv=require(_0x7886[4]);var Util=require(_0x7886[5]);var User=require(_0x7886[7])[_0x7886[6]];var ChatRoom=require(_0x7886[7])[_0x7886[8]];var ChatMessage=require(_0x7886[7])[_0x7886[9]];var ChatVisitor=require(_0x7886[7])[_0x7886[10]];var UserHasChatRoom=require(_0x7886[7])[_0x7886[11]];exports[_0x7886[12]]=function(_0x44f1xb,_0x44f1xc,_0x44f1xd){return ChatRoom[_0x7886[27]](_[_0x7886[26]](Util[_0x7886[19]](_0x44f1xb[_0x7886[18]]),{include:[{model:User,attributes:[_0x7886[20],_0x7886[21],_0x7886[22],_0x7886[23],_0x7886[24],_0x7886[25]]},{model:ChatMessage},{model:ChatVisitor}]}))[_0x7886[17]](function(_0x44f1xf){_0x44f1xc[_0x7886[16]](200)[_0x7886[15]](_0x44f1xf)})[_0x7886[14]](function(_0x44f1xe){console[_0x7886[13]](_0x44f1xe);return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[28]]=function(_0x44f1xb,_0x44f1xc){return User[_0x7886[33]](_0x44f1xb[_0x7886[32]][_0x7886[20]])[_0x7886[17]](function(_0x44f1x11){return _0x44f1x11[_0x7886[31]]({include:[{model:ChatVisitor,attributes:[_0x7886[20],_0x7886[22],_0x7886[23]]},{model:User,attributes:[_0x7886[20],_0x7886[21],_0x7886[22],_0x7886[23],_0x7886[24],_0x7886[25]]}]})})[_0x7886[17]](function(_0x44f1x10){if(!_0x44f1x10){return _0x44f1xc[_0x7886[30]](404)};return _0x44f1xc[_0x7886[15]](_0x44f1x10)})[_0x7886[14]](function(_0x44f1xe){console[_0x7886[29]](_0x44f1xe);return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[34]]=function(_0x44f1xb,_0x44f1xc){return ChatRoom[_0x7886[33]](_0x44f1xb[_0x7886[35]][_0x7886[20]],{include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x7886[20],_0x7886[23],_0x7886[22]]},{model:User,attributes:[_0x7886[20],_0x7886[23],_0x7886[21],_0x7886[22],_0x7886[36]]}]},{model:User,attributes:[_0x7886[20],_0x7886[23],_0x7886[21],_0x7886[22]]},{model:ChatVisitor}]})[_0x7886[17]](function(_0x44f1x12){if(!_0x44f1x12){return _0x44f1xc[_0x7886[30]](404)};return _0x44f1xc[_0x7886[15]](_0x44f1x12)})[_0x7886[14]](function(_0x44f1xe){return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[37]]=function(_0x44f1xb,_0x44f1xc,_0x44f1xd){var _0x44f1x13;return ChatRoom[_0x7886[47]]({where:{token:md5(JSON[_0x7886[45]](_0x44f1xb[_0x7886[18]][_0x7886[40]][_0x7886[44]]())).toString(_0x7886[43])},defaults:{type:_0x7886[25],token:md5(JSON[_0x7886[45]](_0x44f1xb[_0x7886[18]][_0x7886[40]][_0x7886[44]]())).toString(_0x7886[43]),status:_0x7886[46]},include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x7886[20],_0x7886[23],_0x7886[22]]},{model:User,attributes:[_0x7886[20],_0x7886[21],_0x7886[22],_0x7886[23],_0x7886[24],_0x7886[25]]}]},{model:User,attributes:[_0x7886[20],_0x7886[21],_0x7886[22],_0x7886[23],_0x7886[24],_0x7886[25]]}]})[_0x7886[42]](function(_0x44f1x12,_0x44f1x15){_0x44f1x13=_0x44f1x12;if(_0x44f1x15){return _0x44f1x13[_0x7886[41]](_0x44f1xb[_0x7886[18]][_0x7886[40]])}else {return}})[_0x7886[17]](function(){return _0x44f1x13[_0x7886[39]]()})[_0x7886[17]](function(_0x44f1x14){return _0x44f1xc[_0x7886[16]](200)[_0x7886[15]](_[_0x7886[26]](_0x44f1x13[_0x7886[38]],{Users:_0x44f1x14}))})[_0x7886[14]](function(_0x44f1xe){return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[48]]=function(_0x44f1xb,_0x44f1xc,_0x44f1xd){return ChatRoom[_0x7886[33]](_0x44f1xb[_0x7886[35]][_0x7886[20]],{include:[{model:ChatMessage,include:[{model:ChatVisitor,attributes:[_0x7886[20],_0x7886[22]]},{model:User,attributes:[_0x7886[20],_0x7886[22]]}]}]})[_0x7886[17]](function(_0x44f1x12){var _0x44f1x16=[];_0x44f1x12[_0x7886[55]][_0x7886[54]](function(_0x44f1x17){_0x44f1x16[_0x7886[53]]({name:_0x44f1x17[_0x7886[6]]?_0x44f1x17[_0x7886[6]][_0x7886[22]]:_0x44f1x17[_0x7886[10]][_0x7886[22]],text:_0x44f1x17[_0x7886[51]][_0x7886[50]](/(\r\n|\n|\r)/gm,_0x7886[49]),date:_0x44f1x17[_0x7886[52]]})});return _0x44f1xc[_0x7886[57]](_0x7886[56])[_0x7886[16]](200)[_0x7886[15]](csv(_0x44f1x16))})[_0x7886[14]](function(_0x44f1xe){return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[58]]=function(_0x44f1xb,_0x44f1xc){return User[_0x7886[33]](_0x44f1xb[_0x7886[32]][_0x7886[20]])[_0x7886[17]](function(_0x44f1x11){return _0x44f1x11[_0x7886[31]]({where:{type:_0x44f1xb[_0x7886[35]][_0x7886[57]]},include:[{model:ChatVisitor,attributes:[_0x7886[20],_0x7886[22],_0x7886[23]]}]})})[_0x7886[17]](function(_0x44f1x10){if(!_0x44f1x10){return _0x44f1xc[_0x7886[30]](404)};return _0x44f1xc[_0x7886[15]](_0x44f1x10)})[_0x7886[14]](function(_0x44f1xe){return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[59]]=function(_0x44f1xb,_0x44f1xc){return User[_0x7886[33]](_0x44f1xb[_0x7886[32]][_0x7886[20]])[_0x7886[17]](function(_0x44f1x11){return _0x44f1x11[_0x7886[31]]({include:[{model:ChatVisitor,attributes:[_0x7886[20],_0x7886[22],_0x7886[23]]},{model:User,attributes:[_0x7886[20],_0x7886[21],_0x7886[22],_0x7886[23],_0x7886[24],_0x7886[25]]}]})})[_0x7886[17]](function(_0x44f1x10){if(!_0x44f1x10){return _0x44f1xc[_0x7886[30]](404)};return _0x44f1xc[_0x7886[15]](_0x44f1x10)})[_0x7886[14]](function(_0x44f1xe){return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[60]]=function(_0x44f1xb,_0x44f1xc){};exports[_0x7886[61]]=function(_0x44f1xb,_0x44f1xc){if(_0x44f1xb[_0x7886[51]][_0x7886[20]]){delete _0x44f1xb[_0x7886[51]][_0x7886[20]]};return ChatRoom[_0x7886[33]](_0x44f1xb[_0x7886[35]][_0x7886[20]])[_0x7886[17]](function(_0x44f1x12){if(!_0x44f1x12){return _0x44f1xc[_0x7886[30]](404)};var _0x44f1x18=_[_0x7886[26]](_0x44f1x12,_0x44f1xb[_0x7886[51]]);return _0x44f1x18[_0x7886[62]]()})[_0x7886[17]](function(_0x44f1x12){return _0x44f1xc[_0x7886[16]](200)[_0x7886[15]](_0x44f1x12)})[_0x7886[14]](function(_0x44f1xe){return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[63]]=function(_0x44f1xb,_0x44f1xc){var _0x44f1x13;if(_0x44f1xb[_0x7886[51]][_0x7886[20]]){delete _0x44f1xb[_0x7886[51]][_0x7886[20]]};return ChatRoom[_0x7886[33]](_0x44f1xb[_0x7886[35]][_0x7886[20]])[_0x7886[17]](function(_0x44f1x12){if(!_0x44f1x12||!_0x44f1xb[_0x7886[51]][_0x7886[40]]){return _0x44f1xc[_0x7886[30]](404)};return _0x44f1x12})[_0x7886[17]](function(_0x44f1x12){return _0x44f1x12[_0x7886[61]]({token:md5(JSON[_0x7886[45]](_0x44f1xb[_0x7886[51]][_0x7886[40]][_0x7886[44]]())).toString(_0x7886[43])})})[_0x7886[17]](function(_0x44f1x12){_0x44f1x13=_0x44f1x12;return _0x44f1x12[_0x7886[41]](_0x44f1xb[_0x7886[51]][_0x7886[40]][_0x7886[44]](),{individualHooks:true})})[_0x7886[17]](function(){return _0x44f1x13[_0x7886[39]]()})[_0x7886[17]](function(_0x44f1x14){return _0x44f1xc[_0x7886[16]](200)[_0x7886[15]](_[_0x7886[26]](_0x44f1x13[_0x7886[38]],{Users:_0x44f1x14,ChatMessages:[]}))})[_0x7886[14]](function(_0x44f1xe){return handleError(_0x44f1xc,_0x44f1xe)})};exports[_0x7886[64]]=function(_0x44f1xb,_0x44f1xc){return ChatRoom[_0x7886[33]](_0x44f1xb[_0x7886[35]][_0x7886[20]])[_0x7886[17]](function(_0x44f1x12){if(!_0x44f1x12){return _0x44f1xc[_0x7886[30]](404)};return _0x44f1x12[_0x7886[64]]()})[_0x7886[17]](function(){return _0x44f1xc[_0x7886[30]](204)})[_0x7886[14]](function(_0x44f1xe){return handleError(_0x44f1xc,_0x44f1xe)})};function handleError(_0x44f1xc,_0x44f1xe){return _0x44f1xc[_0x7886[16]](500)[_0x7886[15]](_0x44f1xe)}