Revert "revert 99397e774c41980ef13b3155e13330ad4eaa7753"

This reverts commit b63e3ae77f.
This commit is contained in:
2025-05-12 09:18:45 +02:00
parent bb89a84ba8
commit 551cf2e2cb
10 changed files with 293 additions and 40 deletions
+22
View File
@@ -0,0 +1,22 @@
import { NextResponse } from "next/server";
import { db } from "~/server/db";
export async function POST(req: Request) {
try {
const { fileId, isPublic } = await req.json();
if (!fileId) {
return NextResponse.json({ error: "File ID is required" }, { status: 400 });
}
await db.file.update({
where: { id: fileId },
data: { public: isPublic },
});
return NextResponse.json({ success: true });
} catch (error) {
console.error("Error updating public status:", error);
return NextResponse.json({ error: "Failed to update public status" }, { status: 500 });
}
}