Add advanced menu on job to allow user to do things like make a job as stopped if the status ever gets hung

This commit is contained in:
Jaret Burkett
2025-09-28 13:43:00 -06:00
parent 4e207d92cd
commit c20240be82
3 changed files with 73 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
import { NextRequest, NextResponse } from 'next/server';
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export async function GET(request: NextRequest, { params }: { params: { jobID: string } }) {
const { jobID } = await params;
const job = await prisma.job.findUnique({
where: { id: jobID },
});
// update job status to 'running'
await prisma.job.update({
where: { id: jobID },
data: {
stop: true,
status: 'stopped',
info: 'Job stopped',
},
});
console.log(`Job ${jobID} marked as stopped`);
return NextResponse.json(job);
}