This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { auth } from "@/auth";
|
||||
import { db } from "@/lib/db";
|
||||
import { uploadFile } from "@/lib/storage";
|
||||
import { uploadToHetzner } from "@/lib/storage";
|
||||
|
||||
function requireAuth(role: string) {
|
||||
return ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(role);
|
||||
@@ -58,7 +58,8 @@ export async function POST(
|
||||
return NextResponse.json({ error: "File too large (max 50 MB)" }, { status: 413 });
|
||||
|
||||
const buffer = Buffer.from(await file.arrayBuffer());
|
||||
const uploaded = await uploadFile(buffer, file.name, file.type, "image");
|
||||
const { key: refKey } = await uploadToHetzner(buffer, file.name, file.type, "image");
|
||||
const uploaded = { url: `/api/files/${refKey}`, key: refKey };
|
||||
|
||||
const maxOrder = await db.shotReference.aggregate({
|
||||
where: { shotId },
|
||||
|
||||
Reference in New Issue
Block a user