Replies: 1 comment 1 reply
-
| 이 영역에서 직접 Repository를 접근하거나 하는 일을 할 수는 없을까요? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
위와 같이 NoteController의 createNote 메서드에서 @loginuser라는 어노테이션을 이용해 세션에서 SessionUser를 받아와 사용하려합니다. Note가 생성될 때 User객체도 Note에 포함되야하기 때문에 SessionUser를 User로 변환하는 작업(이지만 사실은 UserRepository에서 User를 꺼내오는 작업)이 필요할 것 같습니다.
SessionUser는 Serializable을 구현한 dto이고, CustomOAuth2UserService에서 session에 다음과 같이 저장되고 있습니다.


어떤 방식으로 SessionUser를 User로 바꿔서 사용하면 좋을까요?
일종의 converter util을 새롭게 만들어서 사용할지, 아니면 user가 필요할때마다 user service에서 받아올지, 아니면 근본적으로 더 나은 방법이 있을지 고민이 됩니다.
코드는 https://github.com/kiworkshop/snowball/tree/feature/8-oauth2-google-login 여기서 확인하실 수 있습니다.
Beta Was this translation helpful? Give feedback.
All reactions