import type { Review } from '@/types/nostr' import { objectCache } from './objectCache' export async function getReviewsForArticle(articleId: string, _timeoutMs: number = 5000): Promise { // Read only from IndexedDB cache const allReviews = await objectCache.getAll('review') const reviews = allReviews as Review[] // Filter by articleId const articleReviews = reviews.filter((review) => review.articleId === articleId) // Sort by creation date descending return articleReviews.sort((a, b) => b.createdAt - a.createdAt) }