feat(time): wire Time Tracking pages to the backend (MAPPS-124) #70
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-124-wire-time-tracking"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Closes MAPPS-124. The
/timepages were hardcoded template, not wired to the backend - logging time saved nothing and the list showed fabricated data./time): fixed stat cards (4.5h/32.5h/28.0h/4.5h), a fake John Smith / Jane Doe user filter, 5 hardcoded rows./time/new, "Log Time"): mock submit -onsubmitwaited 1s then navigated, never POSTed; hardcoded Work Item dropdown; no work-type/company selection (both required by the API).Changes
CreateTimeEntryRequest: Work Item picker fromGET /tickets(suppliesticket_id+ the requiredcompany_id), Work Type picker fromGET /work-types(work_type_id),user_idfrom the auth context,date= today, hours ->duration_minutes, description ->notes, billable flag. Validates input, surfaces errors, navigates to/timeon success.GET /time-entries, renders real rows (date, ticket link, notes, hours, billable + billing status), computes the four stat cards from the fetched entries, and has loading / empty / load-failed states. Dropped the hardcoded rows, the fake user filter, and the unusedTimeEntryRowcomponent.Verification
Create path verified end to end against the running server:
POST /api/v1/time-entrieswith the assembled body returns 200 and the entry persists (correct user/date/work_type/company/duration/billable). The work-types + ticket-company lookups return real data.Dependency
GET /time-entries500s until mokosh-server PR #116 (PMS-145) lands + the server rebuilds (the ORDER BY bug), so the list shows its load-failed/empty state until then. The page is robust to it, and the create path works independently.Out of scope
TimesheetsPage(/timesheets) is still a separate hardcoded grid - a follow-up.🤖 Generated with Claude Code
The /time pages were hardcoded template. TimeEntryListPage showed fixed stat cards (4.5h/32.5h/28.0h/4.5h), a fake John Smith / Jane Doe user filter, and 5 hardcoded rows. TimeEntryNewPage ("Log Time") mock-submitted: onsubmit waited 1s then navigated, never POSTing, with a hardcoded Work Item dropdown and no work-type/company selection that the API requires. Wire both to the real API: - TimeEntryNewPage POSTs a real CreateTimeEntryRequest. Work Item is a real ticket picker (GET /tickets) that supplies ticket_id + the required company_id; Work Type is a real picker (GET /work-types) for the required work_type_id; user_id comes from the auth context, date defaults to today, hours convert to duration_minutes, description -> notes, plus the billable flag. Validates input, surfaces errors in a banner, and navigates to /time on success. - TimeEntryListPage fetches GET /time-entries, renders real rows (date, ticket link, notes, hours, billable + billing status), computes the four stat cards from the fetched entries, and shows loading / empty / load-failed states. Removed the hardcoded rows, the fake user filter, and the now-unused TimeEntryRow component. The create path is verified end to end (POST returns 200 and the entry persists). The list depends on mokosh-server PR #116 (PMS-145): GET /time-entries 500s until that ORDER BY fix lands + the server rebuilds, so the list shows its load-failed/empty state until then; this page is robust to it. TimesheetsPage (/timesheets) is still a separate hardcoded surface, out of scope here. cargo check + clippy clean on wasm32; fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>