Skip to content

Commit

Permalink
[feat] BaseTimeEntity 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
syyling committed Apr 4, 2024
1 parent 10f12ab commit 407fb02
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@EnableJpaAuditing
@SpringBootApplication
public class MookiveBackendApplication {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.mookive.mookive_backend.common;

import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Getter
public class BaseTimeEntity {

@CreatedDate
private LocalDateTime createdAt;

@LastModifiedDate
private LocalDateTime updatedAt;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mookive.mookive_backend.heart.domain.entity;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import com.mookive.mookive_backend.movie.domain.entity.Movie;
import com.mookive.mookive_backend.user.domain.entity.User;
import jakarta.persistence.*;
Expand All @@ -11,7 +12,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Heart {
public class Heart extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mookive.mookive_backend.heartPlaylist.domain;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import com.mookive.mookive_backend.playlist.domain.entity.Playlist;
import com.mookive.mookive_backend.user.domain.entity.User;
import jakarta.persistence.*;
Expand All @@ -11,7 +12,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class HeartPlaylist {
public class HeartPlaylist extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mookive.mookive_backend.keyword.domain.entity;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import com.mookive.mookive_backend.record.domain.entity.Record;
import jakarta.persistence.*;
import lombok.AccessLevel;
Expand All @@ -10,7 +11,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Keyword {
public class Keyword extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mookive.mookive_backend.movie.domain.entity;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
Expand All @@ -9,7 +10,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Movie {
public class Movie extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mookive.mookive_backend.movieInPlaylist.domain.entity;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import com.mookive.mookive_backend.movie.domain.entity.Movie;
import com.mookive.mookive_backend.playlist.domain.entity.Playlist;
import jakarta.persistence.*;
Expand All @@ -11,7 +12,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class MovieInPlaylist {
public class MovieInPlaylist extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mookive.mookive_backend.playlist.domain.entity;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import com.mookive.mookive_backend.movieInPlaylist.domain.entity.MovieInPlaylist;
import com.mookive.mookive_backend.user.domain.entity.User;
import jakarta.persistence.*;
Expand All @@ -14,7 +15,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Playlist {
public class Playlist extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mookive.mookive_backend.record.domain.entity;


import com.mookive.mookive_backend.common.BaseTimeEntity;
import com.mookive.mookive_backend.movie.domain.entity.Movie;
import com.mookive.mookive_backend.user.domain.entity.User;
import jakarta.persistence.*;
Expand All @@ -14,7 +15,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Record {
public class Record extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mookive.mookive_backend.user.domain.entity;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand All @@ -12,7 +13,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class User {
public class User extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand Down

0 comments on commit 407fb02

Please sign in to comment.