mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: join owner, template, and org in new workspace view (#15116)
Joins in fields like `username`, `avatar_url`, `organization_name`, `template_name` to `workspaces` via a **view**. The view must be maintained moving forward, but this prevents needing to add RBAC permissions to fetch related workspace fields.
This commit is contained in:
@@ -191,7 +191,7 @@ func Test_ActivityBumpWorkspace(t *testing.T) {
|
||||
ActiveVersionID: templateVersion.ID,
|
||||
CreatedBy: user.ID,
|
||||
})
|
||||
ws = dbgen.Workspace(t, db, database.Workspace{
|
||||
ws = dbgen.Workspace(t, db, database.WorkspaceTable{
|
||||
OwnerID: user.ID,
|
||||
OrganizationID: org.ID,
|
||||
TemplateID: template.ID,
|
||||
|
||||
@@ -162,7 +162,7 @@ type deps struct {
|
||||
Agent database.WorkspaceAgent
|
||||
Template database.Template
|
||||
User database.User
|
||||
Workspace database.Workspace
|
||||
Workspace database.WorkspaceTable
|
||||
}
|
||||
|
||||
// setupDeps sets up a set of test dependencies.
|
||||
@@ -189,7 +189,7 @@ func setupDeps(t *testing.T, store database.Store, ps pubsub.Pubsub) deps {
|
||||
OrganizationID: org.ID,
|
||||
ActiveVersionID: tv.ID,
|
||||
})
|
||||
ws := dbgen.Workspace(t, store, database.Workspace{
|
||||
ws := dbgen.Workspace(t, store, database.WorkspaceTable{
|
||||
TemplateID: tpl.ID,
|
||||
OwnerID: user.ID,
|
||||
OrganizationID: org.ID,
|
||||
|
||||
@@ -149,7 +149,7 @@ func TestTracker_MultipleInstances(t *testing.T) {
|
||||
numWorkspaces := 10
|
||||
w := make([]dbfake.WorkspaceResponse, numWorkspaces)
|
||||
for i := 0; i < numWorkspaces; i++ {
|
||||
wr := dbfake.WorkspaceBuild(t, db, database.Workspace{
|
||||
wr := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
|
||||
OwnerID: owner.UserID,
|
||||
OrganizationID: owner.OrganizationID,
|
||||
LastUsedAt: now,
|
||||
|
||||
Reference in New Issue
Block a user