Skip to content

🎧 Your Personal Streaming Service

Removed unused code

Deluand57f51c7ac5d
diff --git a/domain/artist.go b/domain/artist.go
index 9c4210bf0..90ebc9dd9 100644
--- a/domain/artist.go
+++ b/domain/artist.go
@@ -9,7 +9,6 @@ type ArtistRepository interface {
BaseRepository
Put(m *Artist) error
Get(id string) (*Artist, error)
- GetByName(name string) (*Artist, error)
PurgeInactive(active Artists) ([]string, error)
}
diff --git a/domain/base.go b/domain/base.go
index adb3798c7..5cfade5b5 100644
--- a/domain/base.go
+++ b/domain/base.go
@@ -3,7 +3,6 @@ package domain
import "errors"
type BaseRepository interface {
- NewId(fields ...string) string
CountAll() (int64, error)
Exists(id string) (bool, error)
}
diff --git a/persistence/artist_repository.go b/persistence/artist_repository.go
index a7c9c2d31..5f39775f1 100644
--- a/persistence/artist_repository.go
+++ b/persistence/artist_repository.go
@@ -29,11 +29,6 @@ func (r *artistRepository) Get(id string) (*domain.Artist, error) {
return rec.(*domain.Artist), err
}
-func (r *artistRepository) GetByName(name string) (*domain.Artist, error) {
- id := r.NewId(name)
- return r.Get(id)
-}
-
func (r *artistRepository) PurgeInactive(active domain.Artists) ([]string, error) {
return r.purgeInactive(active, func(e interface{}) string {
return e.(domain.Artist).Id
diff --git a/persistence/ledis_repository.go b/persistence/ledis_repository.go
index 3001f1897..652a0cbe9 100644
--- a/persistence/ledis_repository.go
+++ b/persistence/ledis_repository.go
@@ -54,7 +54,7 @@ func (r *ledisRepository) parseAnnotations(entity interface{}) {
}
// TODO Use annotations to specify fields to be used
-func (r *ledisRepository) NewId(fields ...string) string {
+func (r *ledisRepository) newId(fields ...string) string {
s := fmt.Sprintf("%s\\%s", strings.ToUpper(r.table), strings.Join(fields, ""))
return fmt.Sprintf("%x", md5.Sum([]byte(s)))
}
diff --git a/persistence/ledis_repository_test.go b/persistence/ledis_repository_test.go
index ab102af05..356578d21 100644
--- a/persistence/ledis_repository_test.go
+++ b/persistence/ledis_repository_test.go
@@ -90,15 +90,15 @@ func TestBaseRepository(t *testing.T) {
repo := createEmptyRepo()
Convey("When I call NewId with a name", func() {
- Id := repo.NewId("a name")
+ Id := repo.newId("a name")
Convey("Then it should return a new Id", func() {
So(Id, ShouldNotBeEmpty)
})
})
Convey("When I call NewId with the same name twice", func() {
- FirstId := repo.NewId("a name")
- SecondId := repo.NewId("a name")
+ FirstId := repo.newId("a name")
+ SecondId := repo.newId("a name")
Convey("Then it should return the same Id each time", func() {
So(FirstId, ShouldEqual, SecondId)
@@ -107,8 +107,8 @@ func TestBaseRepository(t *testing.T) {
})
Convey("When I call NewId with different names", func() {
- FirstId := repo.NewId("first name")
- SecondId := repo.NewId("second name")
+ FirstId := repo.newId("first name")
+ SecondId := repo.newId("second name")
Convey("Then it should return different Ids", func() {
So(FirstId, ShouldNotEqual, SecondId)