diff --git a/src/main/java/com/viewmore/poksin/dto/user/UpdateUserDTO.java b/src/main/java/com/viewmore/poksin/dto/user/UpdateUserDTO.java index 6d6575f..cfb2f97 100644 --- a/src/main/java/com/viewmore/poksin/dto/user/UpdateUserDTO.java +++ b/src/main/java/com/viewmore/poksin/dto/user/UpdateUserDTO.java @@ -17,21 +17,9 @@ public class UpdateUserDTO { // 주소 private String address; // 전화번호 공개 비공개 여부 - private boolean phoneOpen; + private Boolean phoneOpen; // 긴급 연락처 공개 비공개 여부 - private boolean emergencyOpen; + private Boolean emergencyOpen; // 주소 공개 비공개 여부 - private boolean addressOpen; - - public boolean getphoneOpen() { - return phoneOpen; - } - - public boolean getEmergencyOpen() { - return emergencyOpen; - } - - public boolean getAddressOpen() { - return addressOpen; - } + private Boolean addressOpen; } diff --git a/src/main/java/com/viewmore/poksin/dto/user/UserResponseDTO.java b/src/main/java/com/viewmore/poksin/dto/user/UserResponseDTO.java index eb7c95f..0ce06e4 100644 --- a/src/main/java/com/viewmore/poksin/dto/user/UserResponseDTO.java +++ b/src/main/java/com/viewmore/poksin/dto/user/UserResponseDTO.java @@ -31,7 +31,7 @@ public class UserResponseDTO { public static UserResponseDTO toDto(UserEntity entity, LocalDateTime lastChated) { return UserResponseDTO.builder() .username(entity.getUsername()) - .phoneNum(entity.getphoneOpen() ? entity.getPhoneNum() : null) + .phoneNum(entity.getPhoneOpen() ? entity.getPhoneNum() : null) .emergencyNum(entity.getEmergencyOpen() ? entity.getEmergencyNum() : null) .address(entity.getAddressOpen() ? entity.getAddress() : null) .role(entity.getRole()) diff --git a/src/main/java/com/viewmore/poksin/entity/UserEntity.java b/src/main/java/com/viewmore/poksin/entity/UserEntity.java index 33f0536..964d512 100644 --- a/src/main/java/com/viewmore/poksin/entity/UserEntity.java +++ b/src/main/java/com/viewmore/poksin/entity/UserEntity.java @@ -24,11 +24,11 @@ public class UserEntity extends MainUserEntity{ // 주소 private String address; // 전화번호 공개 비공개 여부 - private boolean phoneOpen; + private Boolean phoneOpen; // 긴급 연락처 공개 비공개 여부 - private boolean emergencyOpen; + private Boolean emergencyOpen; // 주소 공개 비공개 여부 - private boolean addressOpen; + private Boolean addressOpen; @OneToMany(mappedBy = "user", cascade = CascadeType.ALL) private List evidences = new ArrayList<>(); @@ -44,26 +44,14 @@ public UserEntity(String username, String password, String phoneNum, String emer this.addressOpen = addressOpen; } - public boolean getphoneOpen() { - return phoneOpen; - } - - public boolean getEmergencyOpen() { - return emergencyOpen; - } - - public boolean getAddressOpen() { - return addressOpen; - } - public void updateUser(UpdateUserDTO updateUserDTO) { this.address = updateUserDTO.getAddress() == null ? this.address : updateUserDTO.getAddress(); this.emergencyNum = updateUserDTO.getEmergencyNum() == null ? this.emergencyNum : updateUserDTO.getEmergencyNum(); this.phoneNum = updateUserDTO.getPhoneNum() == null ? this.phoneNum : updateUserDTO.getPhoneNum(); - this.phoneOpen = updateUserDTO.getphoneOpen(); - this.emergencyOpen = updateUserDTO.getEmergencyOpen(); - this.addressOpen = updateUserDTO.getAddressOpen(); + this.phoneOpen = updateUserDTO.getPhoneOpen() == null ? this.phoneOpen : updateUserDTO.getPhoneOpen(); + this.emergencyOpen = updateUserDTO.getEmergencyOpen() == null ? this.emergencyOpen : updateUserDTO.getEmergencyOpen(); + this.addressOpen = updateUserDTO.getAddressOpen() == null ? this.addressOpen : updateUserDTO.getAddressOpen(); } }