-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Feature] - 여행 계획 도메인쪽 인가 적용 #178
Conversation
Test Results52 tests 51 ✅ 4s ⏱️ Results for commit c64ce61. ♻️ This comment has been updated with latest results. |
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.
고생하셨습다리 클로버 🍀
oauth: | ||
kakao: | ||
redirect-uri: http://localhost:8080/api/v1/login/oauth/kakao | ||
spring: | ||
config: | ||
activate: | ||
on-profile: local | ||
oauth: | ||
kakao: | ||
redirect-uri: http://localhost:8080/api/v1/login/oauth/kakao |
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.
지송.. ㅎ
@Operation(summary = "여행 계획 생성") | ||
@ApiResponses(value = { | ||
@ApiResponse( | ||
responseCode = "400", | ||
description = "Body에 유효하지 않은 값이 존재하거나 지난 날짜에 대한 계획을 생성할 때", | ||
content = @Content(schema = @Schema(implementation = ExceptionResponse.class)) | ||
), | ||
@ApiResponse( | ||
responseCode = "401", | ||
description = "로그인하지 않은 사용자가 생성을 시도할 때", | ||
content = @Content(schema = @Schema(implementation = ExceptionResponse.class)) | ||
) | ||
}) |
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.
정상 처리 @ApiResponse
가 없네요!
저희 컨벤션으로 지정된 것으로 아는데 확인해보시고 추가해주시길 바랍니다!
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.
정상처리가 @ApiResponse
로 바뀌면 없어지네요.. 확인 후 처리 완료했습니다 👍
@Operation(summary = "여행 계획 상세 조회") | ||
@ApiResponses(value = { | ||
@ApiResponse( | ||
responseCode = "400", | ||
description = "존재하지 않은 여행 계획을 조회할 때", | ||
content = @Content(schema = @Schema(implementation = ExceptionResponse.class)) | ||
), | ||
@ApiResponse( | ||
responseCode = "403", | ||
description = "작성자가 아닌 사용자가 조회를 시도할 때", | ||
content = @Content(schema = @Schema(implementation = ExceptionResponse.class)) | ||
) | ||
}) |
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.
ditto
} | ||
|
||
public void validateStartDate() { | ||
if (startDate.isBefore(LocalDate.now())) { | ||
throw new BadRequestException("지난 날짜에 대한 계획은 작성할 수 없습니다."); | ||
} | ||
} | ||
|
||
public void validateAuthor(Member member) { | ||
if (!member.equals(author)) { | ||
throw new ForbiddenException("여행 계획은 작성자만 조회할 수 있습니다."); | ||
} | ||
} | ||
} |
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.
저번에 클로버랑 얘기했었는데 역시 validate보다는 서비스코드가 도메인에 물어보도록 하는 것이 어떨까요?
다른 validate 메서드들이 생겨서 의도가 희석될 수 있을 것 같아요
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.
동의합니다. Member 스스로 검증하는 것도 방법이 될 수 있을 것 같아요!
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.
굳 반영해서 수정 완료했습니다!
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.
문제 없어 보입니다! 👍
리팩토링 한 부분만 백로그에 한 번 정리 부탁드려요!
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.
리뷰 반영 완료했습니다 ~
@Operation(summary = "여행 계획 생성") | ||
@ApiResponses(value = { | ||
@ApiResponse( | ||
responseCode = "400", | ||
description = "Body에 유효하지 않은 값이 존재하거나 지난 날짜에 대한 계획을 생성할 때", | ||
content = @Content(schema = @Schema(implementation = ExceptionResponse.class)) | ||
), | ||
@ApiResponse( | ||
responseCode = "401", | ||
description = "로그인하지 않은 사용자가 생성을 시도할 때", | ||
content = @Content(schema = @Schema(implementation = ExceptionResponse.class)) | ||
) | ||
}) |
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.
정상처리가 @ApiResponse
로 바뀌면 없어지네요.. 확인 후 처리 완료했습니다 👍
} | ||
|
||
public void validateStartDate() { | ||
if (startDate.isBefore(LocalDate.now())) { | ||
throw new BadRequestException("지난 날짜에 대한 계획은 작성할 수 없습니다."); | ||
} | ||
} | ||
|
||
public void validateAuthor(Member member) { | ||
if (!member.equals(author)) { | ||
throw new ForbiddenException("여행 계획은 작성자만 조회할 수 있습니다."); | ||
} | ||
} | ||
} |
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.
굳 반영해서 수정 완료했습니다!
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.
반영 확인했습니다리 👍
* fix: package명 kr로 변경 * feat: TravelPlan에 Member 추가 * fix: application.yml dev profile 들여쓰기 오류 수정 * feat: 여행 계획 조회 시 인가 추가 * test: 여행 계획 작성자 인가 테스트 추가 * feat: TravelPlanController에 정상 요청 Swagger 응답 추가 * refactor: TravelPlanService가 검증에 대한 예외를 던지도록 수정
✅ 작업 내용