Skip to content

Commit

Permalink
[fix] 사용자 정보 수정시 Null 입력하면 기존 정보 유지되도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
tlarbals824 committed May 25, 2023
1 parent 158e07d commit ac1a383
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.kusitms.samsion.domain.user.domain.entity;

import java.util.Objects;

import javax.persistence.Embeddable;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.Embeddable;
import java.util.Objects;

@Embeddable
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down Expand Up @@ -49,7 +48,7 @@ public void updateInfo(MyPet myPet) {
}

private void updatePetName(String petName) {
if (!Objects.equals(petName, this.petName))
if (!Objects.equals(petName, this.petName)&&Objects.nonNull(petName))
this.petName = petName;
}

Expand All @@ -59,7 +58,7 @@ private void updatePetImageUrl(String petImageUrl) {
}

private void updateDescription(String description) {
if (!Objects.equals(description, this.description))
if (!Objects.equals(description, this.description)&&Objects.nonNull(description))
this.description = description;
}

Expand All @@ -69,7 +68,7 @@ private void updatePetAge(int petAge) {
}

private void updatePetType(String petType) {
if (!Objects.equals(petType, this.petType))
if (!Objects.equals(petType, this.petType)&&Objects.nonNull(petType))
this.petType = petType;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
package com.kusitms.samsion.domain.user.domain.entity;

import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import com.kusitms.samsion.common.domain.BaseEntity;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Objects;

@Getter
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down Expand Up @@ -51,7 +44,7 @@ public void updateUserInfo(String userNickname,String profileImageUrl){
}

public void updateNickname(String nickname){
if(!Objects.equals(nickname, this.nickname))
if(!Objects.equals(nickname, this.nickname)&&Objects.nonNull(nickname))
this.nickname = nickname;
}

Expand Down

0 comments on commit ac1a383

Please sign in to comment.