File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
src/main/java/com/somemore/global/auth/oauth Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 11package com .somemore .global .auth .oauth .domain ;
22
33import com .somemore .global .common .entity .BaseEntity ;
4+ import com .somemore .user .domain .User ;
45import jakarta .persistence .Column ;
56import jakarta .persistence .Entity ;
67import jakarta .persistence .EnumType ;
@@ -37,8 +38,16 @@ public class OAuthInfo extends BaseEntity {
3738 @ Column (name = "oauth_provider" , nullable = false )
3839 private OAuthProvider oAuthProvider ;
3940
41+ public static OAuthInfo create (User user , CommonOAuthInfo commonOAuthInfo ) {
42+ return OAuthInfo .builder ()
43+ .userId (user .getId ())
44+ .oauthId (commonOAuthInfo .oauthId ())
45+ .oAuthProvider (commonOAuthInfo .provider ())
46+ .build ();
47+ }
48+
4049 @ Builder
41- public OAuthInfo (UUID userId , String oauthId , OAuthProvider oAuthProvider ) {
50+ private OAuthInfo (UUID userId , String oauthId , OAuthProvider oAuthProvider ) {
4251 this .userId = userId ;
4352 this .oauthId = oauthId ;
4453 this .oAuthProvider = oAuthProvider ;
Original file line number Diff line number Diff line change @@ -19,15 +19,9 @@ public class OAuthInfoRegistrarImpl implements OAuthInfoRegistrar {
1919
2020 @ Override
2121 public OAuthInfo register (User user , CommonOAuthInfo commonOAuthInfo ) {
22- return oauthInfoRepository . save (
23- createOAuthInfo ( user , commonOAuthInfo ) );
22+ OAuthInfo oAuthInfo = OAuthInfo . create ( user , commonOAuthInfo );
23+ return oauthInfoRepository . save ( oAuthInfo );
2424 }
2525
26- private OAuthInfo createOAuthInfo (User user , CommonOAuthInfo commonOAuthInfo ) {
27- return OAuthInfo .builder ()
28- .userId (user .getId ())
29- .oauthId (commonOAuthInfo .oauthId ())
30- .oAuthProvider (commonOAuthInfo .provider ())
31- .build ();
32- }
26+
3327}
You can’t perform that action at this time.
0 commit comments