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
+8 -3
View File
@@ -79,7 +79,7 @@ WHERE
-- name: GetWorkspaces :many
SELECT
workspaces.*,
COALESCE(template_name.template_name, 'unknown') as template_name,
COALESCE(template.name, 'unknown') as template_name,
latest_build.template_version_id,
latest_build.template_version_name,
COUNT(*) OVER () as count
@@ -120,12 +120,12 @@ LEFT JOIN LATERAL (
) latest_build ON TRUE
LEFT JOIN LATERAL (
SELECT
templates.name AS template_name
*
FROM
templates
WHERE
templates.id = workspaces.template_id
) template_name ON true
) template ON true
WHERE
-- Optionally include deleted workspaces
workspaces.deleted = @deleted
@@ -259,6 +259,11 @@ WHERE
workspaces.last_used_at >= @last_used_after
ELSE true
END
AND CASE
WHEN sqlc.narg('using_active') :: boolean IS NOT NULL THEN
(latest_build.template_version_id = template.active_version_id) = sqlc.narg('using_active') :: boolean
ELSE true
END
-- Authorize Filter clause will be injected below in GetAuthorizedWorkspaces
-- @authorize_filter
ORDER BY