-
Notifications
You must be signed in to change notification settings - Fork 3
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
[BE] 페어 이름 액세스코드로 방 조회 api, 방 이름 구현 #873
base: BE/dev
Are you sure you want to change the base?
Changes from 3 commits
634af63
e7b2674
8889c5c
5ae657c
5cd0138
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ public class PairRoom { | |
private final MissionUrl missionUrl; | ||
private final AccessCode accessCode; | ||
private final AccessCode easyAccessCode; | ||
private final RoomName roomName; | ||
|
||
public String getAccessCodeText() { | ||
return accessCode.getValue(); | ||
|
@@ -36,6 +37,10 @@ public String getEasyAccessCodeText() { | |
return easyAccessCode.getValue(); | ||
} | ||
|
||
public String getRoomName() { | ||
return roomName.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
|
@@ -61,6 +66,7 @@ public String toString() { | |
", missionUrl=" + missionUrl + | ||
", accessCode=" + accessCode + | ||
", easyAccessCode=" + easyAccessCode + | ||
", roomName=" + roomName + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hashCode랑 equals 에서도 roomName 추가해주세요! |
||
'}'; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package site.coduo.pairroom.domain; | ||
|
||
import lombok.Getter; | ||
import site.coduo.pairroom.exception.InvalidNameFormatException; | ||
|
||
@Getter | ||
public class RoomName { | ||
|
||
private static final String DEFAULT_ROOM_NAME_SUFFIX = "의 페어룸"; | ||
private static final int MAX_LENGTH = 35; | ||
|
||
private final String value; | ||
|
||
public RoomName(final String value) { | ||
validateEmpty(value); | ||
final String trimmedValue = value.trim(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trim() 보다 strip() 요친구가 더 많은 공백을 제거해줍니다 ! |
||
validateLength(trimmedValue); | ||
this.value = trimmedValue; | ||
} | ||
|
||
public static RoomName makeDefaultRoomNameFrom(final String easyAccessCode) { | ||
final String defaultRoomName = easyAccessCode + DEFAULT_ROOM_NAME_SUFFIX; | ||
return new RoomName(defaultRoomName); | ||
} | ||
|
||
private void validateEmpty(final String value) { | ||
if (value == null || value.isBlank()) { | ||
throw new InvalidNameFormatException("페어룸 이름이 비어있습니다."); | ||
} | ||
} | ||
|
||
private void validateLength(final String value) { | ||
if (value.length() > MAX_LENGTH) { | ||
throw new InvalidNameFormatException(String.format("페어룸 이름은 %d자 이하여야 합니다.", MAX_LENGTH)); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package site.coduo.pairroom.service.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "페어 이름 액세스코드로 페어룸 존재 여부 확인 응답 바디") | ||
public record PairRoomExistByEasyAccessCodeResponse( | ||
@Schema(description = "페어룸 존재 확인") | ||
boolean exists, | ||
|
||
@Schema(description = "페어룸 접근 코드") | ||
String accessCode | ||
) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package site.coduo.pairroom.service.dto; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "페어룸 이름 변경 요청 바디") | ||
public record PairRoomNameUpdateRequest( | ||
@Schema(description = "변경할 페어룸 이름", example = "파슬리와 함께한 페어룸") | ||
@NotBlank | ||
String roomName | ||
) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,13 @@ public record PairRoomReadResponse( | |
long remainingTime, | ||
|
||
@Schema(description = "미션 리포지토리 링크", example = "https://github.com/coduo-missions/coduo-javascript-rps") | ||
String missionUrl | ||
String missionUrl, | ||
|
||
@Schema(description = "페어 이름 액세스 코드", example = "짓궂은프람과 언짢은레모네") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤪🤪 |
||
String easyAccessCode, | ||
|
||
@Schema(description = "방 이름", example = "짓궂은프람과 언짢은레모네의 페어룸") | ||
String roomName | ||
) { | ||
|
||
public static PairRoomReadResponse of(final PairRoom pairRoom, final Timer timer) { | ||
|
@@ -32,7 +38,9 @@ public static PairRoomReadResponse of(final PairRoom pairRoom, final Timer timer | |
pairRoom.getStatus().name(), | ||
timer.getDuration(), | ||
timer.getRemainingTime(), | ||
pairRoom.getMissionUrl() | ||
pairRoom.getMissionUrl(), | ||
pairRoom.getEasyAccessCodeText(), | ||
pairRoom.getRoomName() | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easyAccessCode 가 리퀘스트 파라미터로 넘어오는데 이부분도 이렇게 문서화 가능합니다!
변경 부탁드려요