import { NextRequest, NextResponse } from 'next/server'; const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'; export async function GET( request: NextRequest, { params }: { params: Promise<{ jobId: string }> } ) { try { const { jobId } = await params; const response = await fetch(`${API_BASE_URL}/jobs/${jobId}`); const data = await response.json(); if (!response.ok) { return NextResponse.json( { error: data.detail || 'Job not found' }, { status: response.status } ); } return NextResponse.json(data); } catch (error) { console.error('Job status API error:', error); return NextResponse.json( { error: 'Failed to get job status' }, { status: 500 } ); } } export async function DELETE( request: NextRequest, { params }: { params: Promise<{ jobId: string }> } ) { try { const { jobId } = await params; const response = await fetch(`${API_BASE_URL}/jobs/${jobId}`, { method: 'DELETE', }); if (!response.ok) { const data = await response.json(); return NextResponse.json( { error: data.detail || 'Failed to delete job' }, { status: response.status } ); } return NextResponse.json({ success: true, message: 'Job deleted successfully' }); } catch (error) { console.error('Delete job API error:', error); return NextResponse.json( { error: 'Failed to delete job' }, { status: 500 } ); } }