From 90457625a977c3c45a61ec4031e503d071fbd24e Mon Sep 17 00:00:00 2001 From: "2jin2.1031" <2jin2.1031@gmail.com> Date: Fri, 3 Jan 2025 19:23:07 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=83=9D=EC=84=B1=EC=9D=BC=20?= =?UTF-8?q?=ED=8F=AC=EB=A9=A7=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/example/backend/news/domain/dto/NewsResDto.java | 3 ++- .../java/org/example/backend/news/domain/entity/News.java | 8 +------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/org/example/backend/news/domain/dto/NewsResDto.java b/backend/src/main/java/org/example/backend/news/domain/dto/NewsResDto.java index dd252084..2a1ffe69 100644 --- a/backend/src/main/java/org/example/backend/news/domain/dto/NewsResDto.java +++ b/backend/src/main/java/org/example/backend/news/domain/dto/NewsResDto.java @@ -1,5 +1,6 @@ package org.example.backend.news.domain.dto; +ě •import java.time.format.DateTimeFormatter; import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; @@ -35,7 +36,7 @@ public static NewsResDto of(News news) { .title(news.getTitle()) .content(news.getContent()) .view(news.getView()) - .createDate(news.getCreateDate()) + .createDate(news.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) .link(news.getLink()) .image(news.getImage()) .build(); diff --git a/backend/src/main/java/org/example/backend/news/domain/entity/News.java b/backend/src/main/java/org/example/backend/news/domain/entity/News.java index eb994231..1ccb8b81 100644 --- a/backend/src/main/java/org/example/backend/news/domain/entity/News.java +++ b/backend/src/main/java/org/example/backend/news/domain/entity/News.java @@ -31,9 +31,6 @@ public class News extends BaseEntity { @Column(name = "view") private int view; - @Column(name = "create_date") - private String createDate; - @Column(name = "link") private String link; @@ -42,12 +39,11 @@ public class News extends BaseEntity { @Builder - private News(String title, String content, int view, String createDate, String link, + private News(String title, String content, int view, String link, String image) { this.title = title; this.content = content; this.view = view; - this.createDate = createDate; this.link = link; this.image = image; } @@ -57,7 +53,6 @@ public static News of(NewsReqDto dto) { .title(dto.getTitle()) .content(dto.getContent()) .view(0) - .createDate(dto.getCreateDate()) .link(dto.getLink()) .image(dto.getImage()) .build(); @@ -66,7 +61,6 @@ public static News of(NewsReqDto dto) { public void update(NewsReqDto dto) { this.title = dto.getTitle(); this.content = dto.getContent(); - this.createDate = dto.getCreateDate(); this.link = dto.getLink(); this.image = dto.getImage(); }