Skip to content
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

Feat #92 전역 내정보 조회 #92

Merged
merged 5 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public record SummaryResponse(
Integer id,
String name,
List<Integer> cardinals,
Position position
Position position,
Role role
) {
}

Expand Down Expand Up @@ -75,4 +76,12 @@ public record SocialAuthResponse(
Long kakaoId
) {
}

public record UserInfo(
Long id,
String name,
List<Integer> cardinals,
Role role
) {
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package leets.weeth.domain.user.application.mapper;

import leets.weeth.domain.user.application.dto.response.UserResponseDto.*;
import leets.weeth.domain.user.application.dto.response.UserResponseDto;
import leets.weeth.domain.user.application.dto.response.UserResponseDto.SummaryResponse;
import leets.weeth.domain.user.application.dto.response.UserResponseDto.UserResponse;
import leets.weeth.domain.user.domain.entity.User;
import leets.weeth.domain.user.domain.entity.enums.Department;
import leets.weeth.global.auth.jwt.application.dto.JwtDto;
Expand Down Expand Up @@ -56,6 +59,7 @@ public interface UserMapper {
})
UserResponse toUserResponse(User user);

UserResponseDto.UserInfo toUserInfoDto(User user);
default String toString(Department department) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 엔터 하나만 있으면 좋을거같아요!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했습니당

return department.getValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ public interface UserUseCase {

JwtDto refresh(String refreshToken);

UserResponseDto.UserInfo findUserInfo(Long userId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ public JwtDto refresh(String refreshToken) {
return new JwtDto(token.accessToken(), token.refreshToken());
}

@Override
public UserResponseDto.UserInfo findUserInfo(Long userId) {
User user = userGetService.find(userId);
return mapper.toUserInfoDto(user);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 엔터 하나만,,,.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했어욤

private long getKakaoId(Login dto) {
KakaoTokenResponse tokenResponse = kakaoAuthService.getKakaoToken(dto.authCode());
KakaoUserInfoResponse userInfo = kakaoAuthService.getUserInfo(tokenResponse.access_token());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용하는 라이브러리 맞나요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용하지 않는 의존성이라 제거 했습니다

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 내용은 현재 사용되지 않는 import 문인거같아, 불필요하다면 삭제 해주셔도 될거같습니다 !

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 제거했습니닷

import jakarta.validation.Valid;
import leets.weeth.domain.user.application.dto.response.UserResponseDto;
import leets.weeth.domain.user.application.dto.response.UserResponseDto.SummaryResponse;
Expand Down Expand Up @@ -94,6 +95,12 @@ public CommonResponse<Response> find(@Parameter(hidden = true) @CurrentUser Long
return CommonResponse.createSuccess(USER_FIND_BY_ID_SUCCESS.getMessage(), userUseCase.find(userId));
}

@GetMapping("/info")
@Operation(summary = "전역 내 정보 조회 API")
public CommonResponse<UserResponseDto.UserInfo> findMyInfo(@Parameter(hidden = true) @CurrentUser Long userId) {
return CommonResponse.createSuccess(USER_FIND_BY_ID_SUCCESS.getMessage(), userUseCase.findUserInfo(userId));
}

@PatchMapping
@Operation(summary = "내 정보 수정")
public CommonResponse<Void> update(@RequestBody @Valid Update dto, @Parameter(hidden = true) @CurrentUser Long userId) {
Expand Down
Loading