Skip to content

Commit

Permalink
Feature/user (#10)
Browse files Browse the repository at this point in the history
* refactor: authenticate via providerId

* feature: ์—”ํ‹ฐํ‹ฐ์— ์นผ๋Ÿผ ์ถ”๊ฐ€

* feature: ๋ฌธ์ž ์ธ์ฆ ๊ธฐ๋Šฅ ๊ตฌํ˜„

* feature: ์ฃผ์†Œ, ๊ณ„์ขŒ ์ •๋ณด ์ถ”๊ฐ€ ์ž…๋ ฅ
  • Loading branch information
mushroom1324 authored Mar 6, 2024
1 parent ff8e7ef commit 113ff98
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]") 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,
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/com/example/repick/domain/user/entity/User.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/example/repick/global/entity/Account.java
Original file line number Diff line number Diff line change
@@ -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;
}
7 changes: 4 additions & 3 deletions src/main/java/com/example/repick/global/entity/Address.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 113ff98

Please sign in to comment.