Skip to content
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

Merged
merged 8 commits into from
Aug 1, 2024

Conversation

eunjungL
Copy link

✅ 작업 내용

  • 여행 계획 작성 시 작성자 기록 추가
  • 여행 계획 조회 시 작성자만 조회 가능하게 추가

@eunjungL eunjungL added the BE label Jul 31, 2024
@eunjungL eunjungL added this to the sprint 3 milestone Jul 31, 2024
@eunjungL eunjungL self-assigned this Jul 31, 2024
Copy link

github-actions bot commented Jul 31, 2024

Test Results

52 tests   51 ✅  4s ⏱️
14 suites   1 💤
14 files     0 ❌

Results for commit c64ce61.

♻️ This comment has been updated with latest results.

Copy link

@Libienz Libienz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습다리 클로버 🍀

Comment on lines +23 to -29
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지송.. ㅎ

Comment on lines 34 to 46
@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))
)
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정상 처리 @ApiResponse가 없네요!

저희 컨벤션으로 지정된 것으로 아는데 확인해보시고 추가해주시길 바랍니다!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정상처리가 @ApiResponse로 바뀌면 없어지네요.. 확인 후 처리 완료했습니다 👍

Comment on lines 56 to 68
@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))
)
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment on lines 41 to 54
}

public void validateStartDate() {
if (startDate.isBefore(LocalDate.now())) {
throw new BadRequestException("지난 날짜에 대한 계획은 작성할 수 없습니다.");
}
}

public void validateAuthor(Member member) {
if (!member.equals(author)) {
throw new ForbiddenException("여행 계획은 작성자만 조회할 수 있습니다.");
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저번에 클로버랑 얘기했었는데 역시 validate보다는 서비스코드가 도메인에 물어보도록 하는 것이 어떨까요?
다른 validate 메서드들이 생겨서 의도가 희석될 수 있을 것 같아요

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

동의합니다. Member 스스로 검증하는 것도 방법이 될 수 있을 것 같아요!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳 반영해서 수정 완료했습니다!

Copy link

@hangillee hangillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문제 없어 보입니다! 👍
리팩토링 한 부분만 백로그에 한 번 정리 부탁드려요!

Copy link
Author

@eunjungL eunjungL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 반영 완료했습니다 ~

Comment on lines 34 to 46
@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))
)
})
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정상처리가 @ApiResponse로 바뀌면 없어지네요.. 확인 후 처리 완료했습니다 👍

Comment on lines 41 to 54
}

public void validateStartDate() {
if (startDate.isBefore(LocalDate.now())) {
throw new BadRequestException("지난 날짜에 대한 계획은 작성할 수 없습니다.");
}
}

public void validateAuthor(Member member) {
if (!member.equals(author)) {
throw new ForbiddenException("여행 계획은 작성자만 조회할 수 있습니다.");
}
}
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳 반영해서 수정 완료했습니다!

@eunjungL eunjungL requested review from hangillee and Libienz August 1, 2024 02:54
Copy link

@Libienz Libienz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영 확인했습니다리 👍

@eunjungL eunjungL merged commit b896ea7 into develop/be Aug 1, 2024
3 checks passed
@eunjungL eunjungL deleted the feature/be/#160 branch August 1, 2024 03:36
hangillee pushed a commit to hangillee/2024-touroot that referenced this pull request Aug 20, 2024
* fix: package명 kr로 변경

* feat: TravelPlan에 Member 추가

* fix: application.yml dev profile 들여쓰기 오류 수정

* feat: 여행 계획 조회 시 인가 추가

* test: 여행 계획 작성자 인가 테스트 추가

* feat: TravelPlanController에 정상 요청 Swagger 응답 추가

* refactor: TravelPlanService가 검증에 대한 예외를 던지도록 수정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants