import "server-only";

import { prisma } from "@/lib/db";
import type { JobProgressDetail } from "./types";

export async function updateJobProgress(jobId: string, detail: JobProgressDetail) {
  await prisma.backgroundJob.update({
    where: { id: jobId },
    data: {
      progress: detail.summary,
      progressDetail: JSON.stringify(detail),
    },
  });
}