Skip to content

Commit

Permalink
feat: Member profileImageUrl null 혹은 공백 문자열 시 빈 문자열 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
seokjin8678 committed May 8, 2024
1 parent c70ba9e commit ffe0e26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions backend/src/main/java/com/festago/member/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.festago.auth.domain.SocialType;
import com.festago.common.domain.BaseTimeEntity;
import com.festago.common.util.ImageUrlHelper;
import com.festago.common.util.Validator;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand All @@ -19,7 +20,6 @@
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.util.StringUtils;

@Entity
@SQLDelete(sql = "UPDATE member SET deleted_at = now(), nickname = '탈퇴한 회원', profile_image_url = '', social_id = null WHERE id=?")
Expand All @@ -37,7 +37,6 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Member extends BaseTimeEntity {

private static final String DEFAULT_IMAGE_URL = "https://festa-go.site/images/default-profile.png";
private static final int MAX_SOCIAL_ID_LENGTH = 255;
private static final int MAX_NICKNAME_LENGTH = 30;
private static final int MAX_PROFILE_IMAGE_LENGTH = 255;
Expand Down Expand Up @@ -76,7 +75,7 @@ public Member(Long id, String socialId, SocialType socialType, String nickname,
this.socialId = socialId;
this.socialType = socialType;
this.nickname = nickname;
this.profileImage = (StringUtils.hasText(profileImage)) ? profileImage : DEFAULT_IMAGE_URL;
this.profileImage = ImageUrlHelper.getBlankStringIfBlank(profileImage);
}

private void validate(String socialId, SocialType socialType, String nickname, String profileImage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class MemberTest {
Member actual = new Member("12345", SocialType.FESTAGO, "nickname", profileImage);

// when & then
assertThat(actual.getProfileImage()).isNotNull();
assertThat(actual.getProfileImage()).isNotBlank();
assertThat(actual.getProfileImage()).isEmpty();
}
}

0 comments on commit ffe0e26

Please sign in to comment.