-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #212 from Make-A-Wish-Sopt/feature/jioyung-#211-de…
…velop [FEAT] 계좌 구조 수정
- Loading branch information
Showing
10 changed files
with
112 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/sopterm/makeawish/domain/user/TransferInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.sopterm.makeawish.domain.user; | ||
|
||
import com.sopterm.makeawish.dto.user.UserAccountRequestDTO; | ||
import jakarta.persistence.Embeddable; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Embeddable | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class TransferInfo { | ||
private AccountInfo accountInfo; | ||
private String kakaoPayCode; | ||
private boolean forPayCode; | ||
|
||
public void updateTransferInfo(AccountInfo accountInfo, String kakaoPayCode, boolean forPayCode){ | ||
this.accountInfo = accountInfo; | ||
this.kakaoPayCode = kakaoPayCode; | ||
this.forPayCode = forPayCode; | ||
} | ||
|
||
@Builder | ||
public TransferInfo(UserAccountRequestDTO userAccountRequestDTO){ | ||
this.accountInfo = userAccountRequestDTO.accountInfo(); | ||
this.forPayCode = userAccountRequestDTO.forPayCode(); | ||
this.kakaoPayCode = userAccountRequestDTO.kakaoPayCode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
src/main/java/com/sopterm/makeawish/dto/user/UserAccountResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
package com.sopterm.makeawish.dto.user; | ||
|
||
import static java.util.Objects.*; | ||
|
||
import com.sopterm.makeawish.domain.user.AccountInfo; | ||
import com.sopterm.makeawish.domain.user.TransferInfo; | ||
import com.sopterm.makeawish.domain.user.User; | ||
import lombok.Builder; | ||
|
||
import static java.util.Objects.nonNull; | ||
|
||
@Builder | ||
public record UserAccountResponseDTO( | ||
Long id, | ||
AccountInfo accountInfo | ||
Long id, | ||
TransferInfo transferInfo | ||
) { | ||
public static UserAccountResponseDTO of(User user) { | ||
return UserAccountResponseDTO.builder() | ||
.id(user.getId()) | ||
.accountInfo(getUserAccount(user)) | ||
.build(); | ||
} | ||
public static UserAccountResponseDTO of(User user) { | ||
return UserAccountResponseDTO.builder() | ||
.id(user.getId()) | ||
.transferInfo(getUserTransferInfo(user)) | ||
.build(); | ||
} | ||
|
||
private static AccountInfo getUserAccount(User user) { | ||
return nonNull(user.getAccount()) ? user.getAccount() : null; | ||
} | ||
private static TransferInfo getUserTransferInfo(User user) { | ||
return nonNull(user.getTransferInfo()) ? user.getTransferInfo() : null; | ||
} | ||
} |
7 changes: 3 additions & 4 deletions
7
src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateRequestDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
package com.sopterm.makeawish.dto.wish; | ||
|
||
import com.sopterm.makeawish.domain.user.TransferInfo; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record UserWishUpdateRequestDTO( | ||
String startDate, | ||
String endDate, | ||
String name, | ||
String bankName, | ||
String account, | ||
String imageUrl, | ||
String title, | ||
boolean wantsGift, | ||
String kakaoPayCode | ||
String hint, | ||
TransferInfo transferInfo | ||
) { | ||
} |
43 changes: 23 additions & 20 deletions
43
src/main/java/com/sopterm/makeawish/dto/wish/UserWishUpdateResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
package com.sopterm.makeawish.dto.wish; | ||
|
||
import static java.util.Objects.*; | ||
|
||
import com.sopterm.makeawish.domain.user.AccountInfo; | ||
import com.sopterm.makeawish.domain.user.User; | ||
import com.sopterm.makeawish.domain.user.TransferInfo; | ||
import com.sopterm.makeawish.domain.wish.Wish; | ||
import com.sopterm.makeawish.domain.wish.WishStatus; | ||
|
||
import lombok.Builder; | ||
|
||
import static java.util.Objects.nonNull; | ||
|
||
@Builder | ||
public record UserWishUpdateResponseDTO( | ||
String startDate, | ||
String endDate, | ||
AccountInfo accountInfo, | ||
String imageUrl, | ||
String title, | ||
WishStatus status | ||
String startDate, | ||
String endDate, | ||
TransferInfo transferInfo, | ||
String imageUrl, | ||
String title, | ||
WishStatus status, | ||
String hint, | ||
boolean wantsGift | ||
) { | ||
public static UserWishUpdateResponseDTO of(User user, Wish wish) { | ||
return UserWishUpdateResponseDTO.builder() | ||
.startDate(wish.getStartAt().toString()) | ||
.endDate(wish.getEndAt().toString()) | ||
.accountInfo(nonNull(user.getAccount()) ? user.getAccount() : null) | ||
.imageUrl(wish.getPresentImageUrl()) | ||
.title(wish.getTitle()) | ||
.status(wish.getStatus(0)) | ||
.build(); | ||
} | ||
public static UserWishUpdateResponseDTO of(User user, Wish wish) { | ||
return UserWishUpdateResponseDTO.builder() | ||
.startDate(wish.getStartAt().toString()) | ||
.endDate(wish.getEndAt().toString()) | ||
.transferInfo(nonNull(user.getTransferInfo()) ? user.getTransferInfo() : null) | ||
.imageUrl(wish.getPresentImageUrl()) | ||
.title(wish.getTitle()) | ||
.status(wish.getStatus(0)) | ||
.hint(wish.getHint()) | ||
.wantsGift(wish.isWantsGift()) | ||
.build(); | ||
} | ||
} |
48 changes: 22 additions & 26 deletions
48
src/main/java/com/sopterm/makeawish/dto/wish/WishResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters