Skip to content

feat: 2주차 회원가입/로그인 API 및 Validation 적용#5

Open
yun1code wants to merge 34 commits intomainfrom
feature/seoyeon_week2
Open

feat: 2주차 회원가입/로그인 API 및 Validation 적용#5
yun1code wants to merge 34 commits intomainfrom
feature/seoyeon_week2

Conversation

@yun1code
Copy link
Collaborator

@yun1code yun1code commented Jan 9, 2026

2주차 실습

구현 내용

  • 회원가입 API 구현 (POST /api/members/signup)
  • 로그인 API 구현 (POST /api/members/login)
  • 요청 DTO에 Validation 적용
    • @NotBlank
    • @Email
    • @Size
  • 회원 이메일 중복 검증 로직 추가
  • BCrypt를 이용한 비밀번호 암호화
  • 공통 예외 처리 (GeneralException, ErrorCode) 적용
  • 게시글 단건 조회 API에 공통 예외 처리 적용

설정

  • Spring Security 의존성 추가 (비밀번호 암호화 목적)
  • Spring Validation 의존성 추가
  • Swagger UI로 API 테스트

※ feature 브랜치에서만 작업하였고, merge는 진행하지 않았습니다.

@ownue ownue self-requested a review January 9, 2026 07:13
Copy link
Collaborator

@ownue ownue left a comment

Choose a reason for hiding this comment

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

이번 과제에서 예외 처리랑 Validation 흐름을 직접 잡는 것이 어려웠을 수도 있는데 아주 잘해주셨습니다!! 이대로 연합 프로젝트에서도 무리 없이 잘 하실 수 있으리라 믿습니다 ㅎ.ㅎ
과제 진행하시느라 수고 많으셨습니다~!

private final PostService postService;

@PostMapping()
public PostResponseDto createPost(@RequestBody PostRequestDto requestDto){
Copy link
Collaborator

Choose a reason for hiding this comment

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

지금 PostController.createPost()에서 @Valid가 빠져 있어서 실제 검증이 동작하지 않습니다...! DTO에는 잘 넣어두셔서, 컨트롤러에 @Valid만 추가해주면 서연님이 의도하신 대로 동작할 수 있습니다! 다음에는 꼭 컨트롤러단에 @Valid를 넣어주세요!


@Transactional
public PostResponseDto createPost(PostRequestDto requestDto){
Member member = memberRepository.findById(requestDto.getMemberId()).orElseThrow(() -> new IllegalArgumentException("존재하지 않는 회원입니다."));
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도 GeneralException으로 에러 핸들링 해줄 수 있을 것 같습니당

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants