Skip to content

Commit

Permalink
use keyset for ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Sep 13, 2023
1 parent 58016e1 commit 80ee697
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/bsky/src/api/app/bsky/feed/getActorLikes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sql } from 'kysely'
import { InvalidRequestError } from '@atproto/xrpc-server'
import { Server } from '../../../../lexicon'
import { QueryParams } from '../../../../lexicon/types/app/bsky/feed/getActorLikes'
Expand Down Expand Up @@ -70,10 +71,10 @@ const skeleton = async (
let feedItemsQb = feedService
.selectFeedItemQb()
.innerJoin('like', 'like.subject', 'feed_item.uri')
.select(sql`coalesce("like"."indexedAt", "feed_item"."sortAt")`.as('sortAt'))
.where('like.creator', '=', actorDid)
.orderBy('like.indexedAt', 'desc')

const keyset = new FeedKeyset(ref('feed_item.sortAt'), ref('feed_item.cid'))
const keyset = new FeedKeyset(ref('like.sortAt'), ref('feed_item.cid'))

feedItemsQb = paginate(feedItemsQb, {
limit,
Expand Down

0 comments on commit 80ee697

Please sign in to comment.