-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] BaseDate, Like, Music, Block Entity 추가 #4
- Loading branch information
1 parent
41c7405
commit 5f39097
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
mument/src/main/java/com/mument/mument/core/common/domain/BaseDate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.mument.mument.core.common.domain; | ||
|
||
import lombok.Getter; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
|
||
@EntityListeners(value = {AuditingEntityListener.class}) | ||
@MappedSuperclass | ||
@Getter | ||
public abstract class BaseDate { | ||
|
||
@CreatedDate | ||
@Column(updatable = false) | ||
private LocalDateTime createdAt; | ||
|
||
// @LastModifiedDate | ||
// private LocalDateTime updatedAt; | ||
} |
24 changes: 24 additions & 0 deletions
24
mument/src/main/java/com/mument/mument/core/mument/domain/Like.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.mument.mument.core.mument.domain; | ||
|
||
import com.mument.mument.core.common.domain.BaseDate; | ||
import com.mument.mument.core.mument.domain.Mument; | ||
import com.mument.mument.core.user.domain.User; | ||
import lombok.Getter; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
public class Like extends BaseDate { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "mument_id", nullable = false) | ||
private Mument mument; | ||
} |
22 changes: 22 additions & 0 deletions
22
mument/src/main/java/com/mument/mument/core/music/domain/Music.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.mument.mument.core.music.domain; | ||
|
||
import lombok.Getter; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
public class Music { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String artist; | ||
|
||
@Column(nullable = false) | ||
private String image; | ||
|
||
@Column(nullable = false) | ||
private String name; | ||
} |
23 changes: 23 additions & 0 deletions
23
mument/src/main/java/com/mument/mument/core/user/domain/Block.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.mument.mument.core.user.domain; | ||
|
||
import com.mument.mument.core.common.domain.BaseDate; | ||
import com.mument.mument.core.user.domain.User; | ||
import lombok.Getter; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
public class Block extends BaseDate { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "blocked_user_id", nullable = false) | ||
private User blockedUser; | ||
} |