[상수 리팩토링] ApiResponseCode를 global.constants 패키지로 이동하고, 관련 코드에서 ApiResponseCode 참조를 업데이트하여 코드 일관성 및 가독성 향상
This commit is contained in:
@@ -20,7 +20,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
|
||||
@Tag(name = "Member", description = "회원 관련 API")
|
||||
@RestController
|
||||
@@ -39,7 +39,7 @@ public class MemberController {
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content(schema = @Schema(implementation = ApiResponseDto.class))),
|
||||
@ApiResponse(responseCode = "409", description = "중복된 사용자 정보", content = @Content(schema = @Schema(implementation = ApiResponseDto.class)))
|
||||
})
|
||||
@PostMapping
|
||||
@PostMapping("/register")
|
||||
public ResponseEntity<ApiResponseDto<CreateMemberResponseDto>> createMember(@RequestBody @Valid CreateMemberRequestDto requestDto) {
|
||||
MemberDto member = memberMapper.toMemberDto(requestDto);
|
||||
MemberDto createdMember = memberService.createMember(member);
|
||||
|
@@ -1,12 +0,0 @@
|
||||
package com.bio.bio_backend.domain.user.member.exception;
|
||||
|
||||
public class UserDuplicateException extends RuntimeException {
|
||||
|
||||
public UserDuplicateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public UserDuplicateException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
@@ -5,9 +5,8 @@ import com.bio.bio_backend.domain.user.member.entity.Member;
|
||||
import com.bio.bio_backend.domain.user.member.enums.MemberRole;
|
||||
import com.bio.bio_backend.domain.user.member.mapper.MemberMapper;
|
||||
import com.bio.bio_backend.domain.user.member.repository.MemberRepository;
|
||||
import com.bio.bio_backend.domain.user.member.exception.UserDuplicateException;
|
||||
import com.bio.bio_backend.global.exception.ApiException;
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.bio.bio_backend.global.utils;
|
||||
package com.bio.bio_backend.global.constants;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
@@ -3,7 +3,7 @@ package com.bio.bio_backend.global.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.bio.bio_backend.global.exception;
|
||||
|
||||
import lombok.Getter;
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
|
||||
@Getter
|
||||
public class ApiException extends RuntimeException {
|
||||
|
@@ -15,7 +15,7 @@ import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import com.bio.bio_backend.global.dto.ApiResponseDto;
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
|
||||
import com.bio.bio_backend.global.dto.ApiResponseDto;
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
|
@@ -15,7 +15,7 @@ import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import com.bio.bio_backend.global.dto.ApiResponseDto;
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
|
||||
@Component
|
||||
public class JwtAccessDeniedHandler implements AccessDeniedHandler {
|
||||
|
@@ -11,7 +11,7 @@ import com.bio.bio_backend.domain.user.member.dto.LoginRequestDto;
|
||||
import com.bio.bio_backend.domain.user.member.dto.LoginResponseDto;
|
||||
import com.bio.bio_backend.domain.user.member.dto.MemberDto;
|
||||
import com.bio.bio_backend.domain.user.member.service.MemberService;
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.utils.JwtUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
@@ -20,7 +20,6 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.AuthenticationServiceException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
@@ -31,7 +30,6 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@@ -1,10 +1,8 @@
|
||||
package com.bio.bio_backend.global.security;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
@@ -22,7 +20,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import com.bio.bio_backend.global.dto.ApiResponseDto;
|
||||
import com.bio.bio_backend.domain.user.member.service.MemberService;
|
||||
import com.bio.bio_backend.global.utils.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.constants.ApiResponseCode;
|
||||
import com.bio.bio_backend.global.utils.JwtUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
Reference in New Issue
Block a user