Skip to content

feat: add CSV export for visitor log - #6

Open
AchieverSana wants to merge 1 commit into
djsmacker01:mainfrom
AchieverSana:feat/visitor-csv-export
Open

feat: add CSV export for visitor log#6
AchieverSana wants to merge 1 commit into
djsmacker01:mainfrom
AchieverSana:feat/visitor-csv-export

Conversation

@AchieverSana

Copy link
Copy Markdown

What does this change?

Adds a CSV export for the visitor log (closes #3).

  • New GET /api/visitors/export?from=&to= endpoint in backend/routes/visitors.js, gated to manager and readonly roles server-side
  • New "Export CSV" button on the Visitor Log page, next to the date filter, visible only to manager/readonly
  • CSV includes: name, resident visited, purpose, sign-in time, sign-out time, signed in by
  • Correctly escapes quotes/commas so it opens cleanly in Excel/Sheets

How did you test it?

Ran the app locally end-to-end: signed in a test visitor, exported the CSV for that date, and confirmed it opens cleanly in Excel with the correct row data. Verified the button is hidden for non-manager/readonly roles.

Checklist

  • npm run lint and npm test pass in frontend/
  • No clinical records are hard-deleted, and MAR entries stay append-only (see the rules that can't be broken)
  • New API endpoints check the user's role server-side
  • Tap targets are still at least 44px if you touched the UI
  • No real keys, secrets, or resident data in the diff

Note on the audit-trail acceptance criterion

The issue mentions the export action should be recorded in an activity log. This repo doesn't currently have a dedicated audit-trail table for actions like this (only a care-notes activity_logs table for a different purpose). For now the export is logged server-side via console.log (who exported, what range, when). Happy to add a proper persisted audit table if you'd like a specific approach — didn't want to guess at schema design unprompted.

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

@AchieverSana is attempting to deploy a commit to the djsmacker01's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSV export for the visitor log

1 participant