import { NextResponse } from "next/server"; import { withAuth } from "@/lib/api-auth"; import { apiError } from "@/lib/api-errors"; import { getLocalFolder } from "@/lib/local-folders"; export const dynamic = "force-dynamic"; /** One folder the scan found, with its files (`?path=/`): what the Import form needs. */ export const GET = withAuth(async (req) => { const path = new URL(req.url).searchParams.get("path"); const folder = path ? await getLocalFolder(path) : undefined; if (!folder) return apiError(404, "not_found", "This folder is no longer in the models folder. Rescan and try again."); return NextResponse.json({ path: folder.path, commit: folder.commit, files: folder.files, fileCount: folder.fileCount, totalBytes: folder.totalBytes, }); });