import { NextRequest, NextResponse } from 'next/server'; import { getDefaultLimits, updateDefaultLimits } from '@/lib/firestore'; export async function GET(request: NextRequest) { try { // TODO: Get userId from auth token const userId = 'test-user-id'; // Replace with actual auth const limits = await getDefaultLimits(userId); return NextResponse.json({ limits }); } catch (error) { console.error('Error fetching credit limits:', error); return NextResponse.json({ error: 'Failed to fetch limits' }, { status: 500 }); } } export async function PUT(request: NextRequest) { try { const body = await request.json(); // TODO: Get userId from auth token const userId = 'test-user-id'; // Replace with actual auth await updateDefaultLimits(userId, body); const limits = await getDefaultLimits(userId); return NextResponse.json({ limits }); } catch (error) { console.error('Error updating credit limits:', error); return NextResponse.json({ error: 'Failed to update limits' }, { status: 500 }); } }