diff --git a/src/main/java/com/example/repick/domain/user/dto/PatchUserInfo.java b/src/main/java/com/example/repick/domain/user/dto/PatchUserInfo.java index bb4bb89d..eb53c6bf 100644 --- a/src/main/java/com/example/repick/domain/user/dto/PatchUserInfo.java +++ b/src/main/java/com/example/repick/domain/user/dto/PatchUserInfo.java @@ -1,10 +1,14 @@ package com.example.repick.domain.user.dto; +import com.example.repick.global.entity.Account; +import com.example.repick.global.entity.Address; import io.swagger.v3.oas.annotations.media.Schema; public record PatchUserInfo( @Schema(description = "이메일", example = "test@test.test") String email, @Schema(description = "닉네임", example = "테스트") String nickname, + Address address, + Account account, @Schema(description = "상의 사이즈", example = "L") String topSize, @Schema(description = "하의 사이즈", example = "L") String bottomSize, @Schema(description = "푸시알림 허용 여부 ( true | false )", example = "true") Boolean pushAllow, diff --git a/src/main/java/com/example/repick/domain/user/entity/User.java b/src/main/java/com/example/repick/domain/user/entity/User.java index daafd04f..03dfd2e0 100644 --- a/src/main/java/com/example/repick/domain/user/entity/User.java +++ b/src/main/java/com/example/repick/domain/user/entity/User.java @@ -1,6 +1,8 @@ package com.example.repick.domain.user.entity; import com.example.repick.domain.user.dto.PatchUserInfo; +import com.example.repick.global.entity.Address; +import com.example.repick.global.entity.Account; import com.example.repick.global.entity.BaseEntity; import jakarta.persistence.*; import lombok.Builder; @@ -26,6 +28,10 @@ public class User extends BaseEntity { // 추가 정보 private String nickname; + @Embedded + private Address defaultAddress; + @Embedded + private Account defaultAccount; private String topSize; private String bottomSize; @@ -41,11 +47,13 @@ public class User extends BaseEntity { private Role role; @Builder - public User(OAuthProvider oAuthProvider, String providerId, String email, String nickname, String topSize, String bottomSize, String profileImage, String password, Role role, Boolean pushAllow, String fcmToken) { + public User(OAuthProvider oAuthProvider, String providerId, String email, String nickname, Address defaultAddress, Account defaultAccount, String topSize, String bottomSize, String profileImage, String password, Role role, Boolean pushAllow, String fcmToken) { this.oAuthProvider = oAuthProvider; this.providerId = providerId; this.email = email; this.nickname = nickname; + this.defaultAddress = defaultAddress; + this.defaultAccount = defaultAccount; this.topSize = topSize; this.bottomSize = bottomSize; this.profileImage = profileImage; @@ -60,6 +68,8 @@ public User(OAuthProvider oAuthProvider, String providerId, String email, String public void update(PatchUserInfo patchUserInfo) { this.email = patchUserInfo.email() != null ? patchUserInfo.email() : this.email; this.nickname = patchUserInfo.nickname() != null ? patchUserInfo.nickname() : this.nickname; + this.defaultAddress = patchUserInfo.address() != null ? patchUserInfo.address() : this.defaultAddress; + this.defaultAccount = patchUserInfo.account() != null ? patchUserInfo.account() : this.defaultAccount; this.topSize = patchUserInfo.topSize() != null ? patchUserInfo.topSize() : this.topSize; this.bottomSize = patchUserInfo.bottomSize() != null ? patchUserInfo.bottomSize() : this.bottomSize; this.pushAllow = patchUserInfo.pushAllow() != null ? patchUserInfo.pushAllow() : this.pushAllow; diff --git a/src/main/java/com/example/repick/global/entity/Account.java b/src/main/java/com/example/repick/global/entity/Account.java new file mode 100644 index 00000000..6144d642 --- /dev/null +++ b/src/main/java/com/example/repick/global/entity/Account.java @@ -0,0 +1,11 @@ +package com.example.repick.global.entity; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +@Getter +public class Account { + @Schema(description = "은행명", example = "카카오뱅크") private String bankName; + @Schema(description = "계좌번호", example = "3338088020629") private String accountNumber; + @Schema(description = "예금주", example = "서찬혁") private String accountHolder; +} diff --git a/src/main/java/com/example/repick/global/entity/Address.java b/src/main/java/com/example/repick/global/entity/Address.java index 8d7f255e..83e78679 100644 --- a/src/main/java/com/example/repick/global/entity/Address.java +++ b/src/main/java/com/example/repick/global/entity/Address.java @@ -1,14 +1,15 @@ package com.example.repick.global.entity; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.Embeddable; import lombok.Getter; @Embeddable @Getter public class Address { - private String postalCode; - private String mainAddress; - private String detailAddress; + @Schema(description = "우편번호", example = "02835") private String postalCode; + @Schema(description = "기본 주소", example = "은평구 응암동 210-94") private String mainAddress; + @Schema(description = "상세 주소", example = "101호") private String detailAddress; public Address(String postalCode, String mainAddress, String detailAddress) { this.postalCode = postalCode;