-
Notifications
You must be signed in to change notification settings - Fork 37
[4주차] RateLimit 적용 및 테스트코드 추가 #89
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
418e3ec
API 응답 메시지 수정
38c706c
예매API 컨트롤러 분리 및 패키지 구조 변경
0535785
영화 조회 및 예매로직 RateLimit 적용
e71d8df
예매 시도 및 완료 후 RateLimit 로직 분리
43b5a39
dto 패키지 위치 변경
4770f4a
영화 예매 비즈니스 로직 단위 테스트 코드 추가 및 통합 테스트 코드 추가
9a632cb
통합테스트시 redis Testcontainers 로 실행되게 수정
56fc2e3
jacoco 테스트 설정 추가 및 테스트 보고서 추가
f8dc766
jacoco_report_aggregation 플러그인 추가, jacoco 보고서 통합
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
29 changes: 29 additions & 0 deletions
29
cinema-adapter/src/main/java/com/hanghae/adapter/web/ReservationController.java
This file contains hidden or 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,29 @@ | ||
| package com.hanghae.adapter.web; | ||
|
|
||
| import com.hanghae.application.dto.ApiResponse; | ||
| import com.hanghae.application.dto.request.MovieReservationRequestDto; | ||
| import com.hanghae.application.enums.HttpStatusCode; | ||
| import com.hanghae.application.port.in.MovieReservationService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequiredArgsConstructor | ||
| @RequestMapping("/api") | ||
| public class ReservationController { | ||
| private final MovieReservationService movieReservationService; | ||
|
|
||
| //영화 예약 | ||
| // TODO :: 좌석선택API와 영화예약API 분리 | ||
| @PostMapping("/v1/movie-reservation") | ||
| public ResponseEntity<ApiResponse<Void>> saveMovieReservation(@RequestBody MovieReservationRequestDto requestDto) { | ||
| ApiResponse<Void> response = movieReservationService.saveMovieReservation(requestDto); | ||
|
|
||
| //응답코드 일치시켜서 리턴 | ||
| return ResponseEntity.status(response.status().getCode()).body(response); | ||
| } | ||
| } |
This file contains hidden or 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
24 changes: 24 additions & 0 deletions
24
cinema-adapter/src/main/resources/application-test.properties
This file contains hidden or 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,24 @@ | ||
| # H2 | ||
| spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MODE=MySQL | ||
| spring.datasource.driver-class-name=org.h2.Driver | ||
| spring.datasource.username=test_user | ||
| spring.datasource.password=test_password | ||
| spring.jpa.database-platform=org.hibernate.dialect.H2Dialect | ||
|
|
||
| # h2 (http://localhost:8080/h2-console) | ||
| spring.h2.console.enabled=true | ||
| spring.h2.console.path=/h2-console | ||
|
|
||
| # JPA | ||
| spring.jpa.hibernate.ddl-auto=create-drop | ||
| spring.jpa.show-sql=true | ||
| spring.jpa.properties.hibernate.format_sql=true | ||
| spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect | ||
| spring.jpa.generate-ddl=true | ||
| spring.jpa.open-in-view=false | ||
|
|
||
| # log | ||
| #logging.level.root=info | ||
|
|
||
|
|
||
|
|
This file contains hidden or 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,50 @@ | ||
| INSERT INTO member (member_id, birth_date, created_by, created_at) | ||
| VALUES (1, '1999-01-01', 99, NOW()); | ||
|
|
||
| INSERT INTO upload_file (file_id, file_path, file_name, origin_file_name, created_by, created_at) | ||
| VALUES (1, '/radis/test/', 'test1.png', 'origin.png', 99, NOW()); | ||
|
|
||
| INSERT INTO upload_file (file_id, file_path, file_name, origin_file_name, created_by, created_at) | ||
| VALUES (2, '/radis/test/', 'test2.png', 'origin.png', 99, NOW()); | ||
|
|
||
| INSERT INTO upload_file (file_id, file_path, file_name, origin_file_name, created_by, created_at) | ||
| VALUES (3, '/radis/test/', 'test3.png', 'origin.png', 99, NOW()); | ||
|
|
||
| INSERT INTO movie (movie_id, file_id, title, rating, release_date, running_time_minutes ,genre, created_by, created_at) | ||
| VALUES (1, 1, '치토스', '2', '2024-12-11', 90, 'T', 99, NOW()); | ||
|
|
||
| INSERT INTO movie (movie_id, file_id, title, rating, release_date, running_time_minutes ,genre, created_by, created_at) | ||
| VALUES (2, 2, '칸초', '1', '2024-11-17', 120, 'F', 99, NOW()); | ||
|
|
||
| INSERT INTO movie (movie_id, file_id, title, rating, release_date, running_time_minutes ,genre, created_by, created_at) | ||
| VALUES (3, 3, '공공칠빵', '3', '2024-10-13', 110, 'A', 99, NOW()); | ||
|
|
||
| INSERT INTO screen (screen_id, screen_name, created_by, created_at) | ||
| VALUES (1, '1관', 99, NOW()); | ||
|
|
||
| INSERT INTO screen (screen_id, screen_name, created_by, created_at) | ||
| VALUES (2, '2관', 99, NOW()); | ||
|
|
||
| INSERT INTO screening_schedule (schedule_id, movie_id, screen_id, show_start_at, created_by, created_at) | ||
| VALUES (1, 1, 1, '2025-02-13 10:50:00', 99, NOW()); | ||
|
|
||
| INSERT INTO screening_schedule (schedule_id, movie_id, screen_id, show_start_at, created_by, created_at) | ||
| VALUES (2, 2, 2, '2025-02-20 12:00:00', 99, NOW()); | ||
|
|
||
| INSERT INTO screening_schedule (schedule_id, movie_id, screen_id, show_start_at, created_by, created_at) | ||
| VALUES (3, 3, 1, '2025-02-17 13:20:00', 99, NOW()); | ||
|
|
||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (1, 1, 'A', 5, 99, NOW()); | ||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (2, 1, 'B', 5, 99, NOW()); | ||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (3, 1, 'C', 5, 99, NOW()); | ||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (4, 1, 'D', 5, 99, NOW()); | ||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (5, 1, 'E', 5, 99, NOW()); | ||
|
|
||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (6, 2, 'A', 5, 99, NOW()); | ||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (7, 2, 'B', 5, 99, NOW()); | ||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (8, 2, 'C', 5, 99, NOW()); | ||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (9, 2, 'D', 5, 99, NOW()); | ||
| INSERT INTO screen_seat_layout (seat_layout_id, screen_id, seat_row, max_seat_number, created_by, created_at) VALUES (10, 2, 'E', 5, 99, NOW()); | ||
|
|
||
| INSERT INTO ticket_reservation (ticket_id, schedule_id, screen_seat, member_id, created_by, created_at) | ||
| VALUES (1, 1, 'E01', 1, 99, NOW()); |
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
텍스트 픽스처를 활용해주셨네요! 놓치기 쉬운 부분인데 세심하게 구현해 주셨어요!