-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
6 deletions.
There are no files selected for viewing
20 changes: 14 additions & 6 deletions
20
src/main/java/com/leets/X/domain/follow/dto/response/FollowResponse.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,22 +1,30 @@ | ||
package com.leets.X.domain.follow.dto.response; | ||
|
||
import com.leets.X.domain.image.domain.Image; | ||
import com.leets.X.domain.image.dto.request.ImageDto; | ||
import com.leets.X.domain.post.dto.response.PostUserResponse; | ||
import com.leets.X.domain.user.domain.User; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record FollowResponse( | ||
Long id, | ||
String name, | ||
String customId, | ||
String introduce | ||
PostUserResponse response | ||
// boolean followStatus | ||
) { | ||
public static FollowResponse from(User user) { | ||
return FollowResponse.builder() | ||
.id(user.getId()) | ||
.name(user.getName()) | ||
.customId(user.getCustomId()) | ||
.introduce(user.getIntroduce()) | ||
.response(toPostUserResponse(user)) | ||
.build(); | ||
} | ||
|
||
public static PostUserResponse toPostUserResponse(User user) { | ||
ImageDto dto = null; | ||
Image image = user.getImage(); | ||
if(image != null){ | ||
dto = ImageDto.of(image.getName(), image.getUrl()); | ||
} | ||
return PostUserResponse.from(user, dto); | ||
} | ||
} |