Skip to content

Commit

Permalink
[ADD] BaseDate, Like, Music, Block Entity 추가 #4
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchaeeun3447 committed Jun 3, 2023
1 parent 41c7405 commit 5f39097
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
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;
}
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;
}
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 mument/src/main/java/com/mument/mument/core/user/domain/Block.java
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;
}

0 comments on commit 5f39097

Please sign in to comment.