Skip to content

Commit

Permalink
Merge pull request #142 from 1e5i-Shark/dev
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
hyoguoo authored Mar 18, 2024
2 parents 61d8d78 + a7c7366 commit 287a29e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ public class MessageResponse {
private final String value;
private final String timestamp = LocalDateTime.now().toString();

public static MessageResponse enterRoom(Long memberId) {
public static MessageResponse enterRoom(Long memberId, String nickname) {
return new MessageResponse(
memberId,
MessageType.ENTER_ROOM,
null
nickname
);
}

public static MessageResponse quitRoom(Long memberId) {
public static MessageResponse quitRoom(Long memberId, String nickname) {
return new MessageResponse(
memberId,
MessageType.QUIT_ROOM,
null
nickname
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,30 @@ public class ChatServiceImpl implements ChatService {
public void enterRoom(String roomShortUuid, Long memberId) {
Member member = memberService.getMemberById(memberId);
roomMemberService.joinRoomByRoomShortUuid(roomShortUuid, member);
messageService.sendMessage(roomShortUuid, MessageResponse.enterRoom(memberId));
messageService.sendMessage(
roomShortUuid,
MessageResponse.enterRoom(
memberId,
member.getNickname()
)
);
}

@Override
public void quitRoom(String roomShortUuid, Long memberId) {
Member member = memberService.getMemberById(memberId);
RoomExitResponse roomExitResponse = roomMemberService.exitRoomByMemberId(memberId);
if (roomExitResponse.isHostChanged()) {
messageService.sendMessage(roomShortUuid,
MessageResponse.changeHost(roomExitResponse.getNewHostId()));
}
messageService.sendMessage(roomShortUuid, MessageResponse.quitRoom(memberId));
messageService.sendMessage(
roomShortUuid,
MessageResponse.quitRoom(
memberId,
member.getNickname()
)
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class RoomDetailResponseDto {
@Schema(description = "문제 플랫폼", example = "BOJ")
private String problemPlatform;

@Schema(description = "문제 링크", example = "https://www.acmicpc.net/problem/1000")
private String problemLink;

@Schema(description = "방 비밀번호", example = "password1234")
private String password;

Expand Down Expand Up @@ -79,6 +82,7 @@ public static RoomDetailResponseDto of(Room room, List<RoomMemberResponseDto> ro
room.getLanguages(),
room.getRoomAccessType(),
room.getProblemPlatform(),
room.getProblemLink(),
room.getPassword(),
room.getRoomLimit(),
room.getTags(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class RoomResponseDto {
@Schema(description = "문제 플랫폼", example = "BOJ")
private String problemPlatform;

@Schema(description = "문제 링크", example = "https://www.acmicpc.net/problem/1000")
private String problemLink;

@Schema(description = "방 최대 인원", example = "4")
private Integer roomLimit;

Expand All @@ -51,6 +54,7 @@ public static RoomResponseDto of(Room room) {
room.getLanguages(),
room.getRoomAccessType(),
room.getProblemPlatform(),
room.getProblemLink(),
room.getRoomLimit(),
room.getTags(),
room.getRoomShortUuid(),
Expand Down

0 comments on commit 287a29e

Please sign in to comment.