refactor: clean upload pipeline and restore draco delivery
This commit is contained in:
@@ -6,6 +6,7 @@ import { getModelFolderPath } from '@/lib/model-paths'
|
||||
import { ensurePreparedStagingAssets } from '@/lib/upload-staging'
|
||||
import { parseStagingRequestBody } from '@/lib/upload-request'
|
||||
import { getErrorMessage } from '@/lib/guards'
|
||||
import type { FileDiff } from '@/lib/types'
|
||||
|
||||
export const runtime = 'nodejs'
|
||||
export const dynamic = 'force-dynamic'
|
||||
@@ -37,7 +38,7 @@ export async function POST(req: NextRequest) {
|
||||
const remoteFileMap = new Map(files.map((file) => [file.name.toLowerCase(), file.size]))
|
||||
const { fileChanges, deletedFileNames } = classifyFileChanges(filesToPush, remoteFileMap, folderPath)
|
||||
|
||||
const diffs: Array<{ name: string; status: 'new' | 'changed' | 'deleted' }> = []
|
||||
const diffs: FileDiff[] = []
|
||||
|
||||
for (const [name, status] of fileChanges.entries()) {
|
||||
if (status === 'new' || status === 'changed') {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
import { acquireUploadLock, releaseUploadLock } from '@/lib/upload-lock'
|
||||
import { parseDriveRequestBody } from '@/lib/upload-request'
|
||||
import { getErrorMessage } from '@/lib/guards'
|
||||
import type { DriveAction } from '@/lib/types'
|
||||
|
||||
export const runtime = 'nodejs'
|
||||
export const dynamic = 'force-dynamic'
|
||||
@@ -27,7 +28,7 @@ export async function POST(req: NextRequest) {
|
||||
|
||||
let folderName: string
|
||||
let parsedFiles: Awaited<ReturnType<typeof readStagedOriginalFiles>>['files']
|
||||
let action: 'new' | 'replace'
|
||||
let action: DriveAction
|
||||
|
||||
try {
|
||||
const body: unknown = await req.json()
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function POST(req: NextRequest) {
|
||||
|
||||
try {
|
||||
const parsed = await parseMultiUpload(req)
|
||||
const staged = await createStagingUpload(parsed.folderName, parsed.files)
|
||||
const staged = await createStagingUpload(parsed.folderName, parsed.files, parsed.gitModelMode)
|
||||
return NextResponse.json({ success: true, ...staged })
|
||||
} catch (err) {
|
||||
const message = getErrorMessage(err)
|
||||
|
||||
Reference in New Issue
Block a user