fix(bulk-import): skip __MACOSX folder when processing zip imports

Build errors fixed:
- Fixed session field access (session.sub instead of session.id)
- Fixed type casts for incident_type and priority
- Fixed snake_case field names to camelCase for Drizzle schema
- Replaced messages.create with chat.completions.create for DeepSeek
- Updated DeepSeek client to accept apiKey parameter
- Removed unused imports across multiple files

Route now accessible at /bulk-import. Redirects unauthenticated users to
/login?redirect=%2Fbulk-import.

Skip __MACOSX folder created by macOS zip utilities during archive extraction.
This commit is contained in:
2026-08-19 18:45:34 +08:00
parent 1bb8e4d856
commit 1422d3df47
8 changed files with 439 additions and 55 deletions
-6
View File
@@ -1,12 +1,6 @@
import { NextRequest, NextResponse } from 'next/server'
import fs from 'node:fs'
import path from 'node:path'
import crypto from 'node:crypto'
import { getSession } from '@/lib/auth/get-session'
import { signEvidencePath } from '@/lib/storage/evidence'
import { asAdmin } from '@/lib/db/with-user'
import { evidenceFiles } from '@/lib/db/schema'
import { eq } from 'drizzle-orm'
export const dynamic = 'force-dynamic'