fix: api rate limit

This commit is contained in:
Krispire Admin
2026-06-21 21:20:30 +05:30
parent d52530c52c
commit fe0bee4ce7
3 changed files with 100 additions and 1 deletions
+27
View File
@@ -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) {