feat(api): DB-backed /users/stats and /tasks/stats#31
Open
kuyacarlo wants to merge 1 commit into
Open
Conversation
Both stats endpoints always echoed the fixtures, so in DB mode they disagreed with the list endpoints they summarize. Hydrate the common lookup helpers from repository rows instead — same math, live data. AssignmentLookup.getStats previously hardcoded the fixture Activities import even when constructed with custom entries; it now takes the activity set as an optional parameter (defaulting to fixtures, so existing web callers are unaffected). Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
4 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 #30.
Summary
GET /users/statsandGET /tasks/stats/:employeeIdalways computed from fixtures, so in DB mode they disagreed with the list endpoints they summarize. They now hydrate the@worksight/commonlookup helpers from Postgres rows — same aggregation math, live data.AssignmentLookup.getStats: it hardcoded the fixtureActivitiesimport even when the lookup was constructed with custom entries. The activity set is now an optional parameter defaulting to the fixtures, so web callers are unaffected (@worksight/webtype-check verified).Test plan
pnpm --filter @worksight/api type-check/lint/test— 19 greenpnpm --filter @worksight/web type-check— green (signature change is backwards compatible)/users/statsreports 15 employees by role/department;/tasks/stats/E001-uuidreports 4 tasks, 50% completion, 6 activitiesMade with Cursor