Skip to content

Commit

Permalink
[CHORE] AuthResponse 네이밍 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Chan531 committed Aug 13, 2024
1 parent cd1cda8 commit e53b688
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static com.tiki.server.auth.message.ErrorCode.*;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.tiki.server.common.dto.AuthResponse;
import com.tiki.server.common.dto.ErrorCodeResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -40,6 +40,6 @@ private void setResponse(HttpServletResponse response) throws IOException {
response.setStatus(HttpStatus.UNAUTHORIZED.value());
val writer = response.getWriter();
writer.write(objectMapper.writeValueAsString(
AuthResponse.of(UNAUTHENTICATED.getCode(), UNAUTHENTICATED.getMessage())));
ErrorCodeResponse.of(UNAUTHENTICATED.getCode(), UNAUTHENTICATED.getMessage())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.tiki.server.auth.exception.AuthException;
import com.tiki.server.auth.message.ErrorCode;
import com.tiki.server.common.dto.AuthResponse;
import com.tiki.server.common.dto.ErrorCodeResponse;
import jakarta.servlet.FilterChain;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -49,6 +49,6 @@ private void setResponse(HttpServletResponse response, ErrorCode errorCode)
response.setCharacterEncoding("UTF-8");
response.setStatus(errorCode.getHttpStatus().value());
val writer = response.getWriter();
writer.write(objectMapper.writeValueAsString(AuthResponse.of(errorCode.getCode(), errorCode.getMessage())));
writer.write(objectMapper.writeValueAsString(ErrorCodeResponse.of(errorCode.getCode(), errorCode.getMessage())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import lombok.NonNull;

@Builder(access = PRIVATE)
public record AuthResponse(
public record ErrorCodeResponse(
boolean success,
int code,
@NonNull String message
) implements BaseResponse {

public static AuthResponse of(int code, String message) {
return AuthResponse.builder()
public static ErrorCodeResponse of(int code, String message) {
return ErrorCodeResponse.builder()
.success(false)
.code(code)
.message(message)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.tiki.server.common.handler;

import com.tiki.server.auth.exception.AuthException;
import com.tiki.server.common.dto.AuthResponse;
import com.tiki.server.common.dto.ErrorCodeResponse;
import com.tiki.server.mail.exception.MailException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
Expand Down Expand Up @@ -79,7 +79,7 @@ public ResponseEntity<BaseResponse> AuthException(AuthException exception) {
log.error(exception.getMessage());
val errorCode = exception.getErrorCode();
return ResponseEntity.status(errorCode.getHttpStatus()).body(
AuthResponse.of(errorCode.getCode(), errorCode.getMessage()));
ErrorCodeResponse.of(errorCode.getCode(), errorCode.getMessage()));
}

@ExceptionHandler(Exception.class)
Expand Down

0 comments on commit e53b688

Please sign in to comment.