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:
Steven Masley
2024-10-22 09:20:54 -05:00
committed by GitHub
parent 5076161078
commit 343f8ec9ab
81 changed files with 1063 additions and 735 deletions

View File

@ -106,7 +106,7 @@ func New(opts Options) *API {
if err != nil {
return uuid.Nil, err
}
return ws.Workspace.ID, nil
return ws.ID, nil
},
}
@ -231,9 +231,9 @@ func (a *API) workspaceID(ctx context.Context, agent *database.WorkspaceAgent) (
}
a.mu.Lock()
a.cachedWorkspaceID = getWorkspaceAgentByIDRow.Workspace.ID
a.cachedWorkspaceID = getWorkspaceAgentByIDRow.ID
a.mu.Unlock()
return getWorkspaceAgentByIDRow.Workspace.ID, nil
return getWorkspaceAgentByIDRow.ID, nil
}
func (a *API) publishWorkspaceUpdate(ctx context.Context, agent *database.WorkspaceAgent) error {