Skip to content

✨️feat: 공통 응답 재수정[#34]#39

Merged
LimdaeIl merged 1 commit intomainfrom
feat/response
Dec 8, 2025
Merged

✨️feat: 공통 응답 재수정[#34]#39
LimdaeIl merged 1 commit intomainfrom
feat/response

Conversation

@LimdaeIl
Copy link
Collaborator

@LimdaeIl LimdaeIl commented Dec 8, 2025

📝 Pull Request

📌 PR 종류

해당하는 항목에 체크해주세요.

  • 기능 추가 (Feature)
  • 버그 수정 (Fix)
  • 문서 수정 (Docs)
  • 코드 리팩터링 (Refactor)
  • 테스트 추가 (Test)
  • 기타 변경 (Chore)

✨ 변경 내용

success: {boolean}
data: {}

형식으로 수정합니다.

🔍 관련 이슈

🧪 테스트

변경된 기능에 대한 테스트 범위 또는 테스트 결과를 작성해주세요.

  • 유닛 테스트 추가 / 수정
  • 통합 테스트 검증
  • 수동 테스트 완료

🚨 확인해야 할 사항 (Checklist)

PR을 제출하기 전에 아래 항목들을 확인해주세요.

  • 코드 포매팅 완료
  • 불필요한 파일/코드 제거
  • 로직 검증 완료
  • 프로젝트 빌드 성공
  • 린트/정적 분석 통과 (해당 시)

🙋 기타 참고 사항

리뷰어가 참고하면 좋을 만한 추가 설명이 있다면 적어주세요.

Summary by CodeRabbit

릴리스 노트

  • 리팩토링
    • API 응답 처리 방식이 개선되었습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@LimdaeIl LimdaeIl self-assigned this Dec 8, 2025
Copilot AI review requested due to automatic review settings December 8, 2025 09:56
@LimdaeIl LimdaeIl added the ✨enhancement New feature or request label Dec 8, 2025
@LimdaeIl LimdaeIl moved this from Backlog to In progress in WeGo-Together Backend Dec 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

ApiResponse 클래스의 주요 생성자가 String message 기반에서 boolean success 기반으로 변경되었으며, 모든 팩토리 메서드가 이에 맞게 업데이트되었습니다. 새로운 success/error 오버로드가 추가되어 boolean 플래그를 사용한 응답 상태 표시를 지원합니다.

Changes

Cohort / File(s) 변경 요약
ApiResponse 생성자 및 팩토리 메서드 리팩토링
src/main/java/team/wego/wegobackend/common/response/ApiResponse.java
주 생성자를 (String message, T data)에서 (boolean success, T data)로 변경. success(boolean isSuccess, T data)와 error(boolean isSuccess, T data) 메서드 신규 추가. 기존 success(T data), success(String message), error(String message) 메서드는 시그니처 유지하나 boolean 기반 구현으로 변경.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • 주의 사항:
    • 이 ApiResponse 클래스의 공개 API 변경으로 인해 전체 코드베이스에서 호출하는 모든 위치의 업데이트 확인 필요
    • 기존 success(String message, T data) 및 error(String message, T data) 호출부가 새로운 boolean 기반 오버로드로 마이그레이션되었는지 검증

Possibly related PRs

Poem

🐰 메시지야 안녕, boolean이 왔어!
참/거짓으로 간명하게 응답해,
true로 성공, false로 실패,
더 깔끔한 응답 객체 완성! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/response

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3e113c and 497f2c0.

📒 Files selected for processing (1)
  • src/main/java/team/wego/wegobackend/common/response/ApiResponse.java (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@LimdaeIl LimdaeIl merged commit 5a113f5 into main Dec 8, 2025
4 of 5 checks passed
@LimdaeIl LimdaeIl deleted the feat/response branch December 8, 2025 09:56
@github-project-automation github-project-automation bot moved this from In progress to Done in WeGo-Together Backend Dec 8, 2025
@LimdaeIl LimdaeIl linked an issue Dec 8, 2025 that may be closed by this pull request
3 tasks
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the ApiResponse class to change the response structure from {message, data} to {success, data}, replacing the String message field with a boolean success indicator.

Key Changes

  • Changed the ApiResponse record field from String message to boolean success
  • Updated all factory methods (success() and error()) to use boolean values instead of message strings
  • Modified method signatures to accommodate the new response format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to 18
public static <T> ApiResponse<T> success(boolean isSuccess, T data) {
return new ApiResponse<>(isSuccess, data);
}

Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success() method should not accept a boolean isSuccess parameter. A method named "success" should always set success to true. If you need to dynamically control the success value, consider creating a different factory method or using the constructor directly.

Suggested change
public static <T> ApiResponse<T> success(boolean isSuccess, T data) {
return new ApiResponse<>(isSuccess, data);
}

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +20
public static <T> ApiResponse<T> success(String message) {
return new ApiResponse<>(Boolean.TRUE, null);
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message parameter is accepted but not used. Since the response format no longer includes a message field (only success and data), this parameter should be removed from the method signature.

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +24
public static <T> ApiResponse<T> error(String message) {
return new ApiResponse<>(false, null);
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message parameter is accepted but not used. Since the response format no longer includes a message field (only success and data), this parameter should be removed from the method signature.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to 29
public static <T> ApiResponse<T> error(boolean isSuccess, T data) {
return new ApiResponse<>(isSuccess, data);
}
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error() method should not accept a boolean isSuccess parameter. A method named "error" should always set success to false. If you need to dynamically control the success value, consider creating a different factory method or using the constructor directly.

Suggested change
public static <T> ApiResponse<T> error(boolean isSuccess, T data) {
return new ApiResponse<>(isSuccess, data);
}

Copilot uses AI. Check for mistakes.

public static <T> ApiResponse<T> success(T data) {
return new ApiResponse<>( "요청이 정상적으로 처리되었습니다.", data);
return new ApiResponse<>(Boolean.TRUE, data);
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the primitive literal true instead of Boolean.TRUE. Since the field is a primitive boolean, using the boxed Boolean constant unnecessarily creates an object that will be immediately unboxed.

Copilot uses AI. Check for mistakes.
public static <T> ApiResponse<T> success( String message) {
return new ApiResponse<>( message, null);
public static <T> ApiResponse<T> success(String message) {
return new ApiResponse<>(Boolean.TRUE, null);
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the primitive literal true instead of Boolean.TRUE. Since the field is a primitive boolean, using the boxed Boolean constant unnecessarily creates an object that will be immediately unboxed.

Suggested change
return new ApiResponse<>(Boolean.TRUE, null);
return new ApiResponse<>(true, null);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEAT] 공통 응답 수정 [FEAT] 공통 응답 수정

1 participant