File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
src/main/java/com/example/log4u/domain/user/entity Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,26 @@ public class User extends BaseEntity {
5959 @ Builder .Default
6060 private boolean isPremium = false ;
6161
62+ private boolean isValid (String value ) {
63+ return value != null && !value .trim ().isEmpty ();
64+ }
65+
6266 public void updateOauth2Profile (OAuth2Response oAuth2Response ) {
63- this .email = oAuth2Response .getEmail ();
64- this .name = oAuth2Response .getName ();
65- this .nickname = oAuth2Response .getNickname ();
66- this .profileImage = oAuth2Response .getProfileImage ();
67+ if (!isValid (this .email ) && isValid (oAuth2Response .getEmail ())) {
68+ this .email = oAuth2Response .getEmail ();
69+ }
70+
71+ if (!isValid (this .name ) && isValid (oAuth2Response .getName ())) {
72+ this .name = oAuth2Response .getName ();
73+ }
74+
75+ if (!isValid (this .nickname ) && isValid (oAuth2Response .getNickname ())) {
76+ this .nickname = oAuth2Response .getNickname ();
77+ }
78+
79+ if (!isValid (this .profileImage ) && isValid (oAuth2Response .getProfileImage ())) {
80+ this .profileImage = oAuth2Response .getProfileImage ();
81+ }
6782 }
6883
6984 public void updateMyProfile (UserProfileUpdateRequestDto userProfileUpdateRequestDto ) {
You can’t perform that action at this time.
0 commit comments