Skip to content

Commit f80c567

Browse files
committed
feat: add temporary debug route to inspect database state
1 parent 376141f commit f80c567

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

app/api/debug/route.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { NextResponse } from "next/server";
2+
import { PrismaClient } from "@prisma/client";
3+
4+
const prisma = new PrismaClient();
5+
6+
export async function GET() {
7+
try {
8+
const events = await prisma.event.findMany({
9+
include: {
10+
savedBy: {
11+
include: {
12+
user: {
13+
include: {
14+
pushSubscriptions: true
15+
}
16+
}
17+
}
18+
}
19+
},
20+
orderBy: { createdAt: 'desc' },
21+
take: 5
22+
});
23+
24+
const users = await prisma.user.findMany({
25+
include: {
26+
pushSubscriptions: true
27+
},
28+
take: 5
29+
});
30+
31+
return NextResponse.json({
32+
serverTime: new Date().toISOString(),
33+
recentEvents: events,
34+
recentUsers: users,
35+
envVars: {
36+
hasVapidPublic: !!process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY,
37+
hasVapidPrivate: !!process.env.VAPID_PRIVATE_KEY,
38+
vapidSubject: process.env.VAPID_SUBJECT,
39+
}
40+
});
41+
} catch (error: any) {
42+
return NextResponse.json({ error: error.message }, { status: 500 });
43+
}
44+
}

0 commit comments

Comments
 (0)