-
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
Open
yechop
wants to merge
5
commits into
BE/dev
Choose a base branch
from
BE/feature/#858-easy-access-code-api
base: BE/dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
634af63
feat: 방이름 구현, 페어 이름 액세스코드로 방 접근 api 구현
yechop e7b2674
Merge branch 'BE/dev' into BE/feature/#858-easy-access-code-api
yechop 8889c5c
test: 파라미터 수정
yechop 5ae657c
refactor: 방 이름 예외 추가
yechop 5cd0138
Merge branch 'BE/dev' into BE/feature/#858-easy-access-code-api
reddevilmidzy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 추가해주세요! |
||
'}'; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
backend/src/main/java/site/coduo/pairroom/domain/RoomName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.InvalidRoomNameFormatException; | ||
|
||
@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 InvalidRoomNameFormatException("페어룸 이름이 비어있습니다."); | ||
} | ||
} | ||
|
||
private void validateLength(final String value) { | ||
if (value.length() > MAX_LENGTH) { | ||
throw new InvalidRoomNameFormatException(String.format("페어룸 이름은 %d자 이하여야 합니다.", MAX_LENGTH)); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
backend/src/main/java/site/coduo/pairroom/exception/InvalidRoomNameFormatException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package site.coduo.pairroom.exception; | ||
|
||
public class InvalidRoomNameFormatException extends PairRoomException { | ||
|
||
public InvalidRoomNameFormatException(final String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../src/main/java/site/coduo/pairroom/service/dto/PairRoomExistByEasyAccessCodeResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/site/coduo/pairroom/service/dto/PairRoomNameUpdateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) { | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 가 리퀘스트 파라미터로 넘어오는데 이부분도 이렇게 문서화 가능합니다!
변경 부탁드려요