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

API Response 페이지네이션 totalElements 반환 방식 논의 #113

Closed
ParkJeongseop opened this issue Oct 9, 2023 · 3 comments · Fixed by #124
Closed

API Response 페이지네이션 totalElements 반환 방식 논의 #113

ParkJeongseop opened this issue Oct 9, 2023 · 3 comments · Fixed by #124
Assignees
Labels
enhancement New feature or request major Major topic

Comments

@ParkJeongseop
Copy link
Collaborator

Description

페이지네이션 구현과 관련하여 현재 전체 데이터 건수를 totalElements ResponseDto에 별도로 추가하여 구현되어있습니다.
이부분을 아래 두 방식중에 어떤 방식을 사용하는 것이 일관적이고 좋을지 논의 필요.

Best Practice나 참고 링크가 첨부되면 더 좋습니다.

{
     "totalElements": 10,
     "data": []
}
{
    "data": {
        "list": [],
        "totalElements": 10
    } 
}

To do

Test Checklist

@junha-ahn
Copy link
Member

kakao api docs 등의 레퍼런스를 참고하면 좋을것 같습니다.

해당 이슈는 #99 에도 의존성이 좀 있죠 (totalCount 자체를 없앨 수도…)

@junha-ahn
Copy link
Member

junha-ahn commented Oct 11, 2023

Data와 별도로 키를 구성하네요.

저희는 totalCount라는 키를 그대로 사용했는데, meta 또는 pagination이라는 키로 한번 더 묶는게 좋아보이네요. (개인적으로는 pagination key가 더 마음에듭니다. meta는 너무 일반적인 이름의 느낌이 있네요)

image

카카오

image

쿠팡

@junha-ahn
Copy link
Member

junha-ahn commented Oct 11, 2023

설계상 (프론트엔드가 존재한다면) 무한스크롤을 가정했기 때문에, COUNT 쿼리를 제거함으로 Slow Query를 제거한다

#135댓글에 따라 totalCount를 리스트 조회 endpoint에서는 노출하지 않겠습니다.

COUNT 쿼리 제거해주세요. (Pagenation은 없앨 필요 X)

  • events, reservations, bookmarks 모두 적용

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major Major topic
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants