feat: add folloers/following list
This commit is contained in:
@@ -310,6 +310,25 @@ func (s *SocialGraphService) Counts(ctx context.Context, userID string) (followe
|
||||
return followers, following, nil
|
||||
}
|
||||
|
||||
// Followers / Following resolve the handle and return one page of the
|
||||
// profile's accepted followers (or followings), optionally filtered by a
|
||||
// name/handle search `q`, plus the total matching count for pagination.
|
||||
func (s *SocialGraphService) Followers(ctx context.Context, handle, q string, limit, offset int) ([]model.UserSummary, int, error) {
|
||||
u, err := s.users.FindByHandle(ctx, handle)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
return s.follows.ListFollowers(ctx, u.ID, q, limit, offset)
|
||||
}
|
||||
|
||||
func (s *SocialGraphService) Following(ctx context.Context, handle, q string, limit, offset int) ([]model.UserSummary, int, error) {
|
||||
u, err := s.users.FindByHandle(ctx, handle)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
return s.follows.ListFollowing(ctx, u.ID, q, limit, offset)
|
||||
}
|
||||
|
||||
// ProfileExtras is the read used by the public-profile endpoint: the
|
||||
// target's follower/following counts plus, when a non-owner viewer is
|
||||
// signed in, their relationship to the target. rel is nil for anonymous
|
||||
|
||||
Reference in New Issue
Block a user