feat: add daily challenge and blitz mode (2min speedrun)

This commit is contained in:
jessy-david-dev
2026-04-10 21:41:49 +02:00
parent 8c18984121
commit dc12abf796
21 changed files with 4035 additions and 12 deletions
+23
View File
@@ -0,0 +1,23 @@
import { NextResponse } from "next/server";
import { prisma } from "../../../../lib/prisma";
export async function GET() {
const date = new Date().toISOString().slice(0, 10);
const puzzle = await prisma.dailyPuzzle.findUnique({ where: { date } });
if (!puzzle) return NextResponse.json([]);
const results = await prisma.dailyResult.findMany({
where: { puzzleId: puzzle.id, won: true },
include: { user: { select: { name: true } } },
orderBy: [{ clicks: "asc" }, { timeSeconds: "asc" }],
take: 20,
});
return NextResponse.json(results.map((r, i) => ({
rank: i + 1,
name: r.user.name,
clicks: r.clicks,
timeSeconds: r.timeSeconds,
userId: r.userId,
})));
}