feat: add task workflow and asset downloads
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
import { deleteAsset, deleteGenerationJob, getAsset, getGenerationJob } from "@/lib/server/data-store";
|
||||
import { jsonError, jsonOk } from "@/lib/server/api";
|
||||
import { requestOrigin } from "@/lib/server/runtime";
|
||||
import { syncImageJob } from "@/lib/server/generation-service";
|
||||
import { deleteStoredAsset } from "@/lib/server/storage";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function GET(request: Request, context: { params: Promise<{ id: string }> }) {
|
||||
export async function GET(_request: Request, context: { params: Promise<{ id: string }> }) {
|
||||
try {
|
||||
const { id } = await context.params;
|
||||
const existing = await getGenerationJob(id);
|
||||
if (!existing) return jsonError(new Error("Generation job not found."), 404);
|
||||
const job = await syncImageJob(id, requestOrigin(request));
|
||||
const job = await getGenerationJob(id);
|
||||
if (!job) return jsonError(new Error("Generation job not found."), 404);
|
||||
return jsonOk({ job });
|
||||
} catch (error) {
|
||||
return jsonError(error, 500);
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { deleteAsset, deleteGenerationJob, getAsset, getGenerationJob } from "@/lib/server/data-store";
|
||||
import { jsonError, jsonOk } from "@/lib/server/api";
|
||||
import { requestOrigin } from "@/lib/server/runtime";
|
||||
import { syncVideoJob } from "@/lib/server/video-generation-service";
|
||||
import { deleteStoredAsset } from "@/lib/server/storage";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function GET(request: Request, context: { params: Promise<{ id: string }> }) {
|
||||
export async function GET(_request: Request, context: { params: Promise<{ id: string }> }) {
|
||||
try {
|
||||
const { id } = await context.params;
|
||||
const job = await syncVideoJob(id, requestOrigin(request));
|
||||
const job = await getGenerationJob(id);
|
||||
if (!job) return jsonError(new Error("Generation job not found."), 404);
|
||||
return jsonOk({ job });
|
||||
} catch (error) {
|
||||
return jsonError(error, 500);
|
||||
|
||||
Reference in New Issue
Block a user