Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: API 공통 핸들러 추가 #17

Merged
merged 5 commits into from
Jul 23, 2024
Merged

Conversation

Jaewon-pro
Copy link
Member

🔗 이슈 연결

🚀 구현한 API

  • X

💡 반영할 내용 및 변경 사항 요약

  • 데일리 스크럼에서 결정된 API 반환 형식으로 반환하도록 설정합니다.

전체적인 개요

{
  "success": Bool,
  "data": { // 데이터가 없는 경우에는 "data": {}
  },
  "error":  { // 에러 발생시 아래 필드는 필수
    "statusCode": 000
    "code": "...",
    "message": ",,,"
  }
}

success true case

  • 성공인 경우, error 필드는 없앨 수 있다면 없도록 직렬화 합니다.
{
  "success": true,
  "data": {} // 보낼 데이터가 없는 경우라도 무조건 "data" 필드 보내기
}

스크린샷 2024-07-23 오후 9 12 08

success false case

{
  "success": false,
  "error": {
    "statusCode": 400,
    "code": "AUTH_001",
    "message": "token is invalid 또는 token is empty.." // 디버깅 용도, 사용자 X
  }
}

스크린샷 2024-07-23 오후 9 11 30

🔍 리뷰 요청/참고 사항

  • 새로운 에러 형식이 필요하다면, ErrorType enum 클래스에 추가하시면 좋을 것 같아요!

@Jaewon-pro Jaewon-pro added documentation Improvements or additions to documentation feature labels Jul 23, 2024
@Jaewon-pro Jaewon-pro self-assigned this Jul 23, 2024
@Jaewon-pro Jaewon-pro requested a review from hee9841 July 23, 2024 12:17
@Jaewon-pro
Copy link
Member Author

null인 응답도 ApiReponse로 감싸서 처리하는 부분을 추가했습니다.

스크린샷 2024-07-23 오후 10 45 51

Copy link
Collaborator

@hee9841 hee9841 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 👍

@Jaewon-pro Jaewon-pro merged commit e648714 into main Jul 23, 2024
1 check passed
@Jaewon-pro Jaewon-pro deleted the feature/#15/api-response branch July 23, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API 응답 성공/예외 발생 처리 핸들러 필요
2 participants