Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1 프로젝트 초기 세팅 #2

Merged
merged 5 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build/
!**/src/test/**/build/

application.properties
*.yml

### key file
push-notification-with-p-5c2ef-firebase-adminsdk-fe8i2-536a932cc1.json
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'io.spring.dependency-management' version '1.1.5'
}

group = 'oauth'
group = 'com.zarinatta'
version = '0.0.1-SNAPSHOT'

java {
Expand All @@ -30,7 +30,7 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-data-jpa"

implementation 'com.mysql:mysql-connector-j'

implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
Expand All @@ -40,6 +40,7 @@ dependencies {

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'demo'
rootProject.name = 'zarinatta-server'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package oauth;
package server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
52 changes: 52 additions & 0 deletions src/main/java/server/entity/BookMark.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package server.entity;

import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import server.enums.SeatLookingFor;

@Entity
@Getter
@Table
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class BookMark {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "bookmark_id")
private Long id;

@Column
private boolean wantFirstClass;

@Column
@Enumerated(EnumType.STRING)
private SeatLookingFor wantNormalSeat;

@Column
@Enumerated(EnumType.STRING)
private SeatLookingFor wantBabySeat;

@Column(columnDefinition = "BOOLEAN DEFAULT FALSE", nullable = false)
private boolean wantWaitingReservation;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ticket_id")
private Ticket ticket;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "USER_ID")
private User user;

@Builder
public BookMark(boolean wantFirstClass, SeatLookingFor wantNormalSeat, SeatLookingFor wantBabySeat, boolean wantWaitingReservation, Ticket ticket, User user) {
this.wantFirstClass = wantFirstClass;
this.wantNormalSeat = wantNormalSeat;
this.wantBabySeat = wantBabySeat;
this.wantWaitingReservation = wantWaitingReservation;
this.ticket = ticket;
this.user = user;
}
}
56 changes: 56 additions & 0 deletions src/main/java/server/entity/Ticket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package server.entity;

import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import server.enums.StationCode;

@Entity
@Getter
@Table
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Ticket {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ticket_id")
private Long id;

@Column(nullable = false)
private String ticketType;

// 출발
@Column(nullable = false)
private String departDate;

@Column(nullable = false)
private String departTime;

@Column(nullable = false)
@Enumerated(EnumType.STRING)
private StationCode departStation;

// 도착
@Column(nullable = false)
private String arriveTime;

@Column(nullable = false)
@Enumerated(EnumType.STRING)
private StationCode arriveStation;

@Column(nullable = false)
private String price;


@Builder
public Ticket(String ticketType, String departDate, String departTime, StationCode departStation, String arriveTime, StationCode arriveStation, String price) {
this.ticketType = ticketType;
this.departDate = departDate;
this.departTime = departTime;
this.departStation = departStation;
this.arriveTime = arriveTime;
this.arriveStation = arriveStation;
this.price = price;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package oauth.user;
package server.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.*;

import jakarta.annotation.Nullable;
import lombok.*;
Expand All @@ -17,6 +14,7 @@
public class User {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="USER_ID")
private String id;

Expand Down
54 changes: 54 additions & 0 deletions src/main/java/server/enums/MainStation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package server.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum MainStation {
GANAM("가남"),
GAPYEONG("가평"),
GANGNEUNG("강릉"),
GYEONGJU("경주"),
GONGJU("공주"),
GWANGJU_SONGJEONG("광주송정"),
GWANGJU("광주"),
GUMI("구미"),
GUPO("구포"),
GUNSAN("군산"),
DONGDAEGU("동대구"),
DAEJEON("대전"),
MASAN("마산"),
MOKPO("목포"),
BUSAN("부산"),
SEO_UL("서울"),
SEO_DAEGU("서대구"),
SUWON("수원"),
SUNCHEON("순천"),
SINHAE_UNDAE("신해운대"),
ASAN("아산"),
ANYANG("안양"),
ANDONG("안동"),
YEOSU_EXPO("여수EXPO"),
YEONGDEUNGPO("영등포"),
YEONGJU("영주"),
IKSAN("익산"),
INCHEON_GONGHANG_T1("인천공항T1"),
INCHEON_GONGHANG_T2("인천공항T2"),
JEONJU("전주"),
CHEONAN("천안"),
CHEONAN_ASAN("천안아산"),
CHEONGLYANG_RI("청량리"),
CHUNCHEON("춘천"),
TAEBAEK("태백"),
PANGYO_GYEONGGI("판교(경기)"),
PYEONGCHANG("평창"),
PYEONGTAEK("평택"),
POHANG("포항"),
HADONG("하동"),
HAMAN("함안"),
HONGSEONG("홍성");


private final String name;
}
54 changes: 54 additions & 0 deletions src/main/java/server/enums/MainStationCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package server.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum MainStationCode {
GANAM("NAT280090", "가남"),
GAPYEONG("NAT140576", "가평"),
GANGNEUNG("NAT601936", "강릉"),
GYEONGJU("NATH13421", "경주"),
GONGJU("NATH20438", "공주"),
GWANGJU_SONGJEONG("NAT031857", "광주송정"),
GWANGJU("NAT883012", "광주"),
GUMI("NAT012775", "구미"),
GUPO("NAT014281", "구포"),
GUNSAN("NAT081388", "군산"),
DONGDAEGU("NAT013271", "동대구"),
DAEJEON("NAT011668", "대전"),
MASAN("NAT880345", "마산"),
MOKPO("NAT032563", "목포"),
BUSAN("NAT014445", "부산"),
SEO_UL("NAT010000", "서울"),
SEO_DAEGU("NAT013189", "서대구"),
SUWON("NAT010415", "수원"),
SUNCHEON("NAT041595", "순천"),
SINHAE_UNDAE("NAT750189", "신해운대"),
ASAN("NAT080045", "아산"),
ANYANG("NAT010239", "안양"),
ANDONG("NAT022558", "안동"),
YEOSU_EXPO("NAT041993", "여수EXPO"),
YEONGDEUNGPO("NAT010091", "영등포"),
YEONGJU("NAT022188", "영주"),
IKSAN("NAT030879", "익산"),
INCHEON_GONGHANG_T1("NATC10580", "인천공항T1"),
INCHEON_GONGHANG_T2("NATC30058", "인천공항T2"),
JEONJU("NAT040257", "전주"),
CHEONAN("NAT010971", "천안"),
CHEONAN_ASAN("NATH10960", "천안아산"),
CHEONGLYANG_RI("NAT130126", "청량리"),
CHUNCHEON("NAT140873", "춘천"),
TAEBAEK("NAT650978", "태백"),
PANGYO_GYEONGGI("NAT081240", "판교"),
PYEONGCHANG("NATN10625", "평창"),
PYEONGTAEK("NAT010754", "평택"),
POHANG("NAT8B0351", "포항"),
HADONG("NAT881460", "하동"),
HAMAN("NAT880520", "함안"),
HONGSEONG("NAT080622", "홍성");

private final String code;
private final String name;
}
14 changes: 14 additions & 0 deletions src/main/java/server/enums/SeatLookingFor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package server.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum SeatLookingFor {
SEAT("좌석"),
STANDING_SEAT("입석 + 좌석"),
NOTFOUND("필요 없음");

private final String text;
}
15 changes: 15 additions & 0 deletions src/main/java/server/enums/SeatState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package server.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum SeatState {
신청하기("예약 대기 신청 하기"),
예약하기("좌석 예약 하기"),
입좌석묶음예약("입석 + 좌석 묶음 예약"),
유아동반객실("유아석");

private final String text;
}
Loading