Skip to content

Commit

Permalink
delete previous workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulWahab3181 committed Jul 4, 2024
1 parent 41f264b commit 3597d2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions db/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions handlers/workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,8 @@ func TestGetUserDropdownWorkspaces(t *testing.T) {

oHandler := NewWorkspaceHandler(db.TestDB)

db.TestDB.DeleteWorkspace()

person := db.Person{
Uuid: "uuid",
OwnerAlias: "alias",
Expand Down

0 comments on commit 3597d2c

Please sign in to comment.