Skip to content

chore: add db query to retrieve workspaces & their agents - #14792

Merged
ethanndickson merged 5 commits into
mainfrom
09-25-chore_add_db_query_to_retrieve_workspaces_their_agents
Nov 1, 2024
Merged

ethanndickson merged 5 commits into
mainfrom
09-25-chore_add_db_query_to_retrieve_workspaces_their_agents

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Sep 25, 2024 •

Copy link
Copy Markdown
Member

Second PR for #14716.

Adds a query that, given a user ID, returns all the workspaces they own, that can also be ActionRead by the requesting user.

type GetWorkspacesAndAgentsByOwnerIDRow struct {
	WorkspaceID      uuid.UUID            `db:"workspace_id" json:"workspace_id"`
	WorkspaceName    string               `db:"workspace_name" json:"workspace_name"`
	JobStatus        ProvisionerJobStatus `db:"job_status" json:"job_status"`
	Transition       WorkspaceTransition  `db:"transition" json:"transition"`
	Agents           []AgentIDNamePair    `db:"agents" json:"agents"`
}

JobStatus and Transition are set using the latest build/job of the workspace. Deleted workspaces are not included.

ethanndickson commented Sep 25, 2024 •

Copy link
Copy Markdown
Member Author

@ethanndickson
ethanndickson marked this pull request as ready for review September 25, 2024 07:46
Comment thread coderd/workspaces_test.go Resolved
Comment thread coderd/workspaces_test.go Resolved
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch 3 times, most recently from 6e44f26 to 97ac5bc Compare September 26, 2024 08:28
Comment thread coderd/database/sqlc.yaml Outdated

@ethanndickson ethanndickson Sep 26, 2024 •

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.

Required due to sqlc-dev/sqlc#2760

@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch 3 times, most recently from aacd023 to 22985f7 Compare September 27, 2024 05:11
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch 2 times, most recently from db04bcf to 50f874c Compare September 30, 2024 09:35
Comment thread coderd/database/dbmem/dbmem.go Resolved
Comment thread coderd/database/queries/workspaces.sql Resolved
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch 5 times, most recently from 2bc6e69 to 54cbfaf Compare October 3, 2024 15:07
@meticulous

meticulous Bot commented Oct 3, 2024

Copy link
Copy Markdown

Meticulous was unable to execute a test run for this PR because the most recent commit is associated with multiple PRs. To execute a test run, please try pushing up a new commit that is only associated with this PR.

Last updated for commit 701c1b6. This comment will update as new commits are pushed.

@ethanndickson
ethanndickson changed the base branch from main to ethan/owner-pubsub October 3, 2024 15:07
@ethanndickson
ethanndickson marked this pull request as draft October 3, 2024 15:35
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from 54cbfaf to aad36cf Compare October 4, 2024 03:45
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from aad36cf to b5f7529 Compare October 4, 2024 05:51
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from aafb31a to 21fa63c Compare October 22, 2024 10:04
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch 2 times, most recently from cfa32d5 to 3a95c19 Compare October 24, 2024 04:41
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from 3a95c19 to 22db890 Compare October 28, 2024 12:04
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from 22db890 to c55e54b Compare October 28, 2024 15:23
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from c55e54b to 45225e4 Compare October 29, 2024 03:14
Comment thread coderd/database/dbauthz/dbauthz_test.go Resolved
Comment thread coderd/database/dbauthz/dbauthz.go Resolved
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from e05b286 to a45a43c Compare October 29, 2024 09:53
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from a45a43c to 744633f Compare November 1, 2024 03:02
@ethanndickson
ethanndickson changed the base branch from ethan/owner-pubsub to graphite-base/14792 November 1, 2024 03:17
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from 744633f to 54ceea2 Compare November 1, 2024 03:17
@ethanndickson
ethanndickson changed the base branch from graphite-base/14792 to main November 1, 2024 03:18
@ethanndickson
ethanndickson force-pushed the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch from 54ceea2 to 8be52ed Compare November 1, 2024 03:18
@ethanndickson
ethanndickson merged commit f941e78 into main Nov 1, 2024
@ethanndickson
ethanndickson deleted the 09-25-chore_add_db_query_to_retrieve_workspaces_their_agents branch November 1, 2024 03:36
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 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.

4 participants