-
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.
* prod: jpa 및 기본 엔티티 설정 * feat: 엔티티 기본 구성 구현
- Loading branch information
Showing
22 changed files
with
804 additions
and
16 deletions.
There are no files selected for viewing
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,14 @@ | ||
FROM openjdk:17-alpine | ||
|
||
EXPOSE 8080 | ||
|
||
ARG PROFILE=develop | ||
ENV PROFILE=${PROFILE} | ||
ENV TZ "Asia/Seoul" | ||
ENV JAVA_OPTS="-Dspring.profiles.active=$PROFILE" | ||
|
||
WORKDIR /app | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
COPY ./build/libs/*.jar app.jar | ||
|
||
ENTRYPOINT java $JAVA_OPTS -jar app.jar |
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
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
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
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,48 @@ | ||
package com.testcar.car.domains.car; | ||
|
||
|
||
import com.testcar.car.common.entity.BaseEntity; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import java.time.LocalDateTime; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "Car") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Car extends BaseEntity { | ||
@Id | ||
@Column(name = "id", nullable = false, updatable = false) | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
// 차량명 | ||
@Column(length = 50, nullable = false) | ||
private String name; | ||
|
||
// 출시일자 | ||
@Column(nullable = false) | ||
private LocalDateTime releasedAt; | ||
|
||
// 차종 | ||
@Column(nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private Type type; | ||
|
||
@Builder | ||
public Car(String name, LocalDateTime releasedAt, Type type) { | ||
this.name = name; | ||
this.releasedAt = releasedAt; | ||
this.type = type; | ||
} | ||
} |
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,16 @@ | ||
package com.testcar.car.domains.car; | ||
|
||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum Type { | ||
SEDAN("세단"), | ||
SUV("SUV"), | ||
TRUCK("트럭"), | ||
VAN("승합차"); | ||
|
||
private final String description; | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/com/testcar/car/domains/carReservation/CarReservation.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,61 @@ | ||
package com.testcar.car.domains.carReservation; | ||
|
||
|
||
import com.testcar.car.common.entity.BaseEntity; | ||
import com.testcar.car.domains.carStock.CarStock; | ||
import com.testcar.car.domains.member.Member; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import java.time.LocalDateTime; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "CarReservation") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class CarReservation extends BaseEntity { | ||
@Id | ||
@Column(name = "id", nullable = false, updatable = false) | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
// 사용자 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "memberId", nullable = false) | ||
private Member member; | ||
|
||
// 차량재고 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "carStockId", nullable = false) | ||
private CarStock carStock; | ||
|
||
// 대여시각 | ||
@Column(nullable = false) | ||
private LocalDateTime reservedAt; | ||
|
||
// 대여상태 | ||
@Column(nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private ReservationStatus status; | ||
|
||
@Builder | ||
public CarReservation( | ||
Member member, CarStock carStock, LocalDateTime reservedAt, ReservationStatus status) { | ||
this.member = member; | ||
this.carStock = carStock; | ||
this.reservedAt = reservedAt; | ||
this.status = status; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/testcar/car/domains/carReservation/ReservationStatus.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,16 @@ | ||
package com.testcar.car.domains.carReservation; | ||
|
||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum ReservationStatus { | ||
AVAILABLE("대여 가능"), | ||
INSPECTION("검수중"), | ||
RESERVED("대여중"), | ||
UNAVAILABLE("폐기"); | ||
|
||
private final String description; | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/com/testcar/car/domains/carStock/CarStock.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,49 @@ | ||
package com.testcar.car.domains.carStock; | ||
|
||
|
||
import com.testcar.car.common.entity.BaseEntity; | ||
import com.testcar.car.domains.car.Car; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "CarStock") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class CarStock extends BaseEntity { | ||
@Id | ||
@Column(name = "id", nullable = false, updatable = false) | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
// 차량 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "carId", nullable = false) | ||
private Car car; | ||
|
||
// 재고번호 | ||
@Column(nullable = false, length = 12, unique = true) | ||
private String stockNumber; | ||
|
||
// 재고상태 | ||
@Column(nullable = false) | ||
private StockStatus status; | ||
|
||
@Builder | ||
public CarStock(Car car, String stockNumber, StockStatus status) { | ||
this.car = car; | ||
this.stockNumber = stockNumber; | ||
this.status = status; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/testcar/car/domains/carStock/StockStatus.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,16 @@ | ||
package com.testcar.car.domains.carStock; | ||
|
||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum StockStatus { | ||
AVAILABLE("대여 가능"), | ||
INSPECTION("검수중"), | ||
RESERVED("대여중"), | ||
UNAVAILABLE("폐기"); | ||
|
||
private final String description; | ||
} |
75 changes: 75 additions & 0 deletions
75
src/main/java/com/testcar/car/domains/carTest/CarTest.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,75 @@ | ||
package com.testcar.car.domains.carTest; | ||
|
||
|
||
import com.testcar.car.common.entity.BaseEntity; | ||
import com.testcar.car.domains.carStock.CarStock; | ||
import com.testcar.car.domains.member.Member; | ||
import com.testcar.car.domains.track.Track; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import java.time.LocalDateTime; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "CarTest") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class CarTest extends BaseEntity { | ||
@Id | ||
@Column(name = "id", nullable = false, updatable = false) | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
// 사용자 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "memberId", nullable = false) | ||
private Member member; | ||
|
||
// 시험장 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "trackId", nullable = false) | ||
private Track track; | ||
|
||
// 차량재고 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "carStockId", nullable = false) | ||
private CarStock carStock; | ||
|
||
// 수행시간 | ||
@Column(nullable = false) | ||
private LocalDateTime performedAt; | ||
|
||
// 수행결과 | ||
@Column(nullable = false, columnDefinition = "TEXT") | ||
private String result; | ||
|
||
// 비고 | ||
@Column(columnDefinition = "TEXT") | ||
private String memo; | ||
|
||
@Builder | ||
public CarTest( | ||
Member member, | ||
Track track, | ||
CarStock carStock, | ||
LocalDateTime performedAt, | ||
String result, | ||
String memo) { | ||
this.member = member; | ||
this.track = track; | ||
this.carStock = carStock; | ||
this.performedAt = performedAt; | ||
this.result = result; | ||
this.memo = memo; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/testcar/car/domains/gasStation/GasStation.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,34 @@ | ||
package com.testcar.car.domains.gasStation; | ||
|
||
|
||
import com.testcar.car.common.entity.BaseEntity; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "GasStation") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class GasStation extends BaseEntity { | ||
@Id | ||
@Column(name = "id", nullable = false, updatable = false) | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
// 이름 | ||
@Column(nullable = false, length = 50) | ||
private String name; | ||
|
||
@Builder | ||
public GasStation(String name) { | ||
this.name = name; | ||
} | ||
} |
Oops, something went wrong.