diff --git a/src/main/java/org/sopt/sopkerton/common/config/JpaAuditingConfig.java b/src/main/java/org/sopt/sopkerton/common/config/JpaAuditingConfig.java new file mode 100644 index 0000000..3c8f2f1 --- /dev/null +++ b/src/main/java/org/sopt/sopkerton/common/config/JpaAuditingConfig.java @@ -0,0 +1,9 @@ +package org.sopt.sopkerton.common.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; + +@EnableJpaAuditing +@Configuration +public class JpaAuditingConfig { +} diff --git a/src/main/java/org/sopt/sopkerton/common/domain/BaseEntity.java b/src/main/java/org/sopt/sopkerton/common/domain/BaseEntity.java new file mode 100644 index 0000000..b4f3be6 --- /dev/null +++ b/src/main/java/org/sopt/sopkerton/common/domain/BaseEntity.java @@ -0,0 +1,23 @@ +package org.sopt.sopkerton.common.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import java.time.LocalDateTime; +import lombok.Getter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +@Getter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public class BaseEntity { + @CreatedDate + @Column(name = "register_at") + private LocalDateTime registerAt; + + @LastModifiedDate + @Column(name = "done_at") + private LocalDateTime doneAt; +}