-
Notifications
You must be signed in to change notification settings - Fork 161
[2 - 4단계 방탈출 결제 / 배포] 이든(최승준) 미션 제출합니다. #154
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
50 commits
Select commit
Hold shift + click to select a range
e19f767
feat: Payment Entity 구현 및 연관관계 설정
PgmJun d2a50bf
feat: 결제 시, 결제정보(Payment) DB 저장 로직 추가
PgmJun 20dc304
refactor: size 검증 테스트 isEqualTo() -> hasSize() 로 리팩토링
PgmJun 96e6786
fix: EntityGraph로 LazyInitializationException 오류 해결
PgmJun 925bd01
feat: 내 예약정보 조회에서 paymentKey, amount 확인 로직 추가
PgmJun 1744936
test: Payment 객체 추가로 인한 테스트 로직 변경 사항 반영
PgmJun 58bae37
feat: 예약대기에서 예약 상태로 변경되면 '결제대기' 상태의 예약자가 되도록 구
PgmJun b3541e5
fix: 회원 비밀번호 제한 범위 오류 수정
PgmJun 739da66
fix: ReservationStatus에 Enumerated 애노테이션 적용
PgmJun f27ac68
fix: 결제 대기 상태 예약은 내 예약 조회에서 조회되지 않던 오류 수정
PgmJun f110a47
docs: 예약 삭제 관련 TODO 추가
PgmJun ddd1a04
refactor: properties -> yml 로 프로퍼티 파일 변경
PgmJun 51f7006
refactor: 회원도 결제 대기 상태라면 예약 삭제 가능하도록 변경
PgmJun 41d465f
feat: 결제 환불 기능 구현
PgmJun c182a02
fix: 결제 상태 메시지 설정 오류 수정
PgmJun e0f2ddf
refactor: Payment 테이블에 requestedAt, approvedAt 데이터도 저장하도록 변경
PgmJun c14525f
feat: 설정한 가격에 따라 다른 금액으로 결제되는 기능 구현
PgmJun 30a775d
feat: 예약정보, 결제정보 Soft Delete 로 처리로 변경
PgmJun 0b07436
feat: 결제 대기 상태의 예약에 대한 결제 기능 구현
PgmJun 35d8c77
feat: 취소된 예약 삭제 기능 구현
PgmJun 8091dd6
feat: 예약 삭제, 예약 취소 API 분리
PgmJun 678eacc
fix: 결제 대기 상태에서 예약을 삭제하면 payment 정보 삭제하지 않도록 수정
PgmJun b6acee3
test: 예약 취소, 삭제 테스트 코드 분리
PgmJun 1670f8d
feat: Swagger API Operation 추가
PgmJun a2d04ab
fix: validateReservationStatusForDelete 검증 로직 오류 수정
PgmJun f98e930
fix: 결제 취소 시간/상태 기록하고 있지 않던 로직 오류 수정
PgmJun 142a568
refactor: 결제 대기 예약 결제 후, DB 반영 딜레이 1초 대기 로직 추가
PgmJun d1cba2c
test: 결제 취소 시간/상태 기록하고 있지 않던 로직 오류 수정함에 따라 관련 테스트 코드도 수정
PgmJun 22636f2
docs: ERD 추가
PgmJun 1a2cdb8
refactor: ReservationWaiting 연관관계 엔티티에 LAZY 로딩 적용
PgmJun 0b8b54f
fix: delete 기능에 빠져있던 Transactional 처리 추가
PgmJun bd1ecbe
refactor: indent 초과 로직 메서드 분리
PgmJun d764ed0
refactor: 내부 동작 예측이 불가능한 생성자 메서드를 정적팩토리 메서드로 변경하여 이름 부여
PgmJun cff5dc9
refactor: ThemePrice에 값 객체 적용
PgmJun aff4625
refactor: 엔티티 기본 생성자 접근제어자 protected 로 변경
PgmJun b9f12de
refactor: 메서드명 적절하게 변경
PgmJun f962d3a
refactor: 미사용 메서드 제거
PgmJun 8c8b39f
refactor: 의도가 불분명한 changeMember 메서드 대신 정적팩토리 메서드 fromDifferentMember …
PgmJun ffa92df
refactor: TODO 제거
PgmJun a8d23ed
test: 결제 대기 예약 결제 테스트 추가
PgmJun c011941
docs: Swagger JWT 인증 처리 추가
PgmJun 896ba67
refactor: 의미가 드러나지 않는 매직 리터럴 상수 처리
PgmJun 352b659
refactor: 인덴트 2 -> 1로 수정
PgmJun 3600823
refactor: 테마 가격 범위 검증 기능 구현
PgmJun bbfc9ef
refactor: VO 객체는 record 사용하도록 변경
PgmJun 8f10eb7
feat: 로컬(local), 운영(prod), 테스트(test) 환경 분리
PgmJun efa6ff0
refactor: 레코드 Custom Constructor 적용
PgmJun e70f01a
refactor: Swagger에서 JWT 요청 정보 제거하는 로직을 @Parameter(hidden=true)로 일일히 처…
PgmJun 67a5431
refactor: 메서드 매개변수에서 Optional 사용하는 로직 제거
PgmJun 6894fa9
refactor: DB NamingStrategy 설정 제거
PgmJun 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package roomescape.config; | ||
|
||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
import io.swagger.v3.oas.models.security.SecurityScheme; | ||
import org.springdoc.core.utils.SpringDocUtils; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import roomescape.config.auth.LoginMember; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
private static final String SECURITY_SCHEME_NAME = "bearerAuth"; | ||
|
||
@Bean | ||
public OpenAPI openAPI() { | ||
SpringDocUtils.getConfig().addAnnotationsToIgnore(LoginMember.class); | ||
|
||
return new OpenAPI() | ||
.addSecurityItem(new SecurityRequirement() | ||
.addList(SECURITY_SCHEME_NAME)) | ||
.components(new Components() | ||
.addSecuritySchemes(SECURITY_SCHEME_NAME, new SecurityScheme() | ||
.name(SECURITY_SCHEME_NAME) | ||
.type(SecurityScheme.Type.HTTP) | ||
.scheme("bearer") | ||
.bearerFormat("JWT"))) | ||
.info(apiInfo()); | ||
} | ||
|
||
private Info apiInfo() { | ||
return new Info() | ||
.title("Room Escape API Docs") | ||
.description("방탈출 예약 시스템 서버 REST API 문서") | ||
.version("1.0.0"); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package roomescape.controller.login; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.servlet.http.Cookie; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import jakarta.validation.Valid; | ||
|
@@ -19,6 +21,7 @@ | |
|
||
import java.net.URI; | ||
|
||
@Tag(name = "Login") | ||
@RestController | ||
public class LoginController { | ||
private final LoginService loginService; | ||
|
@@ -30,6 +33,7 @@ public LoginController(LoginService loginService, AuthCookieHandler authCookieHa | |
} | ||
|
||
@PostMapping("/login") | ||
@Operation(summary = "로그인", description = "회원정보를 통해 로그인을 수행한다.") | ||
public ResponseEntity<Void> login(@RequestBody @Valid LoginRequest request, HttpServletResponse response) { | ||
String token = loginService.login(request); | ||
Cookie cookie = authCookieHandler.createCookie(token); | ||
|
@@ -39,20 +43,23 @@ public ResponseEntity<Void> login(@RequestBody @Valid LoginRequest request, Http | |
|
||
@RoleAllowed | ||
@GetMapping("/login/check") | ||
@Operation(summary = "[회원] 로그인 검증", description = "JWT 토큰을 통해 로그인 여부를 검사한다.") | ||
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. 의견) 문서에서 로그인이 필요한 엔드포인트에서 LoginMember이 인자로 노출되고 있는데요, springdocs의 auth 기능을 통해 사용할 수 있게 하면 좋을 것 같아요. 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. 그 부분에 대한 처리를 놓쳤네요..! |
||
public ResponseEntity<LoginCheckResponse> loginCheck(@LoginMember Member member) { | ||
LoginCheckResponse response = loginService.loginCheck(member); | ||
return ResponseEntity.ok().body(response); | ||
} | ||
|
||
@RoleAllowed | ||
@PostMapping("/logout") | ||
@Operation(summary = "[회원] 로그아웃", description = "로그아웃을 수행한다.") | ||
public ResponseEntity<Void> logout(HttpServletResponse response) { | ||
Cookie cookie = authCookieHandler.deleteCookie(); | ||
response.addCookie(cookie); | ||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@PostMapping("/signup") | ||
@Operation(summary = "회원가입", description = "회원가입을 수행한다.") | ||
public ResponseEntity<SignupResponse> signup(@RequestBody @Valid SignupRequest request) { | ||
SignupResponse response = loginService.signup(request); | ||
return ResponseEntity.created(URI.create("/members/" + response.getId())).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
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
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
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.
질문) springdoc과 spring rest docs 중에 기술을 선택한 근거가 궁금해요.
Uh oh!
There was an error while loading. Please reload this page.
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.
RestDocs는 사용해본 경험이 없기 때문에 학습에 대한 시간적 리소스가 필요한 반면,
Swagger는 사용해본 경험이 있어서 빠르게 적용할 수 있다는 생각에 선택하였습니다.
물론 미션이기 때문에 안 써본 기술을 학습해서 적용해보는 것도 중요하지만 문서화 기술은 조금 다른 범주라고 생각되었습니다.
문서화 도구는 미션 이후 따로 공부하거나, 레벨3 프로젝트 때 학습하여 적용해보는 등 아무때나 충분히 학습 및 사용가능한 하나의 기술이라고 생각합니다.
반면 결제 관련 부분에 대한 저의 고민과 설계를 현업자인 호돌에게 리뷰받을 수 있는 기회는 이번 리뷰활동이 마지막이라고 생각합니다.
때문에 결제 관련 설계에 더 시간적 리소스를 투자하고자 하였고,
이 과정에서 빠르게 적용하여 미션 요구사항을 충족시킬 수 있는 Swagger를 선택하게 되었습니다.
물론 Swagger와 RestDocs는 각 기술의 장단점이 있으며 그것또한 비교하며 선택해야 하지만,
이번엔 그 부분을 충분히 학습하고 고려해보지 못한 점이 아쉬움으로 남긴합니다.
RestDocs 에 대해서는 따로 학습하여 적용해보고 Swagger와의 장단점을 비교해보겠습니다!