Skip to content

Commit

Permalink
add: Entity 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yj0111 committed Jan 4, 2025
1 parent 1a87f98 commit fb19b34
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/main/java/TiCatch/backend/domain/history/entity/History.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package TiCatch.backend.domain.history.entity;

import TiCatch.backend.domain.member.entity.Member;
import TiCatch.backend.global.entity.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@Table(name = "history")
@AllArgsConstructor
@NoArgsConstructor
public class History extends BaseTimeEntity {

//예매 기록 ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long historyId;

//멤버
@ManyToOne
@JoinColumn(name = "member_id", nullable = false)
private Member member;

//예매 좌석정보
private String historyInfo;

//예매 난이도
private int historyLevel;
}
29 changes: 29 additions & 0 deletions src/main/java/TiCatch/backend/domain/member/entity/Member.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package TiCatch.backend.domain.member.entity;

import TiCatch.backend.global.entity.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@Table(name = "member")
@AllArgsConstructor
@NoArgsConstructor
public class Member extends BaseTimeEntity {

//멤버 ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long memberId;

//멤버 닉네임
@Column(nullable = false, length = 30)
private String memberNickname;

//총 s점수
@Column(nullable = false)
private String memberScore;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package TiCatch.backend.domain.ticketing.entity;

import TiCatch.backend.domain.member.entity.Member;
import TiCatch.backend.global.entity.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Entity
@Getter
@Table(name = "ticketing")
@AllArgsConstructor
@NoArgsConstructor
public class Ticketing extends BaseTimeEntity {

//티켓팅 ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long ticketingId;

//멤버
@ManyToOne
@JoinColumn(name = "member_id", nullable = false)
private Member member;

//티켓팅 레벨
@Column(nullable = false, length = 20)
private int ticketingLevel;

//티켓팅 시간
@Column(nullable = false)
private LocalDate ticketingTime;

//티켓팅 상태
@Column(nullable = false, length = 20)
private String ticketingState;
}
25 changes: 25 additions & 0 deletions src/main/java/TiCatch/backend/global/entity/BaseDateEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package TiCatch.backend.global.entity;

import jakarta.persistence.Column;
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.LocalDate;

@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseDateEntity {

@CreatedDate
@Column(nullable = false, updatable = false)
private LocalDate createdDate;

@LastModifiedDate
@Column(nullable = false)
private LocalDate modifiedDate;
}
25 changes: 25 additions & 0 deletions src/main/java/TiCatch/backend/global/entity/BaseTimeEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package TiCatch.backend.global.entity;

import jakarta.persistence.Column;
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;

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

@CreatedDate
@Column(nullable = false, updatable = false)
private LocalDateTime createdDate;

@LastModifiedDate
@Column(nullable = false)
private LocalDateTime modifiedDate;
}

0 comments on commit fb19b34

Please sign in to comment.