diff --git a/infra/api/src/index.ts b/infra/api/src/index.ts index 9b31fe3..37d4679 100644 --- a/infra/api/src/index.ts +++ b/infra/api/src/index.ts @@ -673,7 +673,7 @@ async function fanInExistingPosts(readerDid: string, authorDid: string, publicat const postRkey = (post.SK as string).slice('p#'.length); const item: Record = { PK: `u#${readerDid}#timeline`, - SK: `${new Date(Math.min(new Date(post.publishedAt as string).getTime(), Date.now())).toISOString()}#${postRkey}`, + SK: `${(post.GSI1SK as string | undefined)?.split('#')[0] ?? new Date(Math.min(new Date(post.publishedAt as string).getTime(), Date.now())).toISOString()}#${postRkey}`, entityType: 'timeline-item', authorDid, rkey: postRkey, diff --git a/infra/backfill/src/index.ts b/infra/backfill/src/index.ts index 9124716..6b3c119 100644 --- a/infra/backfill/src/index.ts +++ b/infra/backfill/src/index.ts @@ -231,7 +231,7 @@ async function fanInExistingPosts( const postRkey = (post.SK as string).slice('p#'.length) const item: Record = { PK: `u#${readerDid}#timeline`, - SK: `${new Date(Math.min(new Date(post.publishedAt as string).getTime(), Date.now())).toISOString()}#${postRkey}`, + SK: `${(post.GSI1SK as string | undefined)?.split('#')[0] ?? new Date(Math.min(new Date(post.publishedAt as string).getTime(), Date.now())).toISOString()}#${postRkey}`, entityType: 'timeline-item', authorDid, rkey: postRkey, diff --git a/infra/indexer/src/index.ts b/infra/indexer/src/index.ts index f7f9c84..939037c 100644 --- a/infra/indexer/src/index.ts +++ b/infra/indexer/src/index.ts @@ -357,7 +357,7 @@ async function fanInExistingPosts(readerDid: string, authorDid: string, publicat const postRkey = (post.SK as string).slice('p#'.length) const item: Record = { PK: `u#${readerDid}#timeline`, - SK: `${new Date(Math.min(new Date(post.publishedAt as string).getTime(), Date.now())).toISOString()}#${postRkey}`, + SK: `${(post.GSI1SK as string | undefined)?.split('#')[0] ?? new Date(Math.min(new Date(post.publishedAt as string).getTime(), Date.now())).toISOString()}#${postRkey}`, entityType: 'timeline-item', authorDid, rkey: postRkey,