-
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.
fix: CartGroupMemberResponse Convert Response (#162)
- Loading branch information
Showing
5 changed files
with
58 additions
and
36 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/main/java/com/api/ttoklip/domain/privacy/dto/InterestResponse.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,9 +1,9 @@ | ||
package com.api.ttoklip.domain.privacy.dto; | ||
|
||
import com.api.ttoklip.domain.privacy.domain.Interest; | ||
public record InterestResponse(Long id, String categoryName) { | ||
public record InterestResponse(String categoryName) { | ||
|
||
public static InterestResponse from(final Interest interest) { | ||
return new InterestResponse(interest.getId(), interest.getCategory().getName()); | ||
return new InterestResponse(interest.getCategory().getName()); | ||
} | ||
} |
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
33 changes: 26 additions & 7 deletions
33
src/main/java/com/api/ttoklip/domain/town/cart/post/dto/response/CartMemberResponse.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,21 +1,40 @@ | ||
package com.api.ttoklip.domain.town.cart.post.dto.response; | ||
|
||
import com.api.ttoklip.domain.member.domain.Member; | ||
import com.api.ttoklip.domain.privacy.domain.Interest; | ||
import com.api.ttoklip.domain.privacy.dto.InterestResponse; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class CartMemberResponse { | ||
private String nickname; | ||
private String profileImgUrl; | ||
private String email; | ||
private List<InterestResponse> interests; | ||
|
||
|
||
@Builder | ||
private CartMemberResponse(final String nickname, final String profileImgUrl, final String email, | ||
final List<InterestResponse> interests) { | ||
this.nickname = nickname; | ||
this.profileImgUrl = profileImgUrl; | ||
this.email = email; | ||
this.interests = interests; | ||
} | ||
|
||
public static CartMemberResponse of(final Member member, final List<Interest> interests) { | ||
|
||
List<InterestResponse> interestResponses = interests.stream() | ||
.map(InterestResponse::from) | ||
.toList(); | ||
|
||
return CartMemberResponse.builder() | ||
.nickname(member.getNickname()) | ||
.profileImgUrl(member.getProfile().getProfileImgUrl()) | ||
.email(member.getEmail()) | ||
.interests(interestResponses) | ||
.build(); | ||
} | ||
} |
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