feat: add admin accounts and image templates
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { getGenerationJob } from "@/lib/server/data-store";
|
||||
import { jsonError, jsonOk } from "@/lib/server/api";
|
||||
import { authenticatePublicApiRequest } from "@/lib/server/public-api-auth";
|
||||
import { authenticatePublicApiRequest, publicApiOwnerId } from "@/lib/server/public-api-auth";
|
||||
import { publicApiError } from "@/lib/server/public-api-response";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
@@ -10,7 +10,9 @@ export async function GET(request: Request, context: { params: Promise<{ id: str
|
||||
const client = authenticatePublicApiRequest(request);
|
||||
const { id } = await context.params;
|
||||
const job = await getGenerationJob(id);
|
||||
if (!job || job.externalClientId !== client.id) return jsonError("Job not found.", 404);
|
||||
if (!job || job.ownerId !== publicApiOwnerId(client) || job.externalClientId !== client.id) {
|
||||
return jsonError("Job not found.", 404);
|
||||
}
|
||||
return jsonOk({ job });
|
||||
} catch (error) {
|
||||
return publicApiError(error);
|
||||
|
||||
Reference in New Issue
Block a user