Skip to content

feat(api): attendance endpoints + health data-source reporting#29

Open
kuyacarlo wants to merge 2 commits into
feat/api-postgres-urlfrom
feat/api-attendance
Open

feat(api): attendance endpoints + health data-source reporting#29
kuyacarlo wants to merge 2 commits into
feat/api-postgres-urlfrom
feat/api-attendance

Conversation

@kuyacarlo

Copy link
Copy Markdown
Contributor

Stacked on #28.

Summary

  • Repairs the attendance fixtures (last dataset with invalid UUIDs in the API surface): 77 system_ids regenerated as deterministic UUIDs, placeholder/stale employee_ids (0001, admin, guest, old hex ids) remapped to real employees via the per-block fixture comments. AttendanceSchema.employee_id is now z.uuid(); every record verified to reference an existing employee, no duplicate (employee_id, date) pairs.
  • apps/api/sql/002_attendance.sql + seed extension — 77 rows seeded on Neon.
  • GET /attendance (optional ?employee_id=) and GET /attendance/stats/:employeeId, DB-backed with fixture fallback like users/tasks. Stats use a SQL aggregate in DB mode, AttendanceLookup otherwise (same rounding).
  • GET /health now pings the pool and reports database: fixtures | postgres | unreachable.

Test plan

  • pnpm --filter @worksight/api type-check / lint / test — 14 tests green (4 new)
  • Reseeded Neon via direct URL: 77 attendance rows
  • Booted dist against the Neon pooler: /healthpostgres, /attendance → 77, stats for E001 → 6 records / 46.5h

Made with Cursor

Attendance fixtures could never reach a database: 77 records carried
invalid UUIDs (g-j hex) and employee references that no longer exist
after the employee-fixture repair (0001/admin/guest and stale hex ids).
Regenerate system_ids deterministically and remap employee_ids via the
per-block comments; tighten AttendanceSchema.employee_id to z.uuid().

Add sql/002_attendance.sql (unique per employee/date), extend the seed
script, and expose GET /attendance and GET /attendance/stats/:employeeId
following the same DB-with-fixture-fallback pattern as users/tasks.
/health now pings the pool and reports fixtures | postgres | unreachable
so deploys can tell which source is live.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worksight-docs Ready Ready Preview, Comment Jul 25, 2026 6:53pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
worksight Skipped Skipped Jul 25, 2026 6:53pm
worksight-api Skipped Skipped Jul 25, 2026 6:53pm

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.

1 participant