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:
@@ -232,7 +232,7 @@ func WorkspaceAgentScriptTiming(t testing.TB, db database.Store, orig database.W
|
||||
return timing
|
||||
}
|
||||
|
||||
func Workspace(t testing.TB, db database.Store, orig database.Workspace) database.Workspace {
|
||||
func Workspace(t testing.TB, db database.Store, orig database.WorkspaceTable) database.WorkspaceTable {
|
||||
t.Helper()
|
||||
|
||||
workspace, err := db.InsertWorkspace(genCtx, database.InsertWorkspaceParams{
|
||||
|
||||
@@ -128,8 +128,8 @@ func TestGenerator(t *testing.T) {
|
||||
t.Run("Workspace", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
db := dbmem.New()
|
||||
exp := dbgen.Workspace(t, db, database.Workspace{})
|
||||
require.Equal(t, exp, must(db.GetWorkspaceByID(context.Background(), exp.ID)))
|
||||
exp := dbgen.Workspace(t, db, database.WorkspaceTable{})
|
||||
require.Equal(t, exp, must(db.GetWorkspaceByID(context.Background(), exp.ID)).WorkspaceTable())
|
||||
})
|
||||
|
||||
t.Run("WorkspaceAgent", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user