"use server"; import { requireAdmin } from "@/lib/auth/auth"; import { db } from "@/db"; import { videoUploadJobs, videoUploads } from "@/db/schema"; import { eq } from "drizzle-orm"; import { revalidatePath } from "next/cache"; export async function createVideoUpload(formData: FormData) { const discordId = await requireAdmin(); const { saveVideoUpload } = await import("@/lib/video/video-upload-storage"); const id = await saveVideoUpload(formData, discordId); revalidatePath("/admin/upload/history"); return { id }; } export async function retryVideoJob(jobId: string) { await requireAdmin(); const job = await db.query.videoUploadJobs.findFirst({ where: (table, { eq }) => eq(table.id, jobId), }); if (!job) return; await db .update(videoUploadJobs) .set({ status: "pending", error: null }) .where(eq(videoUploadJobs.id, job.id)); await db .update(videoUploads) .set({ status: "partial", updatedAt: new Date() }) .where(eq(videoUploads.id, job.uploadId)); revalidatePath("/admin/upload/history"); }