diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-21 12:31:39 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-21 12:31:39 -0600 |
| commit | ab8075f02f50d8bd0be3c23b87e63f10828528ed (patch) | |
| tree | 9ba0cdcfaf708bf0a5dec931057f6b65ff12fd8e /app/controllers/sparkles | |
| parent | cb4144edda6d64cd0f3defdadfdbec57de28c27e (diff) | |
refactor: convert Repository to Repository[T Entity]
Diffstat (limited to 'app/controllers/sparkles')
| -rw-r--r-- | app/controllers/sparkles/controller.go | 4 | ||||
| -rw-r--r-- | app/controllers/sparkles/controller_test.go | 4 |
2 files changed, 4 insertions, 4 deletions
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) |
