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
+2 -3
View File
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeAll } from 'vitest'
import { analyzePdfsWithDeepSeek, createBulkIncidents, type ExtractedIncidentMetadata, type FileInfo } from './bulk-import'
import { describe, it, expect, vi } from 'vitest'
import { analyzePdfsWithDeepSeek, type ExtractedIncidentMetadata, type FileInfo } from './bulk-import'
vi.mock('@/lib/claude/client', () => ({
createDeepSeekClient: vi.fn(() => ({
@@ -70,7 +70,6 @@ describe('createBulkIncidents', () => {
}
]
const userId = 'user-123'
// Note: In actual testing, mock db calls or use test database
// This tests the function signature is correct
expect(metadata).toBeDefined()