MoNew-Request-User-ID 헤더를 통해 전달됩니다.| Method | Endpoint | 설명 |
|---|---|---|
| POST | /api/follows |
팔로우 생성 |
| GET | /api/follows/summary |
팔로우 요약 정보 조회 |
| GET | /api/follows/followings |
팔로잉 목록 조회 |
| GET | /api/follows/followers |
팔로워 목록 조회 |
| DELETE | /api/follows/{followId} |
팔로우 취소 |
작업 요약:
UserRegisterRequest DTO 설계(record 기반)
@Notnull@NotnullFollowDto 응답 DTO 설계(record 기반)
id, followee, followerPOST /api/follows)
UserRepository.existsByEmail(String email) 사용400 Bad Request: 입력값 오류 → MethodArgumentNotValidException 처리409 Conflict: 이메일 중복 → CustomException(ErrorCode.CONFLICT, detail, ExceptionType.USER)500: 서버 오류 → 전역 처리ErrorResponse):{
"timestamp": "2025-05-30T08:20:42.123Z",
"code": "CONFLICT",
"message": "리소스 충돌이 발생했습니다.",
"details": {
"reason": "EMAIL",
"field": "email",
"value": "[email protected]"
},
"exceptionType": "userException",
"status": 409
}
UserRegisterRequest, UserDtoUserUserRepositoryUserMapperUserService.register(), UserServiceImplUserController.register()CustomException, ErrorDetail, ExceptionType.USER, ErrorCode.CONFLICT작업 요약:
UserLoginRequest DTO 설계 (record 기반)
@Email, @NotBlank@NotBlankUserDto 응답 DTO 설계 (record)
id, email, nickname, createdAtPOST /api/users/login)
CustomUserDetailsService 통해 사용자 조회UsernamePasswordAuthenticationToken, AuthenticationManager 사용SecurityContext에 사용자 저장HttpServletRequest.getSession(true))BCryptPasswordEncoder 적용
matches()로 비교SecurityConfig: PasswordEncoder Bean 등록UserServiceImpl: 비밀번호 저장 및 검증 방식 변경MoNewUserValidationFilter)
axios.create({ withCredentials: true }) 적용CorsFilter → 이후 제거 가능401 Unauthorized: 잘못된 로그인 → BadCredentialsException, CustomException으로 래핑403 Forbidden: 사용자 불일치 → CustomException(ErrorCode.FORBIDDEN, detail, ExceptionType.AUTH)500: 서버 오류 → 전역 처리ErrorResponse):{
"timestamp": "2025-06-13T01:08:59.000Z",
"code": "FORBIDDEN",
"message": "접근 권한이 없습니다.",
"details": {
"reason": "USER_ID_MISMATCH",
"field": "userId",
"value": "abc-uuid"
},
"exceptionType": "authException",
"status": 403
}
사용 클래스:
UserLoginRequest, UserDtoUserUserRepositoryCustomUserDetailsService, AuthenticationManager, SecurityContextHolderMoNewUserValidationFilterUserService.login(), UserServiceImplUserController.login()BCryptPasswordEncoder, PasswordEncoderCustomException, ErrorDetail, ExceptionType.AUTH, ErrorCode.FORBIDDENUserUpdateRequest DTO 설계 (record 기반)
@Size(min=1, max=20), @NotBlank 적용PATCH /api/users/{userId})