Skip to content

feat: Single query for all workspaces with optional filter #1537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 18, 2022

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented May 17, 2022

Filters

  • OrgID
  • Username/UserID

Future work

  • Add template id query param to filter

@Emyrk Emyrk marked this pull request as ready for review May 17, 2022 23:45
@Emyrk Emyrk requested a review from a team as a code owner May 17, 2022 23:45
Copy link
Member Author

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove more routes in favor of this one

Comment on lines +150 to +157
for k, v := range assertRoute {
noTrailSlash := strings.TrimRight(k, "/")
if _, ok := assertRoute[noTrailSlash]; ok && noTrailSlash != k {
t.Errorf("route %q & %q is declared twice", noTrailSlash, k)
t.FailNow()
}
assertRoute[noTrailSlash] = v
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Routes were being duplicated with a trailing slash. Just catching dev errors.

@@ -131,3 +131,41 @@ func (c *Client) UpdateWorkspaceAutostop(ctx context.Context, id uuid.UUID, req
}
return nil
}

type WorkspaceFilter struct {
OrganizationID uuid.UUID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make OrganizationID be Organization, similar to Owner? Then the organization's name could be used, or its ID.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be the first time we use OrganizationName in the api right? We should probably make a PR to do this everywhere if we decide for it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we technically could make organization an ID or name, just like users.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, we just have to do it across more endpoints imo. Should be another PR to do this like the users PR I did

@Emyrk Emyrk merged commit a3556b1 into main May 18, 2022
@Emyrk Emyrk deleted the stevenmasley/all_workspaces branch May 18, 2022 15:09
kylecarbs pushed a commit that referenced this pull request Jun 10, 2022
* feat: Add single query for all workspaces using a filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants