From 2da70d7a3fcc5337cf94e30f1146c56614c6cd2f Mon Sep 17 00:00:00 2001 From: lej8924 Date: Tue, 23 Jul 2024 10:08:32 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix:=20application-prod->=20ddl-?= =?UTF-8?q?auto:=20update=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mypage/dto/response/NoteResponse.java | 5 ++- .../repository/init/CommentInitializer.java | 2 - .../post/repository/init/PostInitializer.java | 40 +++++-------------- 3 files changed, 12 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/ticle/server/mypage/dto/response/NoteResponse.java b/src/main/java/com/ticle/server/mypage/dto/response/NoteResponse.java index f505f6a..629d8f0 100644 --- a/src/main/java/com/ticle/server/mypage/dto/response/NoteResponse.java +++ b/src/main/java/com/ticle/server/mypage/dto/response/NoteResponse.java @@ -7,6 +7,7 @@ import lombok.Getter; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; @Getter @AllArgsConstructor @@ -16,7 +17,7 @@ public class NoteResponse { PageInfo pageInfo; private Long noteId; private String content; - private LocalDateTime memoDate; + private String memoDate; private Long postId; private String postTitle; private String targetText; @@ -26,7 +27,7 @@ public static NoteResponse toDto(Memo memo,PageInfo pageInfo){ .pageInfo(pageInfo) .noteId(memo.getMemoId()) .content(memo.getContent()) - .memoDate(memo.getCreatedDate()) + .memoDate(memo.getCreatedDate().format(DateTimeFormatter.ISO_DATE_TIME)) .postId(memo.getPost().getPostId()) .postTitle(memo.getPost().getTitle()) .targetText(memo.getTargetText()) diff --git a/src/main/java/com/ticle/server/opinion/repository/init/CommentInitializer.java b/src/main/java/com/ticle/server/opinion/repository/init/CommentInitializer.java index 2c3b399..301573a 100644 --- a/src/main/java/com/ticle/server/opinion/repository/init/CommentInitializer.java +++ b/src/main/java/com/ticle/server/opinion/repository/init/CommentInitializer.java @@ -34,8 +34,6 @@ public void run(ApplicationArguments args) throws Exception { User user1 = userRepository.findById(1L).orElseThrow(); User user2 = userRepository.findById(2L).orElseThrow(); User user3 = userRepository.findById(3L).orElseThrow(); - User user4 = userRepository.findById(4L).orElseThrow(); - User user5 = userRepository.findById(5L).orElseThrow(); Opinion opinion1 = opinionRepository.findById(1L).orElseThrow(); diff --git a/src/main/java/com/ticle/server/post/repository/init/PostInitializer.java b/src/main/java/com/ticle/server/post/repository/init/PostInitializer.java index 310b86c..af51c64 100644 --- a/src/main/java/com/ticle/server/post/repository/init/PostInitializer.java +++ b/src/main/java/com/ticle/server/post/repository/init/PostInitializer.java @@ -34,7 +34,6 @@ public void run(ApplicationArguments args) throws Exception { if (postRepository.count() > 0) { log.info("[Post] 더미 데이터 존재"); } else { - List postList = new ArrayList<>(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Post post1 = Post.builder() @@ -457,36 +456,15 @@ public void run(ApplicationArguments args) throws Exception { .scrapCount(1) .build(); - postList.add(post1); - postList.add(post2); - postList.add(post3); - postList.add(post4); - postList.add(post5); - postList.add(post6); - postList.add(post7); - postList.add(post8); - postList.add(post9); - postList.add(post10); - postList.add(post11); - postList.add(post12); - postList.add(post13); - postList.add(post14); - postList.add(post15); - postList.add(post16); - postList.add(post17); - postList.add(post18); - postList.add(post19); - postList.add(post20); - postList.add(post21); - postList.add(post22); - postList.add(post23); - postList.add(post24); - postList.add(post25); - postList.add(post26); - postList.add(post27); - postList.add(post28); - postList.add(post29); - postList.add(post30); + List postList = new ArrayList<>(); + + Post[] posts = {post1, post2, post3, post4, post5, post6, post7, post8, post9, post10, + post11, post12, post13, post14, post15, post16, post17, post18, post19, post20, + post21, post22, post23, post24, post25, post26, post27, post28, post29, post30}; + + for (Post post : posts) { + postList.add(post); + } postRepository.saveAll(postList); }