From ab8075f02f50d8bd0be3c23b87e63f10828528ed Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 21 Apr 2025 12:31:39 -0600 Subject: refactor: convert Repository to Repository[T Entity] --- app/controllers/sparkles/controller.go | 4 ++-- app/controllers/sparkles/controller_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/sparkles/controller.go b/app/controllers/sparkles/controller.go index 061b5c6..bc388db 100644 --- a/app/controllers/sparkles/controller.go +++ b/app/controllers/sparkles/controller.go @@ -9,10 +9,10 @@ import ( ) type Controller struct { - db db.Repository + db db.Repository[*domain.Sparkle] } -func New(db db.Repository) *Controller { +func New(db db.Repository[*domain.Sparkle]) *Controller { return &Controller{db: db} } diff --git a/app/controllers/sparkles/controller_test.go b/app/controllers/sparkles/controller_test.go index 17bc338..99fdd69 100644 --- a/app/controllers/sparkles/controller_test.go +++ b/app/controllers/sparkles/controller_test.go @@ -15,7 +15,7 @@ import ( func TestSparkles(t *testing.T) { t.Run("GET /sparkles", func(t *testing.T) { sparkle, _ := domain.NewSparkle("@tanuki for helping me") - store := db.NewRepository() + store := db.NewRepository[*domain.Sparkle]() store.Save(sparkle) mux := http.NewServeMux() @@ -43,7 +43,7 @@ func TestSparkles(t *testing.T) { t.Run("POST /sparkles", func(t *testing.T) { t.Run("saves a new sparkle", func(t *testing.T) { - repository := db.NewRepository() + repository := db.NewRepository[*domain.Sparkle]() mux := http.NewServeMux() controller := New(repository) controller.MountTo(mux) -- cgit v1.2.3