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:
@@ -49,7 +49,7 @@ func TestCache_TemplateWorkspaceOwners(t *testing.T) {
|
||||
"TemplateWorkspaceOwners never populated 0 owners",
|
||||
)
|
||||
|
||||
dbgen.Workspace(t, db, database.Workspace{
|
||||
dbgen.Workspace(t, db, database.WorkspaceTable{
|
||||
TemplateID: template.ID,
|
||||
OwnerID: user1.ID,
|
||||
})
|
||||
@@ -61,7 +61,7 @@ func TestCache_TemplateWorkspaceOwners(t *testing.T) {
|
||||
"TemplateWorkspaceOwners never populated 1 owner",
|
||||
)
|
||||
|
||||
workspace2 := dbgen.Workspace(t, db, database.Workspace{
|
||||
workspace2 := dbgen.Workspace(t, db, database.WorkspaceTable{
|
||||
TemplateID: template.ID,
|
||||
OwnerID: user2.ID,
|
||||
})
|
||||
@@ -74,7 +74,7 @@ func TestCache_TemplateWorkspaceOwners(t *testing.T) {
|
||||
)
|
||||
|
||||
// 3rd workspace should not be counted since we have the same owner as workspace2.
|
||||
dbgen.Workspace(t, db, database.Workspace{
|
||||
dbgen.Workspace(t, db, database.WorkspaceTable{
|
||||
TemplateID: template.ID,
|
||||
OwnerID: user1.ID,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user