refactor: simplify upload rules and remove destination flow

This commit is contained in:
Tom Boullay
2026-04-24 16:23:02 +02:00
parent 61a0146545
commit 944959fc22
20 changed files with 2033 additions and 217 deletions
+2 -4
View File
@@ -17,23 +17,21 @@ export async function POST(req: NextRequest) {
if (authError) return authError
let folderName: string
let destination: string
let parsedFiles: Awaited<ReturnType<typeof parseMultiUpload>>['files']
try {
const parsed = await parseMultiUpload(req)
folderName = parsed.folderName
destination = parsed.destination
parsedFiles = parsed.files
} catch (err) {
const message = err instanceof Error ? err.message : 'Erreur inconnue'
return NextResponse.json({ success: false, error: message }, { status: 400 })
}
const folderPath = `public/models/${destination}/${folderName}`
const folderPath = `public/models/${folderName}`
try {
const { filesToPush } = await prepareGitAssets({ folderName, destination, parsedFiles })
const { filesToPush } = await prepareGitAssets({ folderName, parsedFiles })
const { exists, files } = await getRemoteFolder(folderPath)
if (exists) {