Skip to content

Commit

Permalink
Merge branch 'dev' into chore/#14/cicd-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ssssujini99 authored Dec 19, 2023
2 parents 534c655 + 340782c commit 31261a9
Show file tree
Hide file tree
Showing 17 changed files with 483 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
dependencies {
runtimeOnly 'org.postgresql:postgresql'
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
//테스트 컨테이너
testImplementation "org.testcontainers:testcontainers:1.19.2"
testImplementation "org.testcontainers:postgresql:1.19.3"
}

bootJar { enabled = false }
Expand Down
33 changes: 33 additions & 0 deletions core/src/main/java/dev/hooon/booking/domain/entity/Booking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package dev.hooon.booking.domain.entity;

import dev.hooon.common.entity.TimeBaseEntity;
import dev.hooon.show.domain.entity.Show;
import dev.hooon.user.domain.entity.User;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static jakarta.persistence.ConstraintMode.NO_CONSTRAINT;
import static jakarta.persistence.FetchType.LAZY;
import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

@Entity
@Getter
@Table(name = "booking_table")
@NoArgsConstructor(access = PROTECTED)
public class Booking extends TimeBaseEntity {

@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "booking_id")
private Long id;

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "booking_user_id", nullable = false, foreignKey = @ForeignKey(value = NO_CONSTRAINT))
private User user;

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "booking_show_id", nullable = false, foreignKey = @ForeignKey(value = NO_CONSTRAINT))
private Show show;
}
32 changes: 32 additions & 0 deletions core/src/main/java/dev/hooon/booking/domain/entity/Ticket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package dev.hooon.booking.domain.entity;

import dev.hooon.common.entity.TimeBaseEntity;
import dev.hooon.show.domain.entity.seat.Seat;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static jakarta.persistence.ConstraintMode.NO_CONSTRAINT;
import static jakarta.persistence.FetchType.LAZY;
import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.*;

@Entity
@Getter
@Table(name = "ticket_table")
@NoArgsConstructor(access = PROTECTED)
public class Ticket extends TimeBaseEntity {

@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "ticket_id")
private Long id;

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "ticket_booking_id", nullable = false, foreignKey = @ForeignKey(value = NO_CONSTRAINT))
private Booking booking;

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "ticket_seat_id", nullable = false, foreignKey = @ForeignKey(value = NO_CONSTRAINT))
private Seat seat;
}
25 changes: 25 additions & 0 deletions core/src/main/java/dev/hooon/common/entity/TimeBaseEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package dev.hooon.common.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;

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

@CreatedDate
@Column(name = "created_at")
protected LocalDateTime createdAt;

@LastModifiedDate
@Column(name = "updated_at")
private LocalDateTime updatedAt;
}
40 changes: 40 additions & 0 deletions core/src/main/java/dev/hooon/show/domain/entity/Show.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package dev.hooon.show.domain.entity;

import dev.hooon.common.entity.TimeBaseEntity;
import dev.hooon.show.domain.entity.place.Place;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static jakarta.persistence.ConstraintMode.NO_CONSTRAINT;
import static jakarta.persistence.FetchType.*;
import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

@Entity
@Getter
@Table(name = "show_table")
@NoArgsConstructor(access = PROTECTED)
public class Show extends TimeBaseEntity {

@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "show_id")
private Long id;

@Embedded
private ShowPeriod showPeriod;

@Embedded
private ShowTime showTime;

@Column(name = "show_age", nullable = false)
private String showAge;

@Column(name = "show_total_seats")
private int totalSeats;

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "show_place_id", nullable = false, foreignKey = @ForeignKey(value = NO_CONSTRAINT))
private Place place;
}
24 changes: 24 additions & 0 deletions core/src/main/java/dev/hooon/show/domain/entity/ShowPeriod.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dev.hooon.show.domain.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

import static lombok.AccessLevel.PROTECTED;

@Getter
@Embeddable
@EqualsAndHashCode
@NoArgsConstructor(access = PROTECTED)
public class ShowPeriod {

@Column(name = "show_start_date", nullable = false)
private LocalDate startDate;

@Column(name = "show_end_date", nullable = false)
private LocalDate endDate;
}
22 changes: 22 additions & 0 deletions core/src/main/java/dev/hooon/show/domain/entity/ShowTime.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package dev.hooon.show.domain.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static lombok.AccessLevel.PROTECTED;

@Getter
@Embeddable
@EqualsAndHashCode
@NoArgsConstructor(access = PROTECTED)
public class ShowTime {

@Column(name = "show_total_minutes", nullable = false)
private int totalMinutes;

@Column(name = "show_intermission_minutes", nullable = false)
private int intermissionMinutes;
}
33 changes: 33 additions & 0 deletions core/src/main/java/dev/hooon/show/domain/entity/place/Place.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package dev.hooon.show.domain.entity.place;

import dev.hooon.common.entity.TimeBaseEntity;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

@Entity
@Getter
@Table(name = "place_table")
@NoArgsConstructor(access = PROTECTED)
public class Place extends TimeBaseEntity {

@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "place_id")
private Long id;

@Column(name = "place_name", nullable = false)
private String name;

@Column(name = "place_contact_info")
private String contactInfo;

@Column(name = "place_address", nullable = false)
private String address;

@Column(name = "place_url")
private String placeUrl;
}
53 changes: 53 additions & 0 deletions core/src/main/java/dev/hooon/show/domain/entity/seat/Seat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package dev.hooon.show.domain.entity.seat;

import dev.hooon.common.entity.TimeBaseEntity;
import dev.hooon.show.domain.entity.Show;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

import static jakarta.persistence.ConstraintMode.NO_CONSTRAINT;
import static jakarta.persistence.EnumType.STRING;
import static jakarta.persistence.FetchType.LAZY;
import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

@Entity
@Getter
@Table(name = "seat_table")
@NoArgsConstructor(access = PROTECTED)
public class Seat extends TimeBaseEntity {

@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "seat_id")
private Long id;

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "seat_show_id", nullable = false, foreignKey = @ForeignKey(value = NO_CONSTRAINT))
private Show show;

@Enumerated(STRING)
@Column(name = "seat_grade", nullable = false)
private SeatGrade seatGrade;

@Column(name = "seat_is_seat", nullable = false)
private boolean isSeat;

@Embedded
private SeatPositionInfo positionInfo;

@Column(name = "seat_price", nullable = false)
private int price;

@Column(name = "seat_show_date", nullable = false)
private LocalDate showDate;

@Embedded
private ShowRound showRound;

@Column(name = "seat_is_booked", nullable = false)
private boolean isBooked;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package dev.hooon.show.domain.entity.seat;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum SeatGrade {

VIP("VIP석"),
R("R석"),
S("S석"),
A("A석"),
B("B석");

private final String description;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package dev.hooon.show.domain.entity.seat;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static lombok.AccessLevel.PROTECTED;

@Getter
@Embeddable
@EqualsAndHashCode
@NoArgsConstructor(access = PROTECTED)
public class SeatPositionInfo {

@Column(name = "seat_sector")
private String sector;

@Column(name = "seat_row", nullable = false)
private String row;

@Column(name = "seat_col", nullable = false)
private int col;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dev.hooon.show.domain.entity.seat;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalTime;

import static lombok.AccessLevel.PROTECTED;

@Getter
@Embeddable
@EqualsAndHashCode
@NoArgsConstructor(access = PROTECTED)
public class ShowRound {

@Column(name = "seat_show_round")
private int round;

@Column(name = "seat_start_time")
private LocalTime startTime;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package dev.hooon.show.domain.entity.showlike;

import dev.hooon.common.entity.TimeBaseEntity;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

@Entity
@Getter
@Table(name = "show_like_table")
@NoArgsConstructor(access = PROTECTED)
public class ShowLike extends TimeBaseEntity {

@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "show_like_id")
private Long id;

@Column(name = "show_like_user_id", nullable = false)
private Long userId;

@Column(name = "show_like_show_id", nullable = false)
private Long showId;
}
Loading

0 comments on commit 31261a9

Please sign in to comment.