feat(api-keys): show 'Last used' per API key (closes #492)#874
Conversation
Column was already being rendered with formatDateTime (absolute). Switch the "Last used" cell to formatRelativeTime with the ISO timestamp on a title attribute for hover. Null last_used_at renders "Never" unchanged. Backend last_used_at was already present: column in migration 000001, UpdateLastUsed fires async in ValidateUserAPIKey, and ListUserAPIKeysAPI already propagates the field. Migration 000065 not needed. Add round-trip tests to service_apikeys_api_test.go asserting the field is non-nil for used keys and nil (not zero-time) for never-used keys. Add frontend tests for Never and for the relative+title rendering.
|
@coderabbitai review |
|
Warning Review limit reached
More reviews will be available in 13 minutes and 45 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Actions performedReview triggered.
|
Summary
formatDateTime(absolute) toformatRelativeTime(e.g. "2h ago") with the full ISO timestamp on atitleattribute for hoverlast_used_atcontinues to render "Never" (not a zero time)last_used_at TIMESTAMPTZ NULLalready exists in000001_initial_schema.up.sql,UpdateLastUsedalready fires async inValidateUserAPIKey, andListUserAPIKeysAPIalready propagates the fieldTest plan
TestService_ListUserAPIKeysAPIextended with two new subtests assertingLastUsedAtround-trips correctly (non-nil for used keys, nil for never-used keys)apikeys.test.tscovering null ("Never") and populated (relative label + ISO title) renderinggo test ./internal/auth/... ./internal/api/...: 1854 passednpx tsc --noEmit: cleanapikeys.test.ts): 58 passed