diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-20 07:06:04 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-20 07:06:04 +0300 |
| commit | 9d41de31153286103f73f6188049413a8c0d45ed (patch) | |
| tree | bfb4585ff0606b512b1e3fbd4233ccef38f0f75c | |
| parent | 7c8e71b85d6475576bc1d22472ee399de7b62247 (diff) | |
Embed CoreStore in service store interfaces (ca)
Several per-service Store interfaces declared the same four-repo
block (UserRepo + SetRepo + SetPermissionRepo + MediaRepo) verbatim.
Extract that into a CoreStore interface and have MediaServiceStore,
AdminServiceStore, AccessHelperStore, BrowseServiceStore, and
WriteServiceStore embed it. Repository structurally still satisfies
every interface; tests unaffected.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
| -rw-r--r-- | player-server/internal/repository/repository.go | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/player-server/internal/repository/repository.go b/player-server/internal/repository/repository.go index e4b28c7..8848c41 100644 --- a/player-server/internal/repository/repository.go +++ b/player-server/internal/repository/repository.go @@ -25,12 +25,21 @@ type Store interface { PodcastRepo } -// MediaServiceStore is the subset of Store required by service.MediaService. -type MediaServiceStore interface { +// CoreStore is the common subset embedded by service-specific store +// interfaces that need to look up users, sets, set permissions, and media +// items. Embedding CoreStore deduplicates the four-repo block that +// previously appeared verbatim in MediaServiceStore, AdminServiceStore, +// AccessHelperStore, BrowseServiceStore, and WriteServiceStore. +type CoreStore interface { UserRepo SetRepo SetPermissionRepo MediaRepo +} + +// MediaServiceStore is the subset of Store required by service.MediaService. +type MediaServiceStore interface { + CoreStore TagRepo FavoriteRepo PlaybackProgressRepo @@ -39,19 +48,16 @@ type MediaServiceStore interface { } // AdminServiceStore is the subset of Store required by service.AdminService. +// AdminServiceStore needs exactly the CoreStore method set. type AdminServiceStore interface { - UserRepo - SetRepo - SetPermissionRepo - MediaRepo + CoreStore } // AccessHelperStore is the subset of Store required by service.accessHelper. +// accessHelper resolves user access to sets and media, so it needs exactly +// the CoreStore method set. type AccessHelperStore interface { - UserRepo - MediaRepo - SetRepo - SetPermissionRepo + CoreStore } // ProgressServiceStore is the subset of Store required by service.ProgressService. @@ -80,10 +86,7 @@ type ScannerStore interface { // BrowseServiceStore is the subset of Store required by service.BrowseService. type BrowseServiceStore interface { - UserRepo - SetRepo - SetPermissionRepo - MediaRepo + CoreStore TagRepo FavoriteRepo PlaybackProgressRepo @@ -91,11 +94,9 @@ type BrowseServiceStore interface { } // WriteServiceStore is the subset of Store required by service.WriteService. +// WriteServiceStore needs exactly the CoreStore method set. type WriteServiceStore interface { - UserRepo - SetRepo - SetPermissionRepo - MediaRepo + CoreStore } // ShareServiceStore is the subset of Store required by service.ShareService. |
