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

[BLOOM-055] LoginUser, Secured 적용 #66

Merged
merged 6 commits into from
Aug 20, 2024
Merged

[BLOOM-055] LoginUser, Secured 적용 #66

merged 6 commits into from
Aug 20, 2024

Conversation

Dompoo
Copy link
Collaborator

@Dompoo Dompoo commented Aug 19, 2024

How

  • 각 api에 LoginUser를 적용하고 user를 사용하도록 수정했습니다.
    • 조회 api에서는 user와 연관관계가 있는 것들만 조회합니다.
    • 추가 api에서는 user와 연관관계 매핑을 하여 저장합니다.
    • 수정/삭제 api에서는 user와 연관관계가 있을 시에만 수정/삭제 됩니다.

@Dompoo Dompoo added the 🌱 feat Suggest a new feature or enhancement label Aug 19, 2024
@Dompoo Dompoo self-assigned this Aug 19, 2024
@Dompoo Dompoo requested a review from stophwan as a code owner August 19, 2024 17:47
Copy link
Member

@stophwan stophwan left a comment

Choose a reason for hiding this comment

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

  1. 쿼리들 자체가 다 N+1에 걸릴 수 있는 요소인데, Lazy Loading 될만한 요소가 없는걸로 이해해도 될까요?
  2. 모든 Controller가 @loginuser를 사용하고 모든 Repository들이 ~byUser를 적용하고 있는데 이유가 있나요? User를 사용하지 않는 Controller, Repository도 User를 사용하고 있는 것 처럼 보여서요! 피드백은 대표적인 몇개만 달았습니다!

) {
val image =
imageRepository.findByIdOrNull(imageId)
imageRepository.findByIdAndUser(imageId, user)
Copy link
Member

Choose a reason for hiding this comment

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

여기 user가 붙여야하는 이유가 있나요? image id를 통해 하나의 이미지만 가져오는거 아닌가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

제 이미지가 아닐 수 있으니까요!
제가 지환님 이미지를 조회하면 안되도록 하는거에요.

) {
val myPlant =
myPlantRepository.findByIdOrNull(myPlantId)
myPlantRepository.findByIdAndUser(myPlantId, user)
Copy link
Member

Choose a reason for hiding this comment

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

여기에도 user가 붙여야하는 이유가 있나요? myPlantId를 통해 하나의 내 식물을 가져오는게 아닌가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

위와 동일합니다. 제가 지환님 식물을 조회하면 안되니까 그렇습니당

@Dompoo
Copy link
Collaborator Author

Dompoo commented Aug 20, 2024

N+1문제는 제가 더 면밀하게 고민해보고 개선해볼게요! ByUser 쪽은 답변 달았습니당

@stophwan
Copy link
Member

N+1문제는 제가 더 면밀하게 고민해보고 개선해볼게요! ByUser 쪽은 답변 달았습니당

확인했습니다!

Copy link
Member

@stophwan stophwan left a comment

Choose a reason for hiding this comment

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

👍 고생하셨습니다. user부분은 생각 못했던 부분이네요 ㅎㅎ

@Dompoo Dompoo merged commit 7975791 into main Aug 20, 2024
1 check passed
@Dompoo Dompoo linked an issue Aug 20, 2024 that may be closed by this pull request
@Dompoo Dompoo deleted the feat/login-user branch August 23, 2024 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 feat Suggest a new feature or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] LoginUser 적용
2 participants