Skip to content

chore: add organization search query to workspaces#14474

Merged
Emyrk merged 2 commits into
mainfrom
stevenmasley/workspace_org_search
Aug 28, 2024
Merged

chore: add organization search query to workspaces#14474
Emyrk merged 2 commits into
mainfrom
stevenmasley/workspace_org_search

Conversation

@Emyrk
Copy link
Copy Markdown
Member

@Emyrk Emyrk commented Aug 28, 2024

Closes #14444

@Emyrk Emyrk requested a review from f0ssel August 28, 2024 19:29
}

func Workspaces(query string, page codersdk.Pagination, agentInactiveDisconnectTimeout time.Duration) (database.GetWorkspacesParams, []codersdk.ValidationError) {
func Workspaces(ctx context.Context, db database.Store, query string, page codersdk.Pagination, agentInactiveDisconnectTimeout time.Duration) (database.GetWorkspacesParams, []codersdk.ValidationError) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

aside: I see why we do it in this package, but this is kind of a weird naming scheme for something that returns database query params.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fair. Maybe it should be named WorkspacesFilter or something. I won't address here though

Comment on lines +273 to +277
db := dbmem.New()
if c.Setup != nil {
c.Setup(t, db)
}
values, errs := searchquery.Workspaces(context.Background(), db, c.Query, codersdk.Pagination{}, 0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we not use the traditional way of getting a DB in tests so this can run against postgres too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd prefer not to for this. What would be even better is if I used the mock database, but I haven't messed with that at all yet.

@Emyrk Emyrk merged commit b96ac67 into main Aug 28, 2024
@Emyrk Emyrk deleted the stevenmasley/workspace_org_search branch August 28, 2024 20:18
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add organizations to workspace search query

2 participants