diff --git a/src/main/java/com/kimgreen/backend/domain/AuditEntity.java b/src/main/java/com/kimgreen/backend/domain/AuditEntity.java index 0920ed7..874af6f 100644 --- a/src/main/java/com/kimgreen/backend/domain/AuditEntity.java +++ b/src/main/java/com/kimgreen/backend/domain/AuditEntity.java @@ -19,18 +19,20 @@ public class AuditEntity { @CreatedDate - private String createdAt; + private LocalDateTime createdAt; @LastModifiedDate - private String modifiedAt; + private LocalDateTime modifiedAt; @PrePersist public void prePersist() { - this.createdAt = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + String formattedDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + this.createdAt = LocalDateTime.parse(formattedDate,DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); this.modifiedAt = this.createdAt; } @PreUpdate public void onUpdate() { - this.modifiedAt = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + String formattedDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + this.modifiedAt = LocalDateTime.parse(formattedDate,DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); } } diff --git a/src/main/java/com/kimgreen/backend/domain/notification/dto/NotificationResponseDto.java b/src/main/java/com/kimgreen/backend/domain/notification/dto/NotificationResponseDto.java index f6da5a2..7a43636 100644 --- a/src/main/java/com/kimgreen/backend/domain/notification/dto/NotificationResponseDto.java +++ b/src/main/java/com/kimgreen/backend/domain/notification/dto/NotificationResponseDto.java @@ -13,7 +13,7 @@ @Getter public class NotificationResponseDto { private Long postId; - private String createdAt; + private LocalDateTime createdAt; private String content; public static NotificationResponseDto getDto(Notification notification) {