Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/dokdok/topic/api/ConfirmTopicApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public interface ConfirmTopicApi {
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = ConfirmedTopicsResponse.class),
examples = @ExampleObject(value = """
{"code":"SUCCESS","message":"확정된 주제 조회를 완료했습니다.","data":{"page":{"items":[{"topicId":10,"title":"데미안에서 '자기 자신'이란?","description":"주제에 대한 간단한 설명입니다.","topicType":"DISCUSSION","confirmOrder":1,"createdByInfo":{"userId":1,"nickname":"독서왕"}}],"pageSize":10,"hasNext":false,"nextCursor":null,"totalCount":1},"actions":{"canViewPreOpinions":true,"canWritePreOpinions":false}}}
{"code":"SUCCESS","message":"확정된 주제 조회를 완료했습니다.","data":{"items":[{"topicId":10,"title":"데미안에서 '자기 자신'이란?","description":"주제에 대한 간단한 설명입니다.","topicType":"DISCUSSION","topicTypeLabel":"토론형","likeCount":5,"confirmOrder":1,"createdByInfo":{"userId":1,"nickname":"독서왕"}}],"pageSize":10,"hasNext":false,"nextCursor":null,"totalCount":1,"actions":{"canViewPreOpinions":true,"canWritePreOpinions":false}}}
"""))
),
@io.swagger.v3.oas.annotations.responses.ApiResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import com.dokdok.global.response.CursorResponse;
import com.dokdok.topic.entity.Topic;
import com.dokdok.topic.entity.TopicType;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;

@JsonPropertyOrder({"items", "pageSize", "hasNext", "nextCursor", "totalCount", "actions"})
@Schema(description = "확정된 주제 목록 응답")
public record ConfirmedTopicsResponse(
@Schema(description = "확정된 주제 목록 페이지 정보")
@JsonUnwrapped
CursorResponse<ConfirmedTopicDto, ConfirmedTopicsCursor> page,
@Schema(description = "사전 의견 관련 권한 정보")
Actions actions
Expand All @@ -35,6 +38,10 @@ public record ConfirmedTopicDto(
String description,
@Schema(description = "주제 타입", example = "DISCUSSION")
TopicType topicType,
@Schema(description = "주제 타입 라벨", example = "토론형")
String topicTypeLabel,
@Schema(description = "좋아요 수", example = "5")
Integer likeCount,
@Schema(description = "확정 순서", example = "1")
Integer confirmOrder,
@Schema(description = "주제 제안자 정보")
Expand All @@ -46,6 +53,8 @@ public static ConfirmedTopicDto from(Topic topic) {
.title(topic.getTitle())
.description(topic.getDescription())
.topicType(topic.getTopicType())
.topicTypeLabel(topic.getTopicType().getDisplayName())
.likeCount(topic.getLikeCount())
.confirmOrder(topic.getConfirmOrder())
.createdByInfo(
CreatedByInfo.of(
Expand Down