feat: Show created/updated metadata for saved searches and dashboards#2031
feat: Show created/updated metadata for saved searches and dashboards#2031kodiakhq[bot] merged 5 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 081f2d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
E2E Test Results✅ All tests passed • 129 passed • 3 skipped • 1041s
Tests ran across 4 shards in parallel. |
1e6e308 to
0366e9f
Compare
PR Review
|
0366e9f to
c9632da
Compare
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Additional context: touches API routes or data models Review process: Full human review — logic, architecture, edge cases. Stats
|
| createdAt?: string; | ||
| updatedAt?: string; | ||
| createdBy?: { email: string; name?: string }; | ||
| updatedBy?: { email: string; name?: string }; |
There was a problem hiding this comment.
Why not add these to the zod schema for SavedSearch?
There was a problem hiding this comment.
Good question - it is because the types differ, and I think I'd have to override them in a few places even if I did add them to SavedSearchSchema.
- They shouldn't be included API request bodies - they're set by Mongo
- The dates are Date types in mongoose documents (ISavedSearch type) but strings in the API response (SavedSearchPopulated)
- The users as ObjectId / strings in Mongoose documents, but populated with
{ email: string; name?: string }from the user table when when requesting them from the API (SavedSearchPopulated)
There was a problem hiding this comment.
As part of addressing tech debt I have been incrementally upgrading api routes to use enforce the API types on the backend, and sharing those types on the frontend. See AlertsApiResponseSchema in common-utils/src/types.ts as an example. This could be an opportunity to add it for saved searches! Else I'll approve as-is once merge conflicts are addressed
There was a problem hiding this comment.
Updated for the saved search list endpoint. Extending the same to dashboards was proving to be a somewhat extensive set of changes, so I think we can save that for another PR.
…#2031) ## Summary This PR adds createdAt/By and updatedAt/By metadata to dashboard and saved searches. ### Screenshots or video <img width="1466" height="342" alt="Screenshot 2026-04-01 at 3 19 07 PM" src="https://github.com/user-attachments/assets/c349a3d5-f8e3-4155-9938-c8f005cdcd52" /> <img width="1216" height="433" alt="Screenshot 2026-04-01 at 3 19 57 PM" src="https://github.com/user-attachments/assets/9542a631-bdda-484c-9cef-6b780667d1dc" /> <img width="1196" height="345" alt="Screenshot 2026-04-01 at 3 19 46 PM" src="https://github.com/user-attachments/assets/c05cd0cc-2ca4-4397-8acb-e31a81b882ec" /> <img width="1409" height="433" alt="Screenshot 2026-04-01 at 3 19 38 PM" src="https://github.com/user-attachments/assets/593a96d7-86be-45b2-9f0a-b3a8f00d1353" /> <img width="1447" height="181" alt="Screenshot 2026-04-01 at 3 20 59 PM" src="https://github.com/user-attachments/assets/88742578-3dbd-4305-921f-e2ecdd11d5d4" /> ### How to test locally or on Vercel This should be tested locally. In the preview environment, these fields are not populated (since they're maintained through automatic MongoDB createdAt/updatedAt values and createdBy/updatedBy values pulled from User accounts. ### References - Linear Issue: Closes HDX-3461 - Related PRs:
Summary
This PR adds createdAt/By and updatedAt/By metadata to dashboard and saved searches.
Screenshots or video
How to test locally or on Vercel
This should be tested locally. In the preview environment, these fields are not populated (since they're maintained through automatic MongoDB createdAt/updatedAt values and createdBy/updatedBy values pulled from User accounts.
References