-
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.
Merge pull request #151 from sharemindteam/feature/147-post-customer-…
…public feat: 구매자 공개상담 탭 api 구현
- Loading branch information
Showing
11 changed files
with
254 additions
and
41 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
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
84 changes: 84 additions & 0 deletions
84
src/main/java/com/example/sharemind/post/dto/response/PostGetListResponse.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,84 @@ | ||
package com.example.sharemind.post.dto.response; | ||
|
||
import com.example.sharemind.global.utils.TimeUtil; | ||
import com.example.sharemind.post.domain.Post; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDateTime; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class PostGetListResponse { | ||
|
||
@Schema(description = "일대다 질문 아이디") | ||
private final Long postId; | ||
|
||
@Schema(description = "제목") | ||
private final String title; | ||
|
||
@Schema(description = "상담 내용") | ||
private final String content; | ||
|
||
@Schema(description = "공개/비공개 여부") | ||
private final Boolean isPublic; | ||
|
||
@Schema(description = "좋아요 수") | ||
private final Long totalLike; | ||
|
||
@Schema(description = "스크랩 수") | ||
private final Long totalScrap; | ||
|
||
@Schema(description = "답변 수") | ||
private final Long totalComment; | ||
|
||
@Schema(description = "마지막 업데이트 일시", example = "8분 전") | ||
private final String updatedAt; | ||
|
||
@Schema(description = "답변 완료 일시") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Seoul") | ||
private final LocalDateTime finishedAt; | ||
|
||
@Builder | ||
public PostGetListResponse(Long postId, String title, String content, Boolean isPublic, | ||
Long totalLike, Long totalScrap, Long totalComment, String updatedAt, | ||
LocalDateTime finishedAt) { | ||
this.postId = postId; | ||
this.title = title; | ||
this.content = content; | ||
this.isPublic = isPublic; | ||
this.totalLike = totalLike; | ||
this.totalScrap = totalScrap; | ||
this.totalComment = totalComment; | ||
this.updatedAt = updatedAt; | ||
this.finishedAt = finishedAt; | ||
} | ||
|
||
public static PostGetListResponse of(Post post) { | ||
return PostGetListResponse.builder() | ||
.postId(post.getPostId()) | ||
.title(post.getTitle()) | ||
.content(post.getContent()) | ||
.isPublic(post.getIsPublic()) | ||
.totalLike(post.getTotalLike()) | ||
.totalScrap(post.getTotalScrap()) | ||
.totalComment(post.getTotalComment()) | ||
.updatedAt(TimeUtil.getUpdatedAt(post.getUpdatedAt())) | ||
.finishedAt(post.getFinishedAt()) | ||
.build(); | ||
} | ||
|
||
public static PostGetListResponse ofIsNotCompleted(Post post) { | ||
return PostGetListResponse.builder() | ||
.postId(post.getPostId()) | ||
.title(null) | ||
.content(null) | ||
.isPublic(post.getIsPublic()) | ||
.totalLike(post.getTotalLike()) | ||
.totalScrap(post.getTotalScrap()) | ||
.totalComment(post.getTotalComment()) | ||
.updatedAt(TimeUtil.getUpdatedAt(post.getUpdatedAt())) | ||
.finishedAt(post.getFinishedAt()) | ||
.build(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/com/example/sharemind/post/dto/response/PostGetPopularityResponse.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,29 @@ | ||
package com.example.sharemind.post.dto.response; | ||
|
||
import com.example.sharemind.post.domain.Post; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class PostGetPopularityResponse { | ||
|
||
@Schema(description = "일대다 질문 아이디") | ||
private final Long postId; | ||
|
||
@Schema(description = "제목") | ||
private final String title; | ||
|
||
@Builder | ||
public PostGetPopularityResponse(Long postId, String title) { | ||
this.postId = postId; | ||
this.title = title; | ||
} | ||
|
||
public static PostGetPopularityResponse of(Post post) { | ||
return PostGetPopularityResponse.builder() | ||
.postId(post.getPostId()) | ||
.title(post.getTitle()) | ||
.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
Oops, something went wrong.