Skip to content

Commit 6b75cbf

Browse files
committed
structs 4 u
1 parent ba9f777 commit 6b75cbf

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

coderd/workspaces.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,13 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req
386386
return
387387
}
388388

389-
user := database.User{
389+
owner := workspaceOwner{
390390
ID: member.UserID,
391391
Username: member.Username,
392392
AvatarURL: member.AvatarURL,
393393
}
394394

395-
createWorkspace(ctx, aReq, apiKey.UserID, api, user, req, rw, r)
395+
createWorkspace(ctx, aReq, apiKey.UserID, api, owner, req, rw, r)
396396
}
397397

398398
// Create a new workspace for the currently authenticated user.
@@ -436,15 +436,26 @@ func (api *API) postUserWorkspaces(rw http.ResponseWriter, r *http.Request) {
436436
return
437437
}
438438

439-
createWorkspace(ctx, aReq, apiKey.UserID, api, user, req, rw, r)
439+
owner := workspaceOwner{
440+
ID: user.ID,
441+
Username: user.Username,
442+
AvatarURL: user.AvatarURL,
443+
}
444+
createWorkspace(ctx, aReq, apiKey.UserID, api, owner, req, rw, r)
445+
}
446+
447+
type workspaceOwner struct {
448+
ID uuid.UUID
449+
Username string
450+
AvatarURL string
440451
}
441452

442453
func createWorkspace(
443454
ctx context.Context,
444455
auditReq *audit.Request[database.Workspace],
445456
initiatorID uuid.UUID,
446457
api *API,
447-
user database.User,
458+
owner workspaceOwner,
448459
req codersdk.CreateWorkspaceRequest,
449460
rw http.ResponseWriter,
450461
r *http.Request,

0 commit comments

Comments
 (0)