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][#1] 사용자 관련 API 구현 #4

Merged
merged 13 commits into from
Feb 27, 2025
Merged

Conversation

mjeongriver
Copy link
Collaborator

@mjeongriver mjeongriver commented Feb 17, 2025

관련 이슈

resolve : #1

작업 내용

  • 프로젝트 구조 설정
  • 일반 사용자
  • 회원가입
  • 내 정보 조회
  • 내 정보 수정
  • 내 계정 삭제
  • 관리자 API 추가
  • 특정 사용자 조회
  • 모든 사용자 조회
  • 특정 사용자 삭제
  • 특정 사용자 활성화

참고사항

  1. 회원 삭제 방식 변경
    회원 삭제 시 PATCH 메서드를 사용해서 isActive 필드를 업데이트하도록 변경하였습니다.

    1.1. PATCH 메서드 선택 이유
    - 기존에는 DELETE 메서드를 사용할지 고민했으나, 회원 데이터를 완전히 삭제하는 대신 비활성화하는 방식을 적용하기 위해 PATCH 메서드를 선택하였습니다.
    - 이를 통해 회원 데이터를 유지하면서 복구가 가능하도록 하였습니다.

    1.2. 비활성화된 회원 처리 방식
    - isActive = false 상태인 사용자는 로그인 등 주요 기능이 제한됩니다.

@mjeongriver mjeongriver marked this pull request as ready for review February 19, 2025 05:51
@mjeongriver mjeongriver reopened this Feb 19, 2025
@mjeongriver mjeongriver marked this pull request as draft February 19, 2025 06:25
@mjeongriver mjeongriver changed the title Feature/1 user crud [feat][#1] 사용자 관련 API 구현 Feb 19, 2025
@mjeongriver mjeongriver marked this pull request as ready for review February 23, 2025 08:00
@mjeongriver mjeongriver self-assigned this Feb 23, 2025
@mjeongriver mjeongriver added ✨ Feature 기능 개발 📬 API 서버 API 통신 labels Feb 23, 2025
@mjeongriver mjeongriver added this to the CRUD 기능 개발 milestone Feb 23, 2025
@mjeongriver mjeongriver changed the base branch from main to develop February 23, 2025 11:09
Copy link

@f-lab-plam f-lab-plam left a comment

Choose a reason for hiding this comment

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

확인하였습니다!

Comment on lines +12 to +13
@ExceptionHandler(BaseException.class)
public ResponseEntity<ErrorResponse> handleBaseException(BaseException ex) {

Choose a reason for hiding this comment

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

👍👍👍 exception 처리 아주 좋네요. 나중에 기능들 세분화 되면서 더 발전된 처리과정 되는걸 기대합니다!

Comment on lines +80 to +91
public List<UserResponseDTO> findAllUsers() {
return userRepository.findAll()
.stream()
.map(UserResponseDTO::new)
.toList();
}

public UserResponseDTO findUserById(Long id) {
UserEntity user = userRepository.findById(id)
.orElseThrow(UserNotFoundException::new);
return new UserResponseDTO(user);
}

Choose a reason for hiding this comment

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

해당 메서드들은 @Transactional(readOnly = true) 를 붙이지 않은 이유가 있나요?
위쪽 조회 메서드는 붙어있는데, 해당 메서드들은 @Transactional(readOnly = true) 의 트레이드 오프를 생각하시고 빼신걸까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

단일 엔티티 조회라서 readOnly 속성을 제거하려고 했었는데, 제대로 확인하지 못했습니다. 제거하고 다시 올리겠습니다!

Comment on lines +18 to +26
@Override
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
UserEntity userEntity = userRepository.findByEmail(email)
.orElseThrow(() -> new UsernameNotFoundException("유저를 찾을 수 없습니다."));

if (!userEntity.isActive()) {
throw new UsernameNotFoundException("비활성화된 계정입니다. 관리자에게 문의하세요.");
}

Choose a reason for hiding this comment

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

👍👍👍

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

@mjeongriver mjeongriver merged commit e2c5204 into develop Feb 27, 2025
1 of 2 checks passed
@mjeongriver mjeongriver deleted the feature/1-user-crud branch February 27, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📬 API 서버 API 통신 ✨ Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] 사용자 관련 API 구현
2 participants