-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE] refactor: GroupAccessCode를 발급하지 않고 사용자가 직접 입력하면서 변경되는 사항을 반영 (#441)
* feat: GroupAccessCode 클래스 및 비밀번호 검증 로직 추가 * refactor: 그룹 생성 요청 dto에 groupAccessCode 추가 * refactor: 리뷰 상세 조회 로직 변경 * refactor: 리뷰 그룹 생성 로직에 groupAccessCode 검증 * refactor: 리뷰 목록 조회 로직 수정중 * test: 변경된 사항 테스트 반영 * refactor: 로그 메세지 보강 * refactor: 리뷰 목록 조회 로직 수정완 * test: 깨지는 테스트 해결 * docs: 변경된 내용 api 문서에 반영 * refactor: 그룹 액세스 코드의 필드명 변경 * refactor: 네이티브 쿼리를 기본 쿼리 메서드로 변경 * refactor: 사용하지 않는 상수 제거 * refactor: 인증정보 불일치 예외 메시지 구체적으로 변경 * refactor: 사용하지 않는 필드와 클래스 제거 * test: reviewRequestCode와 groupAccessCode 서로 다르게 변경 --------- Co-authored-by: KIMGYUTAE <[email protected]> Co-authored-by: nayonsoso <[email protected]>
- Loading branch information
1 parent
fa4f70d
commit ff2b7cc
Showing
22 changed files
with
222 additions
and
78 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
backend/src/main/java/reviewme/global/exception/UnexpectedRequestException.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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package reviewme.global.exception; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public abstract class UnexpectedRequestException extends ReviewMeException { | ||
|
||
protected UnexpectedRequestException(String errorMessage) { | ||
super(errorMessage); | ||
log.warn("", this); | ||
} | ||
} |
Empty file.
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
14 changes: 14 additions & 0 deletions
14
.../src/main/java/reviewme/review/service/exception/ReviewGroupNotFoundByCodesException.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,14 @@ | ||
package reviewme.review.service.exception; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import reviewme.global.exception.BadRequestException; | ||
|
||
@Slf4j | ||
public class ReviewGroupNotFoundByCodesException extends BadRequestException { | ||
|
||
public ReviewGroupNotFoundByCodesException(String reviewRequestCode, String groupAccessCode) { | ||
super("인증 정보에 해당하는 리뷰 확인 코드와 리뷰 요청 코드를 통해 찾을 수 있는 리뷰 그룹이 없어요."); | ||
log.info("ReviewGroup not found by codes - reviewRequestCode: {}, groupAccessCode: {}", | ||
reviewRequestCode, groupAccessCode); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...src/main/java/reviewme/review/service/exception/ReviewGroupNotFoundByReviewException.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 reviewme.review.service.exception; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import reviewme.global.exception.DataInconsistencyException; | ||
|
||
@Slf4j | ||
public class ReviewGroupNotFoundByReviewException extends DataInconsistencyException { | ||
|
||
public ReviewGroupNotFoundByReviewException(long reviewId, long reviewGroupId) { | ||
super("서버 내부에서 문제가 발생했어요. 서버에 문의해주세요."); | ||
log.error("ReviewGroup not found from review - reviewId: {}, reviewGroupId: {}", reviewId, reviewGroupId); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.../src/main/java/reviewme/review/service/exception/ReviewNotFoundByIdAndCodesException.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,14 @@ | ||
package reviewme.review.service.exception; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import reviewme.global.exception.NotFoundException; | ||
|
||
@Slf4j | ||
public class ReviewNotFoundByIdAndCodesException extends NotFoundException { | ||
|
||
public ReviewNotFoundByIdAndCodesException(long reviewId, String reviewRequestCode, String groupAccessCode) { | ||
super("리뷰를 찾을 수 없어요"); | ||
log.info("Review not found - reviewId: {}, reviewRequestCode: {}, groupAccessCode: {}", | ||
reviewId, reviewRequestCode, groupAccessCode); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
backend/src/main/java/reviewme/reviewgroup/domain/GroupAccessCode.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,34 @@ | ||
package reviewme.reviewgroup.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Embeddable; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import reviewme.reviewgroup.domain.exception.InvalidGroupAccessCodeFormatException; | ||
|
||
@Embeddable | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
public class GroupAccessCode { | ||
|
||
private static final Pattern PATTERN = Pattern.compile("^[a-zA-Z0-9]{4,20}$"); | ||
|
||
@Column(name = "group_access_code", nullable = false) | ||
private String code; | ||
|
||
public GroupAccessCode(String code) { | ||
validateGroupAccessCode(code); | ||
this.code = code; | ||
} | ||
|
||
private void validateGroupAccessCode(String groupAccessCode) { | ||
Matcher matcher = PATTERN.matcher(groupAccessCode); | ||
if (!matcher.matches()) { | ||
throw new InvalidGroupAccessCodeFormatException(groupAccessCode); | ||
} | ||
} | ||
} | ||
|
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
...ain/java/reviewme/reviewgroup/domain/exception/InvalidGroupAccessCodeFormatException.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 reviewme.reviewgroup.domain.exception; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import reviewme.global.exception.BadRequestException; | ||
|
||
@Slf4j | ||
public class InvalidGroupAccessCodeFormatException extends BadRequestException { | ||
|
||
public InvalidGroupAccessCodeFormatException(String groupAccessCode) { | ||
super("그룹 액세스 코드 형식이 올바르지 않아요."); | ||
log.warn("Invalid groupAccessCode format - groupAccessCode: {}", groupAccessCode); | ||
} | ||
} |
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
3 changes: 1 addition & 2 deletions
3
backend/src/main/java/reviewme/reviewgroup/service/dto/ReviewGroupCreationResponse.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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
package reviewme.reviewgroup.service.dto; | ||
|
||
public record ReviewGroupCreationResponse( | ||
String reviewRequestCode, | ||
String groupAccessCode | ||
String reviewRequestCode | ||
) { | ||
} |
Oops, something went wrong.