feat(api): attendance endpoints + health data-source reporting#29
Open
kuyacarlo wants to merge 2 commits into
Open
feat(api): attendance endpoints + health data-source reporting#29kuyacarlo wants to merge 2 commits into
kuyacarlo wants to merge 2 commits into
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #28.
Summary
system_ids regenerated as deterministic UUIDs, placeholder/staleemployee_ids (0001,admin,guest, old hex ids) remapped to real employees via the per-block fixture comments.AttendanceSchema.employee_idis nowz.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=) andGET /attendance/stats/:employeeId, DB-backed with fixture fallback like users/tasks. Stats use a SQL aggregate in DB mode,AttendanceLookupotherwise (same rounding).GET /healthnow pings the pool and reportsdatabase: fixtures | postgres | unreachable.Test plan
pnpm --filter @worksight/api type-check/lint/test— 14 tests green (4 new)/health→postgres,/attendance→ 77, stats for E001 → 6 records / 46.5hMade with Cursor