-
Notifications
You must be signed in to change notification settings - Fork 0
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
스탬프 수정 및 삭제 기능 구현 #115
base: develop
Are you sure you want to change the base?
스탬프 수정 및 삭제 기능 구현 #115
Conversation
Quality Gate passedIssues Measures |
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.
요즘 바쁘실텐데 기능 구현 고생 많으셨습니다!
몇 가지 질문들과 제안 사항이 있어 일단 rc로 처리해 둡니다.
public ResponseEntity<ExceptionResponse> handleForbiddenStampToUpdateException( | ||
final ForbiddenStampToUpdateException exception, final HttpServletRequest request | ||
) { | ||
System.out.println("handleForbiddenStampToUpdateException 들어옴"); |
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.
sout이 있네요!
getUser(userId); | ||
getGoal(goalId); |
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.
조회한 결과를 사용하지 않는 것은 존재 여부만 확인하기 때문일까요?
맞다면, existsById
를 통한 검증도 있을 것 같은데 어떻게 생각하시나요?
} | ||
|
||
private void validUserToUpdate(final Long userId, final Long stampUserId) { | ||
if (!userId.equals(stampUserId)) { |
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.
Stamp 내부에 isWriter
를 오버로딩한 메서드를 만들면 어떨까요?
혹은 조회한 User
를 사용하던가요!
아래 delete
와 비슷한 플로우 같은데 어떤 기준으로 서로 다른지 궁금합니다!
if (updateStamp.changeToDefaultImage()) { | ||
stamp.deleteImageUrl(); | ||
} |
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.
해당 기능은 안드로이드 측과도 논의된 부분일까요?
해당 기능에 대해 이야기해 본 기억이 없는데, 궁금해서 여쭤봅니다!
public static UpdateStampDto of(final Long stampId, | ||
final String message, | ||
final MultipartFile stampImage, | ||
final boolean changeToDefaultImage) { |
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.
괄호 앞에 개행 부탁드립니다!
final boolean changeToDefaultImage) { | |
final boolean changeToDefaultImage | |
) { |
public void deleteImageUrl() { | ||
this.stampImageUrl = DEFAULT_STAMP_IMAGE_URL; | ||
} | ||
|
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.
불필요한 개행이 있네요!
public ResponseEntity<ReadStampResponse> update( | ||
@PathVariable("goalId") final Long goalId, | ||
@PathVariable("stampId") final Long stampId, | ||
@RequestPart @Valid final UpdateStampRequest request, |
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.
UpdateStampRequest
에 Valid
관련 어노테이션이 없는데, 없어도 뭐가 해주는 기능이 있는 걸까요?
} | ||
|
||
@Test | ||
void 수정_요청한_스탬프_메모의_길이가_30자_초과이거나_빈값인_경우_예외를_발생한다() { |
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.
해당 예외는 각각 다른 상황이라고 생각해, 분리해서 테스트하는 게 가독성 측면과, 명확한 테스트를 위해 더 좋지 않을까 싶은데 어떻게 생각하시나요?
.with(request -> { | ||
request.setMethod("PATCH"); | ||
return request; | ||
}) |
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.
.header("X-API-VERSION", 1) | ||
.header(HttpHeaders.AUTHORIZATION, 액세스_토큰) | ||
.with(request -> { | ||
request.setMethod("PATCH"); |
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.
별건 아니지만, 실수를 줄이기 위해 아래처럼 수정하면 어떨까요?
request.setMethod("PATCH"); | |
request.setMethod(HttpMethod.PATCH.name()); |
7/23
드디어 끝이 났습니다... 구현 난이도에 비해 너무 오래 걸려 죄송합니다..
스탬프 삭제 기능의 경우 HardDelete 구현한 부분이 #110 에 있어 해당 pr 머지 후에 HardDelete로 반영하도록 하겠습니다.
문제상황 생긴 부분에 대한 빠른 피드백 감사합니다.