Skip to content

feat: 팔로우 API 개선 - followsMeBack 필드 추가 및 팔로워/팔로잉 목록 커서 페이지네이션 - #53

Merged
gummy000 merged 1 commit into
mainfrom
feature/follow-following
May 13, 2026
Merged

feat: 팔로우 API 개선 - followsMeBack 필드 추가 및 팔로워/팔로잉 목록 커서 페이지네이션#53
gummy000 merged 1 commit into
mainfrom
feature/follow-following

Conversation

@gummy000

Copy link
Copy Markdown
Member

Summary

  • GET /api/v1/users/{userId} 응답에 followsMeBack 필드 추가 — 상대가 나를 팔로우하는지 여부를 서버에서 계산
  • 팔로워/팔로잉 목록 4개 API에 커서 기반 페이지네이션 적용 (?cursor=<lastFollowId>&limit=20)
  • 공용 CursorPageResponse<T> DTO 신규 추가

Changed Files

파일 변경 내용
UserPublicProfileResponseDto followsMeBack: boolean 필드 추가
FollowService getPublicProfile() — 역방향 팔로우 조회 추가; getFollowers/getFollowings — 커서 페이지네이션으로 교체
FollowRepository findFollowersCursor, findFollowingsCursor 쿼리 추가
FollowController 4개 엔드포인트에 cursor, limit 쿼리 파라미터 추가
CursorPageResponse<T> 신규items, nextCursor, hasMore

API Spec Changes

GET /api/v1/users/{userId} 응답 필드 추가

{
  "followsMeBack": true
}
  • true: 상대가 나를 팔로우(ACCEPTED) 중
  • 비로그인 / 본인 조회 시 항상 false

② 팔로워/팔로잉 목록 4개 엔드포인트 페이지네이션

GET /api/v1/follows/followers?cursor=456&limit=20
GET /api/v1/follows/followings?cursor=456&limit=20
GET /api/v1/follows/{userId}/followers?cursor=456&limit=20
GET /api/v1/follows/{userId}/followings?cursor=456&limit=20
  • cursor 없으면 첫 페이지 (Long.MAX_VALUE 대체)
  • limit 기본값 20
{
  "items": [
    { "followId": 456, "userId": 12, "username": "hong", "nickname": "홍길동", "profileImageUrl": "..." }
  ],
  "nextCursor": "455",
  "hasMore": true
}
  • hasMore: false / nextCursor: null 이면 마지막 페이지

Test Plan

  • GET /api/v1/users/{userId} — 맞팔 유저 조회 시 followsMeBack: true 확인
  • GET /api/v1/users/{userId} — 단방향 팔로우 / 비로그인 시 followsMeBack: false 확인
  • 팔로워 목록 첫 페이지 (cursor 없음) 정상 반환 확인
  • nextCursor로 다음 페이지 연속 조회 확인
  • hasMore: false 시 마지막 페이지 처리 확인

🤖 Generated with Claude Code

- UserPublicProfileResponseDto에 followsMeBack(boolean) 필드 추가
  - 상대가 나를 팔로우(ACCEPTED)하는지 여부를 서버에서 직접 계산해 내려줌
  - 클라이언트에서 전체 팔로워 리스트를 받아 메모리에서 탐색하던 방식 제거
- GET /api/v1/follows/followers|followings, /{userId}/followers|followings 4개 엔드포인트에 커서 페이지네이션 적용
  - ?cursor=<lastFollowId>&limit=20 쿼리 파라미터
  - 응답: { items, nextCursor, hasMore }
  - followId 기준 내림차순(DESC), limit+1 조회로 hasMore 판별
  - CursorPageResponse<T> 공용 DTO 신규 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gummy000
gummy000 merged commit ea9a8ab into main May 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant