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

[TI-67] 공통 응답용 API 추가 #3

Merged
merged 4 commits into from
Oct 27, 2021
Merged

[TI-67] 공통 응답용 API 추가 #3

merged 4 commits into from
Oct 27, 2021

Conversation

HwiNyeonKim
Copy link
Collaborator

@HwiNyeonKim HwiNyeonKim commented Oct 27, 2021

공통 응답용 API

  • 현재 결정된 API 응답 포맷
{
  "common": {
		"message": "success",
		"requestUri": "/v1/users",
		"timestamp": "20211021212822",
		"internalHttpStatusCode": 200
  },
  "data": []
}

public class CommonData {
private final String message;
private final String requestUri;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMddHHmmss", timezone = "Asia/Seoul")
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jsonformat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMddHHmmss") 로 하면 timezone utc가 디폴트로 알고있습니다! timezone 정책에 대해서 다 같이 이야기 나눠보면 좋겠습니다!

Copy link
Collaborator

Choose a reason for hiding this comment

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

저도 utc 타임존으로 하는게 어떤가 생각합니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

timezone을 넣어주나 빼주나 결과값이 같습니다.
나중에 한 번 다시 화인을 해 볼 필요가 있어 보입니다.


@Getter
public class CommonData {
private final String message;
Copy link
Collaborator

Choose a reason for hiding this comment

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

필드 사이 개행 넣어주면 좋을 것 같습니다!

Comment on lines 24 to 26
public static <T> ApiResponse<T> fail(String failMessage, String requestUri, T data, Integer statusCode) {
CommonData common = new CommonData(failMessage, requestUri, statusCode);
return new ApiResponse<>(common, data);
Copy link
Collaborator

Choose a reason for hiding this comment

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

statusCode에 Integer 대신에 HttpStatus enum을 사용해 보는건 어떤가요???

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

확실히 그 편이 더 좋아보입니다.

  • 실제 응답에서 숫자로 나가는지 문자로 나가는지 한 번 확인 해 볼 필요가 있음 -> 문자로 나옴 -> 숫자로 나오도록 수정 (티켓 작성됨)

@HwiNyeonKim HwiNyeonKim merged commit e01f4ef into develop Oct 27, 2021
@sangmin7648 sangmin7648 added the 1차 스프린트 뀨팀 1차 스프린트 label Oct 27, 2021
@sangmin7648 sangmin7648 deleted the Feature/TI-67 branch November 1, 2021 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1차 스프린트 뀨팀 1차 스프린트
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants