feat: add "updated" search param to workspaces (#11714)

* feat: add "updated" search param to workspaces
* rego -> sql needs to specify which <table>.organization_id
This commit is contained in:
Steven Masley
2024-01-23 11:52:06 -06:00
committed by GitHub
parent 081fbef097
commit d6ba0dfecb
10 changed files with 159 additions and 25 deletions
+17
View File
@@ -7534,6 +7534,23 @@ func (q *FakeQuerier) GetAuthorizedWorkspaces(ctx context.Context, arg database.
}
}
if arg.UsingActive.Valid {
build, err := q.getLatestWorkspaceBuildByWorkspaceIDNoLock(ctx, workspace.ID)
if err != nil {
return nil, xerrors.Errorf("get latest build: %w", err)
}
template, err := q.getTemplateByIDNoLock(ctx, workspace.TemplateID)
if err != nil {
return nil, xerrors.Errorf("get template: %w", err)
}
updated := build.TemplateVersionID == template.ActiveVersionID
if arg.UsingActive.Bool != updated {
continue
}
}
if !arg.Deleted && workspace.Deleted {
continue
}