From baab0352d59e79bc24501a42dd3ed198c10e7466 Mon Sep 17 00:00:00 2001 From: sohot8653 Date: Thu, 14 Aug 2025 17:19:52 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=83=81=EC=88=98=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81]=20ApiResponseCode=EB=A5=BC=20global.constan?= =?UTF-8?q?ts=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?=ED=95=98=EA=B3=A0,=20=EA=B4=80=EB=A0=A8=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=20ApiResponseCode=20=EC=B0=B8=EC=A1=B0?= =?UTF-8?q?=EB=A5=BC=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=EC=BD=94=EB=93=9C=20=EC=9D=BC=EA=B4=80=EC=84=B1=20?= =?UTF-8?q?=EB=B0=8F=20=EA=B0=80=EB=8F=85=EC=84=B1=20=ED=96=A5=EC=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/member/controller/MemberController.java | 4 ++-- .../member/exception/UserDuplicateException.java | 12 ------------ .../user/member/service/MemberServiceImpl.java | 3 +-- .../global/{utils => constants}/ApiResponseCode.java | 2 +- .../bio/bio_backend/global/dto/ApiResponseDto.java | 2 +- .../bio_backend/global/exception/ApiException.java | 2 +- .../CustomAuthenticationFailureHandler.java | 2 +- .../global/exception/GlobalExceptionHandler.java | 2 +- .../global/exception/JwtAccessDeniedHandler.java | 2 +- .../global/security/JwtAuthenticationFilter.java | 4 +--- .../bio_backend/global/security/JwtTokenFilter.java | 4 +--- 11 files changed, 11 insertions(+), 28 deletions(-) delete mode 100644 src/main/java/com/bio/bio_backend/domain/user/member/exception/UserDuplicateException.java rename src/main/java/com/bio/bio_backend/global/{utils => constants}/ApiResponseCode.java (98%) diff --git a/src/main/java/com/bio/bio_backend/domain/user/member/controller/MemberController.java b/src/main/java/com/bio/bio_backend/domain/user/member/controller/MemberController.java index e1fd8e3..7c6efb1 100644 --- a/src/main/java/com/bio/bio_backend/domain/user/member/controller/MemberController.java +++ b/src/main/java/com/bio/bio_backend/domain/user/member/controller/MemberController.java @@ -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> createMember(@RequestBody @Valid CreateMemberRequestDto requestDto) { MemberDto member = memberMapper.toMemberDto(requestDto); MemberDto createdMember = memberService.createMember(member); diff --git a/src/main/java/com/bio/bio_backend/domain/user/member/exception/UserDuplicateException.java b/src/main/java/com/bio/bio_backend/domain/user/member/exception/UserDuplicateException.java deleted file mode 100644 index c399d48..0000000 --- a/src/main/java/com/bio/bio_backend/domain/user/member/exception/UserDuplicateException.java +++ /dev/null @@ -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); - } -} diff --git a/src/main/java/com/bio/bio_backend/domain/user/member/service/MemberServiceImpl.java b/src/main/java/com/bio/bio_backend/domain/user/member/service/MemberServiceImpl.java index b40f0f4..673566f 100644 --- a/src/main/java/com/bio/bio_backend/domain/user/member/service/MemberServiceImpl.java +++ b/src/main/java/com/bio/bio_backend/domain/user/member/service/MemberServiceImpl.java @@ -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; diff --git a/src/main/java/com/bio/bio_backend/global/utils/ApiResponseCode.java b/src/main/java/com/bio/bio_backend/global/constants/ApiResponseCode.java similarity index 98% rename from src/main/java/com/bio/bio_backend/global/utils/ApiResponseCode.java rename to src/main/java/com/bio/bio_backend/global/constants/ApiResponseCode.java index beb0035..be3c7b0 100644 --- a/src/main/java/com/bio/bio_backend/global/utils/ApiResponseCode.java +++ b/src/main/java/com/bio/bio_backend/global/constants/ApiResponseCode.java @@ -1,4 +1,4 @@ -package com.bio.bio_backend.global.utils; +package com.bio.bio_backend.global.constants; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/com/bio/bio_backend/global/dto/ApiResponseDto.java b/src/main/java/com/bio/bio_backend/global/dto/ApiResponseDto.java index 1d8e071..baebd96 100644 --- a/src/main/java/com/bio/bio_backend/global/dto/ApiResponseDto.java +++ b/src/main/java/com/bio/bio_backend/global/dto/ApiResponseDto.java @@ -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; diff --git a/src/main/java/com/bio/bio_backend/global/exception/ApiException.java b/src/main/java/com/bio/bio_backend/global/exception/ApiException.java index d339468..c352375 100644 --- a/src/main/java/com/bio/bio_backend/global/exception/ApiException.java +++ b/src/main/java/com/bio/bio_backend/global/exception/ApiException.java @@ -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 { diff --git a/src/main/java/com/bio/bio_backend/global/exception/CustomAuthenticationFailureHandler.java b/src/main/java/com/bio/bio_backend/global/exception/CustomAuthenticationFailureHandler.java index 01c54f5..2cc9ceb 100644 --- a/src/main/java/com/bio/bio_backend/global/exception/CustomAuthenticationFailureHandler.java +++ b/src/main/java/com/bio/bio_backend/global/exception/CustomAuthenticationFailureHandler.java @@ -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; diff --git a/src/main/java/com/bio/bio_backend/global/exception/GlobalExceptionHandler.java b/src/main/java/com/bio/bio_backend/global/exception/GlobalExceptionHandler.java index 9707760..5cc592e 100644 --- a/src/main/java/com/bio/bio_backend/global/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/bio/bio_backend/global/exception/GlobalExceptionHandler.java @@ -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; diff --git a/src/main/java/com/bio/bio_backend/global/exception/JwtAccessDeniedHandler.java b/src/main/java/com/bio/bio_backend/global/exception/JwtAccessDeniedHandler.java index bcb1a23..3056d84 100644 --- a/src/main/java/com/bio/bio_backend/global/exception/JwtAccessDeniedHandler.java +++ b/src/main/java/com/bio/bio_backend/global/exception/JwtAccessDeniedHandler.java @@ -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 { diff --git a/src/main/java/com/bio/bio_backend/global/security/JwtAuthenticationFilter.java b/src/main/java/com/bio/bio_backend/global/security/JwtAuthenticationFilter.java index 9a5caab..631bf5c 100644 --- a/src/main/java/com/bio/bio_backend/global/security/JwtAuthenticationFilter.java +++ b/src/main/java/com/bio/bio_backend/global/security/JwtAuthenticationFilter.java @@ -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; diff --git a/src/main/java/com/bio/bio_backend/global/security/JwtTokenFilter.java b/src/main/java/com/bio/bio_backend/global/security/JwtTokenFilter.java index 92afe3b..5680d36 100644 --- a/src/main/java/com/bio/bio_backend/global/security/JwtTokenFilter.java +++ b/src/main/java/com/bio/bio_backend/global/security/JwtTokenFilter.java @@ -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;