This commit is contained in:
2026-01-22 19:31:05 +01:00
parent 1251584b13
commit 3682673852
7 changed files with 161 additions and 61 deletions

View File

@@ -63,7 +63,6 @@ export async function POST(request: NextRequest) {
}
const userId = cookies().get('userId')?.value;
console.log('POST /api/qrs - userId from cookie:', userId);
// Rate Limiting (user-based)
const clientId = userId || getClientIdentifier(request);
@@ -90,20 +89,16 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ error: 'Unauthorized - no userId cookie' }, { status: 401 });
}
// Check if user exists and get their plan
const user = await db.user.findUnique({
where: { id: userId },
select: { plan: true },
});
console.log('User exists:', !!user);
if (!user) {
return NextResponse.json({ error: `User not found: ${userId}` }, { status: 404 });
}
const body = await request.json();
console.log('Request body:', body);
// Validate request body with Zod (only for non-static QRs or simplified validation)
// Note: Static QRs have complex nested content structure, so we do basic validation