- Catch and log GOOGLE_AI_API_KEY errors instead of failing
- Allows endpoints to work without embeddings configured
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Point AI client to localhost:11434/v1 (Ollama)
- Remove DeepSeek API key dependency
- Update model name to qwen3:14b across all routes
- Update test mocks to use createLocalLLMClient
- Removes need for DEEPSEEK_API_KEY setting
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Derived from IMS Admin Spec.dc.html and IMS Admin.dc.html. Defines tokens,
components (StatusTag, TableCard, shells, drawer), screen index, build order
and the changes from the live Modernist build. CLAUDE.md already cites it as
the source of truth.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Replaces the Supabase, Resend, Claude and pm2 notes with the current stack
(Drizzle + local PostgreSQL, bcryptjs/jose auth, on-disk evidence, DeepSeek AI,
Brevo email, build-only deploy to /srv/apps/ims/app). Also includes the
design-system section switch to the IMS Admin refresh (design.md).
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Logged-out requests were redirected to /login, and logged-in non-admin roles
were bounced to their home page, which blocked PWA install and the service
worker.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Updated mockSession to include required SessionPayload fields (siteId, name)
- Added optional chaining for metadata.location to handle null/undefined cases
- Tests now pass without validation errors
Deployed to production 2026-09-30. App running with local postgres migration complete.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015e81pY6swiKHQZDcN86CTD
Migration plan for moving from Supabase cloud to self-hosted local postgres.
Scope: 30 users, 500 incidents, ~100MB database.
Downtime: Planned maintenance window.
Approach: Direct pg_dump/restore with validation.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
IMS for ims.setia.com.my is deployed to /var/www/ims, not /opt/wsims/app.
PM2 wsims process runs from this location.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Critical note: Production wsims runs from /opt/wsims/app, not /var/www/ims.
Always deploy to /opt/wsims/app and restart PM2 wsims process.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Use execFile instead of exec with string interpolation for unzip command.
Prevents arbitrary command execution via malicious ZIP filenames.
Changed from:
await execAsync(`unzip -q "${uploadedFilePath}" -d "${extractDir}"`)
To:
await execFileAsync('unzip', ['-q', uploadedFilePath, '-d', extractDir])
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Make location optional in ExtractedIncidentMetadata. Skip incidents without
site/zone instead of crashing. Handle null location in UI form inputs with
empty string defaults.
Fixes batch creation errors when PDF documents don't contain clear location
information for DeepSeek to extract.
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.
- Fix requireAdmin() return value destructuring (returns {session}, not user)
- Remove problematic pdf-parse import; placeholder text extraction for now
- Route now accessible and renders correctly