Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #127 from FinFellows/develop
Browse files Browse the repository at this point in the history
마이페이지 조회 API에서 상품 ID를 함께 응답한다.
  • Loading branch information
LEEJaeHyeok97 authored Jan 13, 2024
2 parents 8509b7f + 41ec7ba commit e35fc91
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

@Data
public class CmaBookmarkRes {
private Long cmaId;
private String companyName;
private String productName;
private String cmaType;
Expand All @@ -17,7 +18,8 @@ public class CmaBookmarkRes {


@Builder
public CmaBookmarkRes(String companyName, String productName, String cmaType, String maturityInterestRate, String specialCondition) {
public CmaBookmarkRes(Long cmaId, String companyName, String productName, String cmaType, String maturityInterestRate, String specialCondition) {
this.cmaId = cmaId;
this.companyName = companyName;
this.productName = productName;
this.cmaType = cmaType;
Expand All @@ -30,6 +32,7 @@ public CmaBookmarkRes(String companyName, String productName, String cmaType, St
public static List<CmaBookmarkRes> toDto(List<CmaBookmark> cmaBookmarks) {
return cmaBookmarks.stream()
.map(bookmark -> CmaBookmarkRes.builder()
.cmaId(bookmark.getCma().getId())
.cmaType(bookmark.getCma().getCmaType())
.productName(bookmark.getCma().getProductName())
.companyName(bookmark.getCma().getCompanyName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

@Data
public class FinancialProductBookmarkRes {
private Long financialProductId;
private FinancialProductType financialProductType;
private String companyName;
private String productName;
Expand All @@ -22,7 +23,8 @@ public class FinancialProductBookmarkRes {


@Builder
public FinancialProductBookmarkRes(FinancialProductType financialProductType, String companyName, String productName, String interestRate, String maximumPreferredInterestRate) {
public FinancialProductBookmarkRes(Long financialProductId, FinancialProductType financialProductType, String companyName, String productName, String interestRate, String maximumPreferredInterestRate) {
this.financialProductId = financialProductId;
this.financialProductType = financialProductType;
this.companyName = companyName;
this.productName = productName;
Expand All @@ -31,20 +33,22 @@ public FinancialProductBookmarkRes(FinancialProductType financialProductType, St
}



public static List<FinancialProductBookmarkRes> toDto(List<FinancialProductBookmark> bookmarks) {
List<FinancialProductBookmarkRes> results = new ArrayList<>();

for (FinancialProductBookmark bookmark : bookmarks) {
FinancialProduct financialProduct = bookmark.getFinancialProduct();

for (FinancialProductOption financialProductOption : financialProduct.getFinancialProductOption()) {
Long financialProductId = financialProduct.getId();
FinancialProductType financialProductType = financialProduct.getFinancialProductType();
String companyName = financialProduct.getCompanyName();
String productName = financialProduct.getProductName();
String interestRate = financialProductOption.getInterestRate();
String maximumPreferredInterestRate = financialProductOption.getMaximumPreferredInterestRate();

results.add(new FinancialProductBookmarkRes(financialProductType, companyName, productName, interestRate, maximumPreferredInterestRate));
results.add(new FinancialProductBookmarkRes(financialProductId ,financialProductType, companyName, productName, interestRate, maximumPreferredInterestRate));

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

@Data
public class PolicyInfoBookmarkRes {
private Long policyInfoId;
private String contentName;
private String content;


@Builder
public PolicyInfoBookmarkRes(String contentName, String content) {
public PolicyInfoBookmarkRes(Long policyInfoId, String contentName, String content) {
this.policyInfoId = policyInfoId;
this.contentName = contentName;
this.content = content;
}
Expand All @@ -24,6 +26,7 @@ public PolicyInfoBookmarkRes(String contentName, String content) {
public static List<PolicyInfoBookmarkRes> toDto(List<PolicyInfoBookmark> bookmarks) {
return bookmarks.stream()
.map(bookmark -> PolicyInfoBookmarkRes.builder()
.policyInfoId(bookmark.getPolicyInfo().getId())
.contentName(bookmark.getPolicyInfo().getPolyBizSjNm())
.content(bookmark.getPolicyInfo().getPolyItcnCn())
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@

@Data
public class PostBookmarkRes {
private Long postId;
private String title;
private String content;
private ContentType contentType;


@Builder
public PostBookmarkRes(String title, String content, ContentType contentType) {
public PostBookmarkRes(Long postId, String title, String content, ContentType contentType) {
this.postId = postId;
this.title = title;
this.content = content;
this.contentType = contentType;
Expand All @@ -37,16 +38,18 @@ public static List<PostBookmarkRes> toDto(List<PostBookmark> bookmarks) {

if (contentType == ContentType.EDU_CONTENT) {
for (EduContent eduContent : post.getEduContent()) {
Long postId = eduContent.getId();
String title = eduContent.getTitle();
String content = eduContent.getContent();
results.add(new PostBookmarkRes(title, content, contentType));
results.add(new PostBookmarkRes(postId, title, content, contentType));
}
}
if (contentType == ContentType.NEWS_CONTENT) {
for (NewsContent newsContent : post.getNewsContent()) {
Long postId = newsContent.getId();
String title = newsContent.getTitle();
String content = newsContent.getContent();
results.add(new PostBookmarkRes(title, content, contentType));
results.add(new PostBookmarkRes(postId, title, content, contentType));
}
}
}
Expand Down

0 comments on commit e35fc91

Please sign in to comment.