-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/seat reservation and query test + 예약 결제 구현 #9
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
base: main
Are you sure you want to change the base?
Changes from 36 commits
fec3197
be10ca5
c8d1147
59250bc
0de0449
d7fc0e1
5b7c410
9f688e5
77dd612
2d5e51a
3231608
34a287f
fde3c7b
13485af
18306ec
69ad066
d8a57d5
b918283
5b9ff84
05dda77
44bf751
056be87
af1e3b7
a63eda3
0828515
9e26ddc
c36aed6
3ca956b
89db088
a793100
d9957a8
3767097
d16b624
83f4b50
1be9459
9bbf150
8fd2946
f4432f0
3a5243c
28fc4b8
9938c32
4e37764
ad0cb21
92b04ab
c13f45d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [IntelliJ Setting] | ||
|
|
||
| - File encoding | ||
| - Settings > Editor -> code style -> naver-coding-convention | ||
| - Settings > Tools > Actions on Save > Optimize imports, Reformat code 켜기 | ||
| - 설정 파일 옮기기 (.env 등) | ||
| - Test 용 run configuration 설정하기 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,8 @@ plugins { | |
| group = "personnel.jupitorSendsme" | ||
| version = "0.0.1-SNAPSHOT" | ||
| description = "PulseTicket" | ||
| // Mockito agent 정적 로딩을 위한 변수 | ||
| val mockitoAgent = configurations.create("mockitoAgent") | ||
|
|
||
| java { | ||
| toolchain { | ||
|
|
@@ -28,15 +30,27 @@ dependencies { | |
| implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
| implementation("org.springframework.boot:spring-boot-starter-data-redis") | ||
| implementation("org.springframework.boot:spring-boot-starter-web") | ||
| // Spring Session Redis 의존성 추가 | ||
| // Redis를 세션 저장소로 사용하기 위한 의존성 | ||
| implementation("org.springframework.session:spring-session-data-redis") | ||
|
|
||
| // lombok | ||
| compileOnly("org.projectlombok:lombok") | ||
| developmentOnly("org.springframework.boot:spring-boot-devtools") | ||
| runtimeOnly("org.postgresql:postgresql") | ||
| annotationProcessor("org.projectlombok:lombok") | ||
| runtimeOnly("org.postgresql:postgresql") | ||
|
|
||
| // dev | ||
| developmentOnly("org.springframework.boot:spring-boot-devtools") | ||
|
|
||
| // test | ||
| testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
| testImplementation("org.assertj:assertj-core") | ||
| testRuntimeOnly("org.junit.platform:junit-platform-launcher") | ||
| testCompileOnly("org.projectlombok:lombok") | ||
| testAnnotationProcessor("org.projectlombok:lombok") | ||
| testRuntimeOnly("com.h2database:h2") | ||
| testImplementation("com.github.codemonstur:embedded-redis:1.4.3") | ||
|
|
||
| // Mockito agent (Java 21+ 지원) | ||
| mockitoAgent("org.mockito:mockito-core") { isTransitive = false } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 자바 21을 아직 안써봐서 처음 보네요 ㅎㅎ
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 맨처음엔 프로젝트 시작했을때 세련되면서 장기적으로 유지되는 안정적인 버전 써보자 해서 21을 선택했는데, |
||
|
|
||
| // Argon2id 비밀번호 해싱 | ||
| implementation("org.springframework.security:spring-security-crypto") | ||
|
|
@@ -54,6 +68,20 @@ tasks.withType<JavaCompile> { | |
| tasks.withType<Test> { | ||
| systemProperty("file.encoding", "UTF-8") | ||
| useJUnitPlatform() | ||
|
|
||
| // gradle.properties 값을 시스템 프로퍼티로 전달 | ||
| systemProperty("TEST_POSTGRES_PORT", findProperty("TEST_POSTGRES_PORT") ?: "") | ||
| systemProperty("TEST_POSTGRES_DB", findProperty("TEST_POSTGRES_DB") ?: "") | ||
| systemProperty("TEST_POSTGRES_USER", findProperty("TEST_POSTGRES_USER") ?: "") | ||
| systemProperty("TEST_POSTGRES_PASSWORD", findProperty("TEST_POSTGRES_PASSWORD") ?: "") | ||
| systemProperty("TEST_REDIS_PORT", findProperty("TEST_REDIS_PORT") ?: "") | ||
| systemProperty("TEST_REDIS_PASSWORD", findProperty("TEST_REDIS_PASSWORD") ?: "") | ||
|
||
|
|
||
| // 클래스 데이터 공유 관련 경고 방지 | ||
| jvmArgs("-Xshare:off") | ||
|
|
||
| // Mockito agent 정적 로딩 (Java 21+ 동적 agent 로딩 경고 방지) | ||
| jvmArgs("-javaagent:${mockitoAgent.asPath}") | ||
| } | ||
|
|
||
| // ============================================================================ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,20 +5,21 @@ | |
| CREATE TABLE users | ||
| ( | ||
| id BIGSERIAL PRIMARY KEY, | ||
| login_id VARCHAR(50) UNIQUE NOT NULL, | ||
| password_hash VARCHAR(255) NOT NULL, | ||
| created_at TIMESTAMP NOT NULL, | ||
| updated_at TIMESTAMP NOT NULL | ||
| login_id VARCHAR(100) UNIQUE NOT NULL, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 길이가 부족하셨나요?? ㅋㅋ
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test login id 설정하다보니... 😂 |
||
| password_hash VARCHAR(255) NOT NULL, | ||
| created_at TIMESTAMP NOT NULL, | ||
| updated_at TIMESTAMP NOT NULL | ||
| ); | ||
|
|
||
| -- EVENTS 테이블 | ||
| CREATE TABLE events | ||
| ( | ||
| id BIGSERIAL PRIMARY KEY, | ||
| name VARCHAR(255) NOT NULL, | ||
| total_seats INT NOT NULL, | ||
| created_at TIMESTAMP NOT NULL, | ||
| updated_at TIMESTAMP NOT NULL | ||
| id BIGSERIAL PRIMARY KEY, | ||
| name VARCHAR(255) NOT NULL, | ||
| total_seats INT NOT NULL, | ||
| ticket_price Numeric(10, 2) NOT NULL, | ||
|
||
| created_at TIMESTAMP NOT NULL, | ||
| updated_at TIMESTAMP NOT NULL | ||
| ); | ||
|
|
||
| -- SEATS 테이블 | ||
|
|
@@ -27,7 +28,7 @@ CREATE TABLE seats | |
| id BIGSERIAL PRIMARY KEY, | ||
| event_id BIGINT NOT NULL, -- FK -> events.id | ||
| seat_number INT NOT NULL, | ||
| status VARCHAR(20) NOT NULL, | ||
| status VARCHAR(20) NOT NULL, -- AVAILABLE, RESERVED, SOLD | ||
| reserved_until TIMESTAMP NULL, | ||
| created_at TIMESTAMP NOT NULL, | ||
| updated_at TIMESTAMP NOT NULL, | ||
|
|
@@ -41,7 +42,7 @@ CREATE TABLE reservations | |
| user_id BIGINT NOT NULL, -- FK -> users.id | ||
| seat_id BIGINT NOT NULL, -- FK -> seats.id | ||
| event_id BIGINT NOT NULL, -- FK -> events.id | ||
| status VARCHAR(20) NOT NULL, | ||
| status VARCHAR(20) NOT NULL, -- PENDING, CONFIRMED, CANCELLED, EXPIRED | ||
| expires_at TIMESTAMP NOT NULL, | ||
| confirmed_at TIMESTAMP NULL, | ||
| cancelled_at TIMESTAMP NULL, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,10 +8,11 @@ | |
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import personnel.jupitorsendsme.pulseticket.dto.ReservationBookingRequest; | ||
| import personnel.jupitorsendsme.pulseticket.dto.ReservationQueryResponse; | ||
| import personnel.jupitorsendsme.pulseticket.dto.ReservationRequest; | ||
| import personnel.jupitorsendsme.pulseticket.entity.SeatStatusResponse; | ||
| import personnel.jupitorsendsme.pulseticket.service.ReservationQueryService; | ||
| import personnel.jupitorsendsme.pulseticket.service.SeatManagementService; | ||
|
|
||
| /** | ||
| * 좌석 조회 컨트롤러 | ||
|
|
@@ -24,6 +25,7 @@ | |
| public class ReservationQueryController { | ||
|
|
||
| private final ReservationQueryService reservationQueryService; | ||
| private final SeatManagementService seatManagementService; | ||
|
|
||
| /** | ||
| * 특정 이벤트에 대한 예약 가능 여부. <br> | ||
|
|
@@ -32,7 +34,7 @@ public class ReservationQueryController { | |
| * @return 예약 가능 여부 | ||
| */ | ||
| @GetMapping("isBookingEventAvailable") | ||
| public Boolean isBookingEventAvailable(@ModelAttribute ReservationBookingRequest request) { | ||
| public Boolean isBookingEventAvailable(@ModelAttribute ReservationRequest request) { | ||
| return reservationQueryService.isBookingEventAvailable(request); | ||
| } | ||
|
|
||
|
|
@@ -42,8 +44,8 @@ public Boolean isBookingEventAvailable(@ModelAttribute ReservationBookingRequest | |
| * @return 특정 이벤트의 좌석 정보 리스트 | ||
| */ | ||
| @GetMapping("statusOfSeatsOfTheEvent") | ||
| public List<SeatStatusResponse> statusOfSeatsOfTheEvent(@ModelAttribute ReservationBookingRequest request) { | ||
| return reservationQueryService.statusOfSeatsOfTheEvent(request); | ||
| public List<SeatStatusResponse> statusOfSeatsOfTheEvent(@ModelAttribute ReservationRequest request) { | ||
| return seatManagementService.statusOfSeatsOfTheEvent(request); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -53,8 +55,8 @@ public List<SeatStatusResponse> statusOfSeatsOfTheEvent(@ModelAttribute Reservat | |
| */ | ||
|
|
||
| @GetMapping("isSpecificSeatAvailable") | ||
| public Boolean isSpecificSeatAvailable(@ModelAttribute ReservationBookingRequest request) { | ||
| return reservationQueryService.isSpecificSeatAvailable(request); | ||
| public Boolean isSpecificSeatAvailable(@ModelAttribute ReservationRequest request) { | ||
| return seatManagementService.isSpecificSeatAvailable(request); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -63,7 +65,7 @@ public Boolean isSpecificSeatAvailable(@ModelAttribute ReservationBookingRequest | |
| * @return 예약 목록이 담긴 DTO | ||
| */ | ||
| @GetMapping("inquiryUserReservations") | ||
| public List<ReservationQueryResponse> inquiryUserReservations(@ModelAttribute ReservationBookingRequest request) { | ||
| public List<ReservationQueryResponse> inquiryUserReservations(@ModelAttribute ReservationRequest request) { | ||
|
||
| return reservationQueryService.inquiryUserReservations(request); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅇㄹㄴㄹㄴㅇㄹ