From c9c87f4183748fff0acb9d30bc7604f36ca94d35 Mon Sep 17 00:00:00 2001 From: Kim Jiyoon Date: Sun, 1 Sep 2024 19:45:42 +0900 Subject: [PATCH] =?UTF-8?q?[#143]=20Hotfix:=20=EC=9D=BC=EC=A0=95=EB=B3=84?= =?UTF-8?q?=20=EC=A0=80=EC=9E=A5=ED=95=9C=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=EB=A5=BC=20=EB=AC=B6=EC=96=B4=EC=84=9C=20=EB=B0=98=ED=99=98?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=B4=20=EC=9D=BC=EA=B8=89?= =?UTF-8?q?=EC=BB=AC=EB=A0=89=EC=85=98=20=EB=B0=8F=20ScheduleImage=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/ScheduleImageResponse.java | 18 ++++++++++++++++++ .../scheduleImage/entity/ScheduleImage.java | 9 ++++----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 backend/src/main/java/com/isp/backend/domain/scheduleImage/dto/response/ScheduleImageResponse.java diff --git a/backend/src/main/java/com/isp/backend/domain/scheduleImage/dto/response/ScheduleImageResponse.java b/backend/src/main/java/com/isp/backend/domain/scheduleImage/dto/response/ScheduleImageResponse.java new file mode 100644 index 00000000..0ccae7ed --- /dev/null +++ b/backend/src/main/java/com/isp/backend/domain/scheduleImage/dto/response/ScheduleImageResponse.java @@ -0,0 +1,18 @@ +package com.isp.backend.domain.scheduleImage.dto.response; + +import lombok.Getter; + +import java.time.LocalDateTime; + +@Getter +public class ScheduleImageResponse { + private Long scheduleImageId; + private String path; + private LocalDateTime saveDate; + + public ScheduleImageResponse(Long scheduleImageId, String path, LocalDateTime saveDate) { + this.scheduleImageId = scheduleImageId; + this.path = path; + this.saveDate = saveDate; + } +} \ No newline at end of file diff --git a/backend/src/main/java/com/isp/backend/domain/scheduleImage/entity/ScheduleImage.java b/backend/src/main/java/com/isp/backend/domain/scheduleImage/entity/ScheduleImage.java index 19864d53..592df0a3 100644 --- a/backend/src/main/java/com/isp/backend/domain/scheduleImage/entity/ScheduleImage.java +++ b/backend/src/main/java/com/isp/backend/domain/scheduleImage/entity/ScheduleImage.java @@ -1,13 +1,12 @@ package com.isp.backend.domain.scheduleImage.entity; +import com.fasterxml.jackson.annotation.JsonFormat; import com.isp.backend.domain.schedule.entity.Schedule; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; -import org.springframework.data.annotation.CreatedDate; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; @Entity @Getter @@ -24,8 +23,8 @@ public class ScheduleImage { private Schedule schedule; private String path; - @CreatedDate - private String saveDate; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime saveDate; public ScheduleImage(Schedule schedule, String path) { this.schedule = schedule; @@ -34,6 +33,6 @@ public ScheduleImage(Schedule schedule, String path) { @PrePersist public void onPrePersist(){ - this.saveDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + this.saveDate = LocalDateTime.now().withNano(0); } } \ No newline at end of file