diff --git a/backend/src/main/java/com/votogether/domain/notice/dto/response/NoticeResponse.java b/backend/src/main/java/com/votogether/domain/notice/dto/response/NoticeResponse.java index 285eaeb08..124ffd3a8 100644 --- a/backend/src/main/java/com/votogether/domain/notice/dto/response/NoticeResponse.java +++ b/backend/src/main/java/com/votogether/domain/notice/dto/response/NoticeResponse.java @@ -1,5 +1,6 @@ package com.votogether.domain.notice.dto.response; +import com.fasterxml.jackson.annotation.JsonFormat; import com.votogether.domain.notice.entity.Notice; import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDateTime; @@ -22,9 +23,11 @@ public record NoticeResponse( String content, @Schema(description = "공지사항 배너 마감기한", example = "2023-12-25 23:59") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") LocalDateTime deadline, @Schema(description = "공지사항 생성시각", example = "2023-12-25 23:59") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") LocalDateTime createdAt ) { diff --git a/backend/src/test/java/com/votogether/domain/notice/controller/NoticeQueryControllerTest.java b/backend/src/test/java/com/votogether/domain/notice/controller/NoticeQueryControllerTest.java index 0e834508b..729340a80 100644 --- a/backend/src/test/java/com/votogether/domain/notice/controller/NoticeQueryControllerTest.java +++ b/backend/src/test/java/com/votogether/domain/notice/controller/NoticeQueryControllerTest.java @@ -13,6 +13,7 @@ import com.votogether.test.ControllerTest; import io.restassured.module.mockmvc.RestAssuredMockMvc; import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -52,8 +53,8 @@ void getProgressNotice() throws Exception { "bannerTitle", "bannerSubtitle", "content", - LocalDateTime.now().plusDays(1), - LocalDateTime.now() + LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MINUTES), + LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES) ); given(noticeQueryService.getProgressNotice()).willReturn(expected); @@ -86,8 +87,8 @@ void getNotices() throws Exception { "bannerTitle", "bannerSubtitle", "content", - LocalDateTime.now().plusDays(1), - LocalDateTime.now() + LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MINUTES), + LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES) ); NoticePageResponse expected = new NoticePageResponse(1, 0, List.of(noticeResponse)); given(noticeQueryService.getNotices(anyInt())).willReturn(expected); @@ -153,8 +154,8 @@ void getNotice() throws Exception { "bannerTitle", "bannerSubtitle", "content", - LocalDateTime.now().plusDays(1), - LocalDateTime.now() + LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MINUTES), + LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES) ); given(noticeQueryService.getNotice(anyLong())).willReturn(expected);