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
@Notnull
FollowDto
응답 DTO 설계(record
기반)
id
, followee
, follower
POST /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
, UserDto
User
UserRepository
UserMapper
UserService.register()
, UserServiceImpl
UserController.register()
CustomException
, ErrorDetail
, ExceptionType.USER
, ErrorCode.CONFLICT
작업 요약:
UserLoginRequest
DTO 설계 (record
기반)
@Email
, @NotBlank
@NotBlank
UserDto
응답 DTO 설계 (record
)
id
, email
, nickname
, createdAt
POST /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
, UserDto
User
UserRepository
CustomUserDetailsService
, AuthenticationManager
, SecurityContextHolder
MoNewUserValidationFilter
UserService.login()
, UserServiceImpl
UserController.login()
BCryptPasswordEncoder
, PasswordEncoder
CustomException
, ErrorDetail
, ExceptionType.AUTH
, ErrorCode.FORBIDDEN
UserUpdateRequest
DTO 설계 (record
기반)
@Size(min=1, max=20)
, @NotBlank
적용PATCH /api/users/{userId}
)