fix: api rate limit
This commit is contained in:
@@ -444,6 +444,33 @@ func (s *PostService) ListMine(ctx context.Context, userID string, limit, offset
|
||||
return posts, total, nil
|
||||
}
|
||||
|
||||
// ListMineKeyset is the owner's scroll feed via keyset pagination (posts older
|
||||
// than the cursor, newest-first). Same hydration as ListMine; no total.
|
||||
func (s *PostService) ListMineKeyset(ctx context.Context, userID string, beforeAt time.Time, beforeID string, limit int) ([]model.Post, error) {
|
||||
if limit <= 0 || limit > 50 {
|
||||
limit = 20
|
||||
}
|
||||
posts, err := s.posts.ListByUserKeyset(ctx, userID, beforeAt, beforeID, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i := range posts {
|
||||
if posts[i].ResharedFromPostID != nil {
|
||||
posts[i].ViewerHasReshared = true
|
||||
}
|
||||
}
|
||||
if err := s.hydrateLikesSlice(ctx, userID, posts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := s.hydrateMentionsSlice(ctx, posts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := s.hydratePinnedSlice(ctx, userID, posts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
// ListHidden is the owner's "Hidden" tab — their hidden posts only, hydrated
|
||||
// like ListMine so the cards render fully and the menu offers Unhide.
|
||||
func (s *PostService) ListHidden(ctx context.Context, userID string, limit, offset int) ([]model.Post, int, error) {
|
||||
|
||||
Reference in New Issue
Block a user