Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT/#16] 퀴즈 주제 선택 API 구현 #17

Merged
merged 3 commits into from
Dec 5, 2024
Merged

[FEAT/#16] 퀴즈 주제 선택 API 구현 #17

merged 3 commits into from
Dec 5, 2024

Conversation

ckkim817
Copy link
Contributor

@ckkim817 ckkim817 commented Dec 4, 2024


  • Topic Enum을 추가했습니다. 아래 코드는 Enum에 존재하는 String인지, 즉 클라이언트 요청 값이 올바른 주제인지 확인하는 코드입니다. 존재할 경우 해당 Topic을, 존재하지 않을 경우 null을 반환합니다.

private static final Map<String, Topic> TOPIC_MAP = new HashMap<>();
static {
for (Topic topic : Topic.values()) {
TOPIC_MAP.put(topic.getValue(), topic);
}
}
Topic(String value) {
this.value = value;
}
public static Topic fromValue(String value) {
return TOPIC_MAP.get(value);
}


  • 선택된 퀴즈 주제를 방 안 모든 유저에게 브로드캐스트하는 코드입니다. 해당 부분 참고하시어 4번 프로토콜(방 참여)도 응답을 브로드캐스트하게끔 수정해 주시면 좋을 것 같습니다.

// 주제 선택 성공
JsonObject data = new JsonObject();
data.addProperty("topic", topic);
JsonObject successResponse = new ResponseBuilder(5, "success", "성공")
.withData(data)
.build();
room.broadcastMessage(successResponse.toString());

@ckkim817 ckkim817 requested a review from minseok1015 December 4, 2024 19:42
@ckkim817 ckkim817 self-assigned this Dec 4, 2024
Copy link
Collaborator

@minseok1015 minseok1015 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깔끔하게 작업해주셨네요. 고생하셨습니다!


JsonObject successResponse = new ResponseBuilder(5, "success", "성공")
.withData(data)
.build();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 이런식으로 broadcast날리도록 방입장Handler 수정하겠습니다

@ckkim817 ckkim817 merged commit d9aba48 into feat/#13 Dec 5, 2024
@ckkim817 ckkim817 deleted the feat/#16 branch December 5, 2024 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants