feat: add shared filter to workspaces query#19807
Conversation
c7b80ee to
61c3aee
Compare
aslilac
left a comment
There was a problem hiding this comment.
looks great! could we add some tests that actually hit the database tho?
49f4161 to
8c12d81
Compare
There was a problem hiding this comment.
-
WorkspaceFilterhas anasRequestOptionmethod that also needs to be updated. that's where theqparam actually gets serialized. -
this field probably needs to be
*boolso that you can setshared:falseas distinct from "noshared:filter"
There was a problem hiding this comment.
nit: I think this being last was intentional since it doesn't quite "fit in", and that should be preserved
Yeah I'm still working on it, I'll re-request review when it's ready |
c0dc8e8 to
bf4b351
Compare
bf4b351 to
127e7e5
Compare
| workspaces, err := client.Workspaces(ctx, codersdk.WorkspaceFilter{ | ||
| Shared: ptr.Ref(true), | ||
| }) | ||
| require.NoError(t, err, "fetch workspaces") | ||
| require.Equal(t, 1, workspaces.Count, "expected only one workspace") |
There was a problem hiding this comment.
since there's only one workspace here, could we also run this with Shared: ptr.Ref(false) and check the length to be 0?
There was a problem hiding this comment.
I am creating two workspaces if you look at the setup
| workspaces, err := client.Workspaces(ctx, codersdk.WorkspaceFilter{ | ||
| Shared: ptr.Ref(true), | ||
| }) | ||
| require.NoError(t, err, "fetch workspaces") | ||
| require.Equal(t, 1, workspaces.Count, "expected only one workspace") | ||
| require.Equal(t, workspaces.Workspaces[0].ID, sharedWorkspace.ID) |
There was a problem hiding this comment.
and perhaps the same thing here for the groups case
There was a problem hiding this comment.
Same as above, a second workspace is being created but not shared
Adds a
shared:<boolean>search query to the/workspaces [get]endpointCleanShot.2025-09-15.at.11.13.25.mp4
Closes coder/internal#972