Skip to content

Commit

Permalink
Merge pull request #203 from Katchup-dev/fix/#202-category-get-api
Browse files Browse the repository at this point in the history
[FIX] 공유용 출력 뷰에서 공유한 유저가 작성한 카테고리 목록을 조회할 수 있도록 수정
  • Loading branch information
yeseul106 authored Nov 9, 2023
2 parents d4a1ba7 + b6eb99d commit 9ef4e6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
public class AuthLoginResponseDto {
@Schema(description = "닉네임", example = "unan")
private String nickname;
@Schema(description = "멤버 고유 id", example = "382")
private Long memberId;
@Schema(description = "Katchup Access Token", example = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1bmFuIiwiaWF0IjoxNjI0NjQ0NjY2LCJleHAiOj")
private String accessToken;
@Schema(description = "Katchup Refresh Token", example = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1bmFuIiwiaWF0IjoxNjI0NjQ0NjY2LCJleHAiOj")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ public AuthLoginResponseDto socialLogin(AuthRequestDto authRequestDto) {

Member signedMember = memberRepository.findByEmailOrThrow(email);

Authentication authentication = new UserAuthentication(signedMember.getId(), null, null);
Long memberId = signedMember.getId();

Authentication authentication = new UserAuthentication(memberId, null, null);

String accessToken = jwtTokenProvider.generateAccessToken(authentication);

String nickname = signedMember.getMemberProfile().getNickname();

return AuthLoginResponseDto.builder()
.nickname(nickname)
.memberId(memberId)
.accessToken(accessToken)
.refreshToken(refreshToken)
.isNewUser(signedMember.isNewUser())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ public ApiResponseDto createCategoryName(Principal principal,
@ApiResponse(responseCode = "400", description = "카테고리 목록 조회 실패", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping()
@GetMapping("/{memberId}")
@ResponseStatus(HttpStatus.OK)
public ApiResponseDto<List<CategoryGetResponseDto>> getAllCategory(Principal principal,
public ApiResponseDto<List<CategoryGetResponseDto>> getAllCategory(@PathVariable final Long memberId,
@RequestParam(name = "isShared", required = false) Boolean isShared) {
Long memberId = MemberUtil.getMemberId(principal);
if (isShared != null && isShared) {
return ApiResponseDto.success(categoryService.getSharedCategories(memberId));
}
Expand Down

0 comments on commit 9ef4e6a

Please sign in to comment.