-
Notifications
You must be signed in to change notification settings - Fork 0
CONFETI-43 feat: [온보딩 뷰] 온보딩 완료 API 변경 #554
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 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c190335
CONFETI-43 feat: 캐시의 favoriteArtist를 사용하도록 변경된 온보딩 로직 구현
jher235 6c54fa9
CONFETI-43 feat: v4 auth controller 작성
jher235 ad6245b
CONFETI-43 feat: v4 auth controller docs 작성
jher235 f32f2b1
CONFETI-43 feat: v4 변경사항으로 인해 사용되지 않을 예정이므로 @Deprecated 적용
jher235 220234c
CONFETI-43 feat: 온보딩 캐시 삭제 메서드 네이밍 변경
jher235 4009982
CONFETI-43 feat: 온보딩 완료 API 엔드포인트 변경
jher235 1f53cd6
CONFETI-43 feat: BadRequestException 및 핸들러 메서드 구현
jher235 a33a891
CONFETI-43 feat: 온보딩 아티스트 검증 로직 추가
jher235 92cc63f
Merge branch 'develop' of https://github.com/team-confeti/confeti-ser…
jher235 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
79 changes: 79 additions & 0 deletions
79
src/main/java/org/sopt/confeti/api/auth/controller/AuthControllerV4.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,79 @@ | ||
| package org.sopt.confeti.api.auth.controller; | ||
|
|
||
| import jakarta.validation.Valid; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.sopt.confeti.api.auth.controller.docs.AuthControllerV4Docs; | ||
| import org.sopt.confeti.api.auth.dto.request.LoginRequest; | ||
| import org.sopt.confeti.api.auth.facade.AuthFacade; | ||
| import org.sopt.confeti.auth.Token; | ||
| import org.sopt.confeti.auth.command.LoginCommand; | ||
| import org.sopt.confeti.auth.dto.LoginResult; | ||
| import org.sopt.confeti.domain.user.constant.Role; | ||
| import org.sopt.confeti.global.annotation.Permission; | ||
| import org.sopt.confeti.global.annotation.RefreshToken; | ||
| import org.sopt.confeti.global.annotation.UserId; | ||
| import org.sopt.confeti.global.common.BaseResponse; | ||
| import org.sopt.confeti.global.message.SuccessMessage; | ||
| import org.sopt.confeti.global.util.ApiResponseUtil; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||
| 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("/auth/v4") | ||
| public class AuthControllerV4 implements AuthControllerV4Docs { | ||
|
|
||
| private final AuthFacade authFacade; | ||
|
|
||
| @PostMapping("/login") | ||
| public ResponseEntity<BaseResponse<LoginResult>> login( | ||
| @Valid @RequestBody LoginRequest request | ||
| ) { | ||
| LoginResult result = authFacade.login(LoginCommand.from(request)); | ||
| return ApiResponseUtil.success(SuccessMessage.SUCCESS, result); | ||
| } | ||
|
|
||
| @Permission(role = {Role.ONBOARDING, Role.GENERAL}) | ||
| @PostMapping("/reissue") | ||
| public ResponseEntity<BaseResponse<Token>> reissue( | ||
| @RefreshToken String refreshToken | ||
| ) { | ||
| Token token = authFacade.reissue(refreshToken); | ||
| return ApiResponseUtil.success(SuccessMessage.SUCCESS, token); | ||
| } | ||
|
|
||
| @Permission(role = {Role.ONBOARDING, Role.GENERAL}) | ||
| @PostMapping("/logout") | ||
| public ResponseEntity<BaseResponse<Void>> logout(@UserId Long userId) { | ||
| authFacade.logout(userId); | ||
| return ApiResponseUtil.success(SuccessMessage.SUCCESS); | ||
| } | ||
|
|
||
| /** | ||
| * 개발을 위해 임시로 Role.GENERAL 접근 허용 | ||
| */ | ||
| @Permission(role = {Role.ONBOARDING, Role.GENERAL}) | ||
| @PostMapping("/onboard") | ||
| public ResponseEntity<BaseResponse<Void>> onboard( | ||
| @UserId Long userId | ||
| ) { | ||
| authFacade.onboard(userId); | ||
| authFacade.flushCachedTopArtists(userId); | ||
| return ApiResponseUtil.success(SuccessMessage.SUCCESS); | ||
| } | ||
|
|
||
| @Permission(role = {Role.GENERAL}) | ||
| @DeleteMapping("/withdraw") | ||
| public ResponseEntity<BaseResponse<Void>> withdraw( | ||
| @UserId Long userId | ||
| ) { | ||
| authFacade.withdraw(userId); | ||
| return ApiResponseUtil.success(SuccessMessage.SUCCESS); | ||
| } | ||
|
|
||
| } |
38 changes: 38 additions & 0 deletions
38
src/main/java/org/sopt/confeti/api/auth/controller/docs/AuthControllerV4Docs.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,38 @@ | ||
| package org.sopt.confeti.api.auth.controller.docs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import org.sopt.confeti.global.annotation.UserId; | ||
| import org.sopt.confeti.global.common.BaseResponse; | ||
| import org.sopt.confeti.global.common.swagger.AuthErrorResponses; | ||
| import org.sopt.confeti.global.common.swagger.CommonErrorResponses; | ||
| import org.springframework.http.ResponseEntity; | ||
|
|
||
| @Tag(name = "인증") | ||
| public interface AuthControllerV4Docs { | ||
|
|
||
| @Operation( | ||
| summary = "회원가입한 유저의 온보딩 완료 요청", | ||
| description = | ||
| """ | ||
| V4 변경사항 | ||
| - RequestBody 로 favoriteArtistId 목록을 받아서 처리하던 부분이 사라짐 | ||
| - 서버에서 내부적으로 온보딩 시 사용된 favoriteArtistId 를 관리하므로 해당 데이터를 사용해 온보딩 완료 로직을 진행함 | ||
| """ | ||
| ) | ||
| @ApiResponses( | ||
| value = { | ||
| @ApiResponse( | ||
| responseCode = "200", | ||
| description = "성공" | ||
| ) | ||
| } | ||
| ) | ||
| @CommonErrorResponses | ||
| @AuthErrorResponses | ||
| ResponseEntity<BaseResponse<Void>> onboard( | ||
| @UserId Long userId | ||
| ); | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.