Allow board delete via UI

ref #16
This commit is contained in:
2019-12-13 13:28:59 +01:00
parent 1dedda7d50
commit 860ee438fc
12 changed files with 117 additions and 20 deletions

View File

@ -1,5 +1,13 @@
package repository
import (
"github.com/pkg/errors"
)
var (
ErrNotFound = errors.New("not found")
)
type Repository struct {
boards BoardRepository
}

View File

@ -61,6 +61,18 @@ func (r *BoardRepository) Save(board *repository.Board) error {
}
func (r *BoardRepository) Delete(id repository.BoardID) error {
b := &boardItem{
ID: string(id),
}
if err := r.db.DeleteStruct(b); err != nil {
if err == storm.ErrNotFound {
return repository.ErrNotFound
}
return errors.Wrapf(err, "could not delete board '%s'", id)
}
return nil
}