From 5435dc92a6173b53d6a59d6fcddb11236f65e56d Mon Sep 17 00:00:00 2001 From: woogieon8on Date: Sun, 13 Oct 2024 00:15:53 +0900 Subject: [PATCH] #69 Feat: add reservation entity --- .../domain/reservation/Reservation.java | 48 +++++++++++++++++++ .../domain/reservation/ReservationStatus.java | 6 +++ 2 files changed, 54 insertions(+) create mode 100644 src/main/java/kahlua/KahluaProject/domain/reservation/Reservation.java create mode 100644 src/main/java/kahlua/KahluaProject/domain/reservation/ReservationStatus.java diff --git a/src/main/java/kahlua/KahluaProject/domain/reservation/Reservation.java b/src/main/java/kahlua/KahluaProject/domain/reservation/Reservation.java new file mode 100644 index 0000000..b7ec4ad --- /dev/null +++ b/src/main/java/kahlua/KahluaProject/domain/reservation/Reservation.java @@ -0,0 +1,48 @@ +package kahlua.KahluaProject.domain.reservation; + +import jakarta.persistence.*; +import kahlua.KahluaProject.domain.BaseEntity; +import kahlua.KahluaProject.domain.user.User; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalTime; + +import static jakarta.persistence.FetchType.*; +import static jakarta.persistence.GenerationType.*; + +@Entity +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Reservation extends BaseEntity { + + @Id + @GeneratedValue(strategy = IDENTITY) + @Column(nullable = false) + private Long id; + + @ManyToOne(fetch = LAZY) + @JoinColumn(name = "user_id") + private User user; + + @Column(name = "club_room_username") + private String clubRoomUsername; // 동방 예약자명(팀명) + + @Column(name = "reservation_date", nullable = false) + private LocalDate reservationDate; // 예약날짜 + + @Column(name = "start_time", nullable = false) + private LocalTime startTime; // 사용 시작 시간 + + @Column(name = "end_time", nullable = false) + private LocalTime endTime; // 사용 종료 시간 + + @Enumerated(EnumType.STRING) + @Column(name = "reservation_status", nullable = false) + private ReservationStatus status; // 예약 상태 - 진행중, 예약됨, 취소됨 +} diff --git a/src/main/java/kahlua/KahluaProject/domain/reservation/ReservationStatus.java b/src/main/java/kahlua/KahluaProject/domain/reservation/ReservationStatus.java new file mode 100644 index 0000000..ece18fc --- /dev/null +++ b/src/main/java/kahlua/KahluaProject/domain/reservation/ReservationStatus.java @@ -0,0 +1,6 @@ +package kahlua.KahluaProject.domain.reservation; + +public enum ReservationStatus { + + PROCEEDING, RESERVED, CANCELLED +}