Skip to content

Commit

Permalink
[#143] Hotfix: 일정별 저장한 이미지를 묶어서 반환하기 위해 일급컬렉션 및 ScheduleImage 응답 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
yo0oni committed Sep 1, 2024
1 parent 75750d6 commit c9c87f4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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);
}
}

0 comments on commit c9c87f4

Please sign in to comment.