diff --git a/db/workspaces.go b/db/workspaces.go index 8e3f1ea92..896203ab2 100644 --- a/db/workspaces.go +++ b/db/workspaces.go @@ -58,6 +58,14 @@ func (db database) CreateOrEditWorkspace(m Workspace) (Workspace, error) { return m, nil } +func (db database) DeleteWorkspace() (bool, error) { + result := db.db.Exec("DELETE FROM workspaces") + if result.Error != nil { + return false, result.Error + } + return true, nil +} + func (db database) CreateOrEditWorkspaceRepository(m WorkspaceRepositories) (WorkspaceRepositories, error) { m.Name = strings.TrimSpace(m.Name) m.Url = strings.TrimSpace(m.Url) diff --git a/handlers/workspaces_test.go b/handlers/workspaces_test.go index 87eb8b7a9..ae9a057a6 100644 --- a/handlers/workspaces_test.go +++ b/handlers/workspaces_test.go @@ -1206,6 +1206,8 @@ func TestGetUserDropdownWorkspaces(t *testing.T) { oHandler := NewWorkspaceHandler(db.TestDB) + db.TestDB.DeleteWorkspace() + person := db.Person{ Uuid: "uuid", OwnerAlias: "alias",