fix(upload): correct tiktok creator request
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
"use server";
|
||||
|
||||
import { requireAdmin } from "@/lib/auth/auth";
|
||||
import { publishVideoJob } from "@/lib/video/video-platforms";
|
||||
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) {
|
||||
@@ -14,6 +16,17 @@ export async function createVideoUpload(formData: FormData) {
|
||||
|
||||
export async function retryVideoJob(jobId: string) {
|
||||
await requireAdmin();
|
||||
await publishVideoJob(jobId).catch(() => undefined);
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user