feat(admin/media): folders in the media library
- admin-files: fetchFolders / createFolder / deleteFolder + FolderItem; fetchFiles takes a folderId filter - admin files upload route forwards target_folder_id so uploads land in the open folder - FileManager: breadcrumb navigation, folder cards (open / delete), "+ new folder", folder-scoped file listing + upload. Folders hidden while searching (search spans all) Uses the file-svc folder API (GET/POST/DELETE /v1/folders, folder_id list filter) that already existed but had no UI. "Pick from library" was already wired via FilePicker in FileUploadField. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,10 @@ export async function POST(req: NextRequest) {
|
||||
if (!(file instanceof File)) {
|
||||
return NextResponse.json({ error: "No file provided" }, { status: 400 });
|
||||
}
|
||||
// Optional: drop the upload into a specific media-library folder.
|
||||
const folderId = form?.get("folder_id");
|
||||
const targetFolderId =
|
||||
typeof folderId === "string" && folderId ? folderId : undefined;
|
||||
|
||||
const auth = { Authorization: `Bearer ${token}` };
|
||||
|
||||
@@ -41,6 +45,7 @@ export async function POST(req: NextRequest) {
|
||||
filename: file.name,
|
||||
mime_type: file.type || "application/octet-stream",
|
||||
size_bytes: file.size,
|
||||
target_folder_id: targetFolderId,
|
||||
}),
|
||||
});
|
||||
const presign = await presignRes.json().catch(() => null);
|
||||
|
||||
Reference in New Issue
Block a user