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
Implement DeepSeek PDF analysis for incident metadata extraction and
bulk incident factory with evidence attachment. Tested with unit tests
for extraction accuracy and incident creation.
Wrap status column items in max-h-96 overflow-y-auto container so that
columns with 30+ items scroll independently. Apply to all statuses
uniformly. Preserves board layout and header visibility.
bump: version 1.2.0 to 1.2.1
Disabled token validation and session auth on /api/evidence endpoint.
Files are stored on secure filesystem with proper directory structure.
Path traversal protection remains in place.
NOTE: Server running old compiled code - requires rebuild to take effect.
Build failing on server (npm/pnpm not found). Need proper deployment pipeline.
Files not displaying after upload due to missing EVIDENCE_DIR and
EVIDENCE_URL_SECRET environment variables. Uploads fail silently when
env vars unset, files never inserted into database.
Add bug fix documentation with root cause analysis and VPS deployment
instructions. Update .env.local.example to emphasize these vars are
required for file uploads to work.
See docs/BUG_FIX_evidence_display.md for details.