diff --git a/handlers/workspaces.go b/handlers/workspaces.go index ea3b4c592..0ebc142d0 100644 --- a/handlers/workspaces.go +++ b/handlers/workspaces.go @@ -169,6 +169,13 @@ func CreateWorkspaceUser(w http.ResponseWriter, r *http.Request) { workspaceUser := db.WorkspaceUsers{} body, err := io.ReadAll(r.Body) r.Body.Close() + + if err != nil { + fmt.Println("[body] ", err) + w.WriteHeader(http.StatusNotAcceptable) + return + } + err = json.Unmarshal(body, &workspaceUser) if workspaceUser.WorkspaceUuid == "" && workspaceUser.OrgUuid != "" { @@ -278,6 +285,13 @@ func DeleteWorkspaceUser(w http.ResponseWriter, r *http.Request) { workspaceUser := db.WorkspaceUsersData{} body, err := io.ReadAll(r.Body) r.Body.Close() + + if err != nil { + fmt.Println("[body] ", err) + w.WriteHeader(http.StatusNotAcceptable) + return + } + err = json.Unmarshal(body, &workspaceUser) if workspaceUser.WorkspaceUuid == "" && workspaceUser.OrgUuid != "" { @@ -340,6 +354,13 @@ func AddUserRoles(w http.ResponseWriter, r *http.Request) { roles := []db.WorkspaceUserRoles{} body, err := io.ReadAll(r.Body) r.Body.Close() + + if err != nil { + fmt.Println("[body] ", err) + w.WriteHeader(http.StatusNotAcceptable) + return + } + err = json.Unmarshal(body, &roles) if err != nil { diff --git a/handlers/workspaces_test.go b/handlers/workspaces_test.go index 8c0ade242..e804de044 100644 --- a/handlers/workspaces_test.go +++ b/handlers/workspaces_test.go @@ -647,3 +647,43 @@ func TestGetWorkspaceBountiesCount(t *testing.T) { assert.Equal(t, bounty, fetchedBounty[0]) }) } + +func TestAddUserRoles(t *testing.T) { + +} + +func TestGetUserRoles(t *testing.T) { + +} + +func TestCreateWorkspaceUser(t *testing.T) { + +} + +func TestGetWorkspaceUsers(t *testing.T) { + +} + +func TestGetUserDropdownWorkspaces(t *testing.T) { + +} + +func TestCreateOrEditWorkspaceRepository(t *testing.T) { + +} + +func TestGetWorkspaceRepositorByWorkspaceUuid(t *testing.T) { + +} + +func TestGetWorkspaceRepoByWorkspaceUuidAndRepoUuid(t *testing.T) { + +} + +func GetFeaturesByWorkspaceUuid(t *testing.T) { + +} + +func TestDeleteWorkspaceRepository(t *testing.T) { + +}