diff --git a/app/api/cron/route.ts b/app/api/cron/route.ts index cf8fdd8..16db91b 100644 --- a/app/api/cron/route.ts +++ b/app/api/cron/route.ts @@ -39,7 +39,7 @@ export async function GET(request: Request) { } }); - const news = await Promise.all(newsPromises); + await Promise.all(newsPromises); const users = await prisma.user.findMany({ where: { @@ -57,6 +57,14 @@ export async function GET(request: Request) { }); } + const news = await prisma.news.findMany({ + where: { + createdAt: { + gt: new Date(Date.now() - 1000 * 60 * 60) + } + } + }); + const validRankedNews = news .filter((item): item is z.infer => item !== undefined) .sort((a, b) => b.score - a.score);