From a16b01badbc760b8490641052035661a158bc081 Mon Sep 17 00:00:00 2001 From: kelly6bf Date: Mon, 2 Feb 2026 21:23:10 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#251=20=EB=8B=B9=EC=9D=BC=20=ED=9E=88?= =?UTF-8?q?=EC=8A=A4=ED=86=A0=EB=A6=AC=20=EC=A1=B0=ED=9A=8C=20API=EC=97=90?= =?UTF-8?q?=20=EB=82=B4=20=ED=9E=88=EC=8A=A4=ED=86=A0=EB=A6=AC=20=EC=97=AC?= =?UTF-8?q?=EB=B6=80=EB=A5=BC=20=ED=99=95=EC=9D=B8=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20isMine=20=EC=9D=91=EB=8B=B5=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...upMemberTodayTodoHistoryApiResponseV2.java | 6 +++-- .../entity/DailyTodoHistory.java | 5 ++++ .../service/DailyTodoHistoryService.java | 6 +++-- .../service/dto/TodoHistoryDto.java | 3 ++- .../v1/DailyTodoControllerV1DocsTest.java | 24 ++++++++++++------- .../v2/DailyTodoControllerV2DocsTest.java | 17 +++++++------ 6 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/main/java/site/dogether/dailytodo/controller/v2/dto/response/GetChallengeGroupMemberTodayTodoHistoryApiResponseV2.java b/src/main/java/site/dogether/dailytodo/controller/v2/dto/response/GetChallengeGroupMemberTodayTodoHistoryApiResponseV2.java index d89f60bd..f7505282 100644 --- a/src/main/java/site/dogether/dailytodo/controller/v2/dto/response/GetChallengeGroupMemberTodayTodoHistoryApiResponseV2.java +++ b/src/main/java/site/dogether/dailytodo/controller/v2/dto/response/GetChallengeGroupMemberTodayTodoHistoryApiResponseV2.java @@ -28,7 +28,8 @@ public record TodoData( String certificationMediaUrl, boolean isRead, @JsonInclude(JsonInclude.Include.NON_NULL) - String reviewFeedback + String reviewFeedback, + boolean isMine ) { public static TodoData from(final TodoHistoryDto dto) { return new TodoData( @@ -41,7 +42,8 @@ public static TodoData from(final TodoHistoryDto dto) { dto.certificationContent(), dto.certificationMediaUrl(), dto.isRead(), - dto.reviewFeedback() + dto.reviewFeedback(), + dto.isMine() ); } } diff --git a/src/main/java/site/dogether/dailytodohistory/entity/DailyTodoHistory.java b/src/main/java/site/dogether/dailytodohistory/entity/DailyTodoHistory.java index e4a5980a..e27f77f0 100644 --- a/src/main/java/site/dogether/dailytodohistory/entity/DailyTodoHistory.java +++ b/src/main/java/site/dogether/dailytodohistory/entity/DailyTodoHistory.java @@ -17,6 +17,7 @@ import lombok.ToString; import site.dogether.common.audit.entity.BaseEntity; import site.dogether.dailytodo.entity.DailyTodo; +import site.dogether.member.entity.Member; import java.time.LocalDateTime; import java.util.List; @@ -60,4 +61,8 @@ public DailyTodoHistory( public void updateEventTime() { this.eventTime = LocalDateTime.now(); } + + public boolean isMine(final Member target) { + return dailyTodo.isWriter(target); + } } diff --git a/src/main/java/site/dogether/dailytodohistory/service/DailyTodoHistoryService.java b/src/main/java/site/dogether/dailytodohistory/service/DailyTodoHistoryService.java index 06808d82..d89625f1 100644 --- a/src/main/java/site/dogether/dailytodohistory/service/DailyTodoHistoryService.java +++ b/src/main/java/site/dogether/dailytodohistory/service/DailyTodoHistoryService.java @@ -103,7 +103,8 @@ private TodoHistoryDto convertDtoFromHistory(final DailyTodoHistory history, fin dailyTodoCertification.getContent(), dailyTodoCertification.getMediaUrl(), isHistoryRead, - dailyTodoCertification.findReviewFeedback().orElse(null))) + dailyTodoCertification.findReviewFeedback().orElse(null), + history.isMine(viewer))) .orElse(new TodoHistoryDto( history.getId(), dailyTodo.getId(), @@ -114,7 +115,8 @@ private TodoHistoryDto convertDtoFromHistory(final DailyTodoHistory history, fin null, null, isHistoryRead, - null)); + null, + history.isMine(viewer))); } private boolean checkMemberReadDailyTodoHistory(final Member member, final DailyTodoHistory dailyTodoHistory) { diff --git a/src/main/java/site/dogether/dailytodohistory/service/dto/TodoHistoryDto.java b/src/main/java/site/dogether/dailytodohistory/service/dto/TodoHistoryDto.java index cef2e616..9f98c438 100644 --- a/src/main/java/site/dogether/dailytodohistory/service/dto/TodoHistoryDto.java +++ b/src/main/java/site/dogether/dailytodohistory/service/dto/TodoHistoryDto.java @@ -10,5 +10,6 @@ public record TodoHistoryDto( String certificationContent, String certificationMediaUrl, boolean isRead, - String reviewFeedback + String reviewFeedback, + boolean isMine ) {} diff --git a/src/test/java/site/dogether/docs/dailytodo/v1/DailyTodoControllerV1DocsTest.java b/src/test/java/site/dogether/docs/dailytodo/v1/DailyTodoControllerV1DocsTest.java index a7326a65..03282908 100644 --- a/src/test/java/site/dogether/docs/dailytodo/v1/DailyTodoControllerV1DocsTest.java +++ b/src/test/java/site/dogether/docs/dailytodo/v1/DailyTodoControllerV1DocsTest.java @@ -25,14 +25,20 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -import static org.springframework.restdocs.payload.PayloadDocumentation.*; -import static org.springframework.restdocs.request.RequestDocumentation.*; +import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; +import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; +import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; +import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; +import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; +import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static site.dogether.dailytodo.entity.DailyTodoStatus.CERTIFY_COMPLETED; import static site.dogether.dailytodo.entity.DailyTodoStatus.CERTIFY_PENDING; -import static site.dogether.dailytodocertification.entity.DailyTodoCertificationReviewStatus.*; +import static site.dogether.dailytodocertification.entity.DailyTodoCertificationReviewStatus.APPROVE; +import static site.dogether.dailytodocertification.entity.DailyTodoCertificationReviewStatus.REJECT; +import static site.dogether.dailytodocertification.entity.DailyTodoCertificationReviewStatus.REVIEW_PENDING; @DisplayName("데일리 투두 V1 API 문서화 테스트") public class DailyTodoControllerV1DocsTest extends RestDocsSupport { @@ -254,12 +260,12 @@ void getChallengeGroupMemberTodayTodoHistoryV1() throws Exception { final FindTargetMemberTodayTodoHistoriesDto serviceMockResponse = new FindTargetMemberTodayTodoHistoriesDto( 3, List.of( - new TodoHistoryDto(1L, 1L, "치킨 먹기", CERTIFY_PENDING.name(), true, true, null, null, true, null), - new TodoHistoryDto(2L, 2L, "재홍님 갈구기", CERTIFY_PENDING.name(), true, true, null, null, true, null), - new TodoHistoryDto(3L, 3L, "치킨 먹기", REVIEW_PENDING.name(), true, true, "개꿀맛 치킨 냠냠", "https://치킨.png", true, null), - new TodoHistoryDto(4L, 4L, "재홍님 갈구기", REVIEW_PENDING.name(), true, true, "아 재홍님 그거 그렇게 하는거 아닌데", "https://갈굼1.png", false, null), - new TodoHistoryDto(5L, 5L, "재홍님 갈구기", APPROVE.name(), true, true, "아 재홍님 그거 그렇게 하는거 아닌데", "https://갈굼1.png", false, "재홍님 갈구기 너무 재밌어요"), - new TodoHistoryDto(6L, 6L, "치킨 먹기", REJECT.name(), true, true, "개꿀맛 치킨 냠냠", "https://치킨.png", false, "치킨 부럽다ㅠㅠ 심술나서 노인정!") + new TodoHistoryDto(1L, 1L, "치킨 먹기", CERTIFY_PENDING.name(), true, true, null, null, true, null, false), + new TodoHistoryDto(2L, 2L, "재홍님 갈구기", CERTIFY_PENDING.name(), true, true, null, null, true, null, false), + new TodoHistoryDto(3L, 3L, "치킨 먹기", REVIEW_PENDING.name(), true, true, "개꿀맛 치킨 냠냠", "https://치킨.png", true, null, false), + new TodoHistoryDto(4L, 4L, "재홍님 갈구기", REVIEW_PENDING.name(), true, true, "아 재홍님 그거 그렇게 하는거 아닌데", "https://갈굼1.png", false, null, false), + new TodoHistoryDto(5L, 5L, "재홍님 갈구기", APPROVE.name(), true, true, "아 재홍님 그거 그렇게 하는거 아닌데", "https://갈굼1.png", false, "재홍님 갈구기 너무 재밌어요", false), + new TodoHistoryDto(6L, 6L, "치킨 먹기", REJECT.name(), true, true, "개꿀맛 치킨 냠냠", "https://치킨.png", false, "치킨 부럽다ㅠㅠ 심술나서 노인정!", false) ) ); given(dailyTodoHistoryService.findAllTodayTodoHistories(any(), any(), any())) diff --git a/src/test/java/site/dogether/docs/dailytodo/v2/DailyTodoControllerV2DocsTest.java b/src/test/java/site/dogether/docs/dailytodo/v2/DailyTodoControllerV2DocsTest.java index 36b1caef..a9d6ea90 100644 --- a/src/test/java/site/dogether/docs/dailytodo/v2/DailyTodoControllerV2DocsTest.java +++ b/src/test/java/site/dogether/docs/dailytodo/v2/DailyTodoControllerV2DocsTest.java @@ -190,12 +190,12 @@ void getChallengeGroupMemberTodayTodoHistoryV2() throws Exception { final FindTargetMemberTodayTodoHistoriesDto serviceMockResponse = new FindTargetMemberTodayTodoHistoriesDto( 3, List.of( - new TodoHistoryDto(1L, 1L, "치킨 먹기", CERTIFY_PENDING.name(), true, false, null, null, true, null), - new TodoHistoryDto(2L, 2L, "재홍님 갈구기", CERTIFY_PENDING.name(), true, false, null, null, true, null), - new TodoHistoryDto(3L, 3L, "치킨 먹기", REVIEW_PENDING.name(), false, true, "개꿀맛 치킨 냠냠", "https://치킨.png", true, null), - new TodoHistoryDto(4L, 4L, "재홍님 갈구기", REVIEW_PENDING.name(), false, false, "아 재홍님 그거 그렇게 하는거 아닌데", "https://갈굼1.png", false, null), - new TodoHistoryDto(5L, 5L, "재홍님 갈구기", APPROVE.name(), false, false, "아 재홍님 그거 그렇게 하는거 아닌데", "https://갈굼1.png", false, "재홍님 갈구기 너무 재밌어요"), - new TodoHistoryDto(6L, 6L, "치킨 먹기", REJECT.name(), false, false, "개꿀맛 치킨 냠냠", "https://치킨.png", false, "치킨 부럽다ㅠㅠ 심술나서 노인정!") + new TodoHistoryDto(1L, 1L, "치킨 먹기", CERTIFY_PENDING.name(), true, false, null, null, true, null, false), + new TodoHistoryDto(2L, 2L, "재홍님 갈구기", CERTIFY_PENDING.name(), true, false, null, null, true, null, false), + new TodoHistoryDto(3L, 3L, "치킨 먹기", REVIEW_PENDING.name(), false, true, "개꿀맛 치킨 냠냠", "https://치킨.png", true, null, false), + new TodoHistoryDto(4L, 4L, "재홍님 갈구기", REVIEW_PENDING.name(), false, false, "아 재홍님 그거 그렇게 하는거 아닌데", "https://갈굼1.png", false, null, false), + new TodoHistoryDto(5L, 5L, "재홍님 갈구기", APPROVE.name(), false, false, "아 재홍님 그거 그렇게 하는거 아닌데", "https://갈굼1.png", false, "재홍님 갈구기 너무 재밌어요", false), + new TodoHistoryDto(6L, 6L, "치킨 먹기", REJECT.name(), false, false, "개꿀맛 치킨 냠냠", "https://치킨.png", false, "치킨 부럽다ㅠㅠ 심술나서 노인정!", false) ) ); given(dailyTodoHistoryService.findAllTodayTodoHistories(any(), any(), any())) @@ -259,6 +259,9 @@ void getChallengeGroupMemberTodayTodoHistoryV2() throws Exception { fieldWithPath("data.todos[].reviewFeedback") .description("데일리 투두 인증 검사 피드백") .optional() - .type(JsonFieldType.STRING)))); + .type(JsonFieldType.STRING), + fieldWithPath("data.todos[].isMine") + .description("본인이 작성한 투두의 히스토리인지 여부") + .type(JsonFieldType.BOOLEAN)))); } }