Add ability to trigger a save from the ui which whill make the trainer save on the next step
This commit is contained in:
19
ui/src/app/api/jobs/[jobID]/save_now/route.ts
Normal file
19
ui/src/app/api/jobs/[jobID]/save_now/route.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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.update({
|
||||
where: { id: jobID },
|
||||
data: {
|
||||
save_now: true,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`Job ${jobID} marked to save on next step`);
|
||||
|
||||
return NextResponse.json(job);
|
||||
}
|
||||
Reference in New Issue
Block a user