From 97a69ae3af6908dc0850c14b2852d0d21fc3f245 Mon Sep 17 00:00:00 2001 From: yulmam Date: Fri, 26 Jul 2024 16:29:58 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20BoardSummaryDto=20create=20time=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/EdufocusApplication.java | 2 ++ .../entity/dto/ResponseBoardDetailDto.java | 6 ++--- .../entity/dto/ResponseBoardSummaryDto.java | 3 +++ .../board/entity/dto/ResponseCommentDto.java | 5 ++-- .../edufocus/board/entity/vo/Board.java | 15 +++++++---- .../edufocus/board/entity/vo/Comment.java | 6 ++--- .../src/main/resources/application.properties | 25 +++++++++++++++---- 7 files changed, 44 insertions(+), 18 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/EdufocusApplication.java b/backend/src/main/java/com/edufocus/edufocus/EdufocusApplication.java index 556bff0..e80c9fd 100644 --- a/backend/src/main/java/com/edufocus/edufocus/EdufocusApplication.java +++ b/backend/src/main/java/com/edufocus/edufocus/EdufocusApplication.java @@ -2,7 +2,9 @@ package com.edufocus.edufocus; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +@EnableJpaAuditing @SpringBootApplication public class EdufocusApplication { diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseBoardDetailDto.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseBoardDetailDto.java index 8cf6bc7..e050da7 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseBoardDetailDto.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseBoardDetailDto.java @@ -5,7 +5,7 @@ import lombok.Builder; import lombok.Getter; import lombok.Setter; -import java.time.LocalTime; +import java.time.LocalDateTime; @Builder @Getter @@ -17,6 +17,6 @@ public class ResponseBoardDetailDto { private String title; private String content; private int viewCount; - private LocalTime createdAt; - private LocalTime modifiedAt; + private LocalDateTime createdAt; + private LocalDateTime modifiedAt; } diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseBoardSummaryDto.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseBoardSummaryDto.java index d3e72a5..bcd1f11 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseBoardSummaryDto.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseBoardSummaryDto.java @@ -5,6 +5,8 @@ import lombok.Builder; import lombok.Getter; import lombok.Setter; +import java.time.LocalDateTime; + @Builder @Getter @Setter @@ -12,4 +14,5 @@ public class ResponseBoardSummaryDto { private long id; private String name; private String title; + private LocalDateTime createdAt; } diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseCommentDto.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseCommentDto.java index 92156ce..180c6b1 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseCommentDto.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/dto/ResponseCommentDto.java @@ -4,6 +4,7 @@ import lombok.Builder; import lombok.Getter; import lombok.Setter; +import java.time.LocalDateTime; import java.time.LocalTime; @Builder @@ -13,6 +14,6 @@ public class ResponseCommentDto { private long id; private String name; private String content; - private LocalTime createAt; - private LocalTime modifiedAt; + private LocalDateTime createAt; + private LocalDateTime modifiedAt; } diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java index 6272a17..6b283ec 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java @@ -8,8 +8,11 @@ import com.edufocus.edufocus.user.model.entity.User; import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; import lombok.*; -import org.hibernate.annotations.CreationTimestamp; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; +import java.time.LocalDateTime; import java.time.LocalTime; import java.util.List; @@ -18,6 +21,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @Setter +@EntityListeners(AuditingEntityListener.class) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) public class Board { @@ -37,11 +41,11 @@ public class Board { @Column(nullable = true) private int viewCount; - @CreationTimestamp - LocalTime createdAt; + @CreatedDate + LocalDateTime createdAt; - @CreationTimestamp - LocalTime modifiedAt; + @LastModifiedDate + LocalDateTime modifiedAt; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") @@ -60,6 +64,7 @@ public class Board { .id(id) .title(title) .name(user.getUserId()) + .createdAt(createdAt) .build(); } diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java index 90c7ebf..667f678 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java @@ -10,7 +10,7 @@ import lombok.Builder; import lombok.NoArgsConstructor; import lombok.Setter; -import java.time.LocalTime; +import java.time.LocalDateTime; @Entity @Builder @@ -26,10 +26,10 @@ public class Comment { private String content; @Column - private LocalTime createdAt; + private LocalDateTime createdAt; @Column - private LocalTime modifiedAt; + private LocalDateTime modifiedAt; @ManyToOne @JoinColumn(name = "user_id") diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index f06afe6..e67341c 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -2,13 +2,15 @@ spring.application.name=edufocus server.port=8080 server.ssl.enabled=false +server.servlet.context-path=${CONTEXT_PATH} + # LiveKit configuration livekit.api.key=${LIVEKIT_API_KEY:devkey} livekit.api.secret=${LIVEKIT_API_SECRET:secret} # JWT Salt (??? ?? ???? ???) -jwt.salt=ssafy-screte-key-20240404-ssafy-screte-key-20240404-ssafy-screte-key-20240404 +jwt.salt=${SALT} # Access Token ?? ?? (??? ??) jwt.access-token.expiretime=3600000 @@ -16,11 +18,24 @@ jwt.access-token.expiretime=3600000 # Refresh Token ?? ?? (??? ??) jwt.refresh-token.expiretime=86400000 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3306/edufocus?useSSL=false -spring.datasource.username=root -spring.datasource.password=root +spring.datasource.url=${DATA_SOURCE_URL} +spring.datasource.username=${USER_NAME} +spring.datasource.password=${USER_PASSWORD} spring.mvc.pathmatch.matching-strategy=ant_path_matcher spring.jpa.database=mysql spring.jpa.hibernate.ddl-auto=create -spring.jpa.show-sql=true \ No newline at end of file +spring.jpa.show-sql=true + + + + +spring.mail.host=smtp.gmail.com +spring.mail.port=587 +#spring.mail.username=ssafytestpjt +#spring.mail.password=trpjbxqialufuzih +spring.mail.username=passfinder111@gmail.com +spring.mail.password=mnlyfkiprltjlsmw + +spring.mail.properties.mail.smtp.auth=true +spring.mail.properties.mail.smtp.starttls.enable=true \ No newline at end of file