From e159ce5e388015ca74b4ebf2bc893377f0886f73 Mon Sep 17 00:00:00 2001 From: f0ssel Date: Thu, 23 Jun 2022 18:28:32 +0000 Subject: [PATCH 1/2] fix: order apps by name --- coderd/database/queries/workspaceapps.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coderd/database/queries/workspaceapps.sql b/coderd/database/queries/workspaceapps.sql index e4be54176d962..f25fd67124187 100644 --- a/coderd/database/queries/workspaceapps.sql +++ b/coderd/database/queries/workspaceapps.sql @@ -1,14 +1,14 @@ -- name: GetWorkspaceAppsByAgentID :many -SELECT * FROM workspace_apps WHERE agent_id = $1; +SELECT * FROM workspace_apps WHERE agent_id = $1 ORDER BY name ASC; -- name: GetWorkspaceAppsByAgentIDs :many -SELECT * FROM workspace_apps WHERE agent_id = ANY(@ids :: uuid [ ]); +SELECT * FROM workspace_apps WHERE agent_id = ANY(@ids :: uuid [ ]) ORDER BY name ASC; -- name: GetWorkspaceAppByAgentIDAndName :one SELECT * FROM workspace_apps WHERE agent_id = $1 AND name = $2; -- name: GetWorkspaceAppsCreatedAfter :many -SELECT * FROM workspace_apps WHERE created_at > $1; +SELECT * FROM workspace_apps WHERE created_at > $1 ORDER BY name ASC; -- name: InsertWorkspaceApp :one INSERT INTO From c9e188574fd1ba46f8e401a390db19ac6b07f102 Mon Sep 17 00:00:00 2001 From: f0ssel Date: Thu, 23 Jun 2022 18:31:37 +0000 Subject: [PATCH 2/2] make gen --- coderd/database/queries.sql.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coderd/database/queries.sql.go b/coderd/database/queries.sql.go index 80ffa077bfcd6..a3c4facf01d77 100644 --- a/coderd/database/queries.sql.go +++ b/coderd/database/queries.sql.go @@ -3175,7 +3175,7 @@ func (q *sqlQuerier) GetWorkspaceAppByAgentIDAndName(ctx context.Context, arg Ge } const getWorkspaceAppsByAgentID = `-- name: GetWorkspaceAppsByAgentID :many -SELECT id, created_at, agent_id, name, icon, command, url, relative_path FROM workspace_apps WHERE agent_id = $1 +SELECT id, created_at, agent_id, name, icon, command, url, relative_path FROM workspace_apps WHERE agent_id = $1 ORDER BY name ASC ` func (q *sqlQuerier) GetWorkspaceAppsByAgentID(ctx context.Context, agentID uuid.UUID) ([]WorkspaceApp, error) { @@ -3211,7 +3211,7 @@ func (q *sqlQuerier) GetWorkspaceAppsByAgentID(ctx context.Context, agentID uuid } const getWorkspaceAppsByAgentIDs = `-- name: GetWorkspaceAppsByAgentIDs :many -SELECT id, created_at, agent_id, name, icon, command, url, relative_path FROM workspace_apps WHERE agent_id = ANY($1 :: uuid [ ]) +SELECT id, created_at, agent_id, name, icon, command, url, relative_path FROM workspace_apps WHERE agent_id = ANY($1 :: uuid [ ]) ORDER BY name ASC ` func (q *sqlQuerier) GetWorkspaceAppsByAgentIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceApp, error) { @@ -3247,7 +3247,7 @@ func (q *sqlQuerier) GetWorkspaceAppsByAgentIDs(ctx context.Context, ids []uuid. } const getWorkspaceAppsCreatedAfter = `-- name: GetWorkspaceAppsCreatedAfter :many -SELECT id, created_at, agent_id, name, icon, command, url, relative_path FROM workspace_apps WHERE created_at > $1 +SELECT id, created_at, agent_id, name, icon, command, url, relative_path FROM workspace_apps WHERE created_at > $1 ORDER BY name ASC ` func (q *sqlQuerier) GetWorkspaceAppsCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceApp, error) {