migration

This commit is contained in:
Théo LAGACHE
2025-05-16 15:54:17 +02:00
parent 01019fe1a3
commit 6f2523e524
285 changed files with 15492 additions and 46090 deletions
+5 -9
View File
@@ -1,21 +1,17 @@
import path from "path";
import fs from "fs/promises";
import {NextResponse} from "next/server";
export async function GET(
request: Request,
{params}: { params: Promise<{ fileName: string }> }
) {
import { NextResponse } from "next/server";
export async function GET({ params }: { params: Promise<{ fileName: string }> }) {
try {
const fileName = (await params).fileName
const fileName = (await params).fileName;
const filePath = path.join(process.cwd(), "private/uploads/images", fileName);
// Check if the file exists
try {
await fs.access(filePath); // Ensures the file exists
} catch {
return NextResponse.json({error: "File not found"}, {status: 404});
return NextResponse.json({ error: "File not found" }, { status: 404 });
}
// Read the file
@@ -29,6 +25,6 @@ export async function GET(
});
} catch (error) {
console.error("Error reading file:", error);
return NextResponse.json({error: "Internal Server Error"}, {status: 500});
return NextResponse.json({ error: "Internal Server Error" }, { status: 500 });
}
}