From 89e0120ca60c86dee0b90cf4844f60bbf5ae93f7 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Wed, 13 May 2026 18:16:14 +0200 Subject: [PATCH] feat: add GetContinueWatchingEntry to watchlist service Expose continue watching entry lookup so other handlers can check saved progress for an anime without needing the playback service. --- internal/domain/watchlist.go | 2 ++ internal/watchlist/repository/repository.go | 4 ++++ internal/watchlist/service/service.go | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/internal/domain/watchlist.go b/internal/domain/watchlist.go index b7eeed4..c7d0b17 100644 --- a/internal/domain/watchlist.go +++ b/internal/domain/watchlist.go @@ -12,6 +12,7 @@ type WatchlistService interface { UpdateEntry(ctx context.Context, userID string, animeID int64, status string) error RemoveEntry(ctx context.Context, userID string, animeID int64) error GetWatchlist(ctx context.Context, userID string) ([]UserWatchListRow, error) + GetContinueWatchingEntry(ctx context.Context, userID string, animeID int64) (db.ContinueWatchingEntry, error) DeleteContinueWatching(ctx context.Context, userID string, animeID int64) error } @@ -21,6 +22,7 @@ type WatchlistRepository interface { UpsertWatchListEntry(ctx context.Context, arg db.UpsertWatchListEntryParams) (db.WatchListEntry, error) DeleteWatchListEntry(ctx context.Context, arg db.DeleteWatchListEntryParams) error GetUserWatchList(ctx context.Context, userID string) ([]db.GetUserWatchListRow, error) + GetContinueWatchingEntry(ctx context.Context, arg db.GetContinueWatchingEntryParams) (db.ContinueWatchingEntry, error) DeleteContinueWatchingEntry(ctx context.Context, arg db.DeleteContinueWatchingEntryParams) error SaveWatchProgress(ctx context.Context, arg db.SaveWatchProgressParams) error } diff --git a/internal/watchlist/repository/repository.go b/internal/watchlist/repository/repository.go index 86cfb42..8f6b8a1 100644 --- a/internal/watchlist/repository/repository.go +++ b/internal/watchlist/repository/repository.go @@ -34,6 +34,10 @@ func (r *watchlistRepository) GetUserWatchList(ctx context.Context, userID strin return r.queries.GetUserWatchList(ctx, userID) } +func (r *watchlistRepository) GetContinueWatchingEntry(ctx context.Context, arg db.GetContinueWatchingEntryParams) (db.ContinueWatchingEntry, error) { + return r.queries.GetContinueWatchingEntry(ctx, arg) +} + func (r *watchlistRepository) DeleteContinueWatchingEntry(ctx context.Context, arg db.DeleteContinueWatchingEntryParams) error { return r.queries.DeleteContinueWatchingEntry(ctx, arg) } diff --git a/internal/watchlist/service/service.go b/internal/watchlist/service/service.go index a60a747..a51403c 100644 --- a/internal/watchlist/service/service.go +++ b/internal/watchlist/service/service.go @@ -55,6 +55,13 @@ func (s *watchlistService) GetWatchlist(ctx context.Context, userID string) ([]d return s.repo.GetUserWatchList(ctx, userID) } +func (s *watchlistService) GetContinueWatchingEntry(ctx context.Context, userID string, animeID int64) (db.ContinueWatchingEntry, error) { + return s.repo.GetContinueWatchingEntry(ctx, db.GetContinueWatchingEntryParams{ + UserID: userID, + AnimeID: animeID, + }) +} + func (s *watchlistService) DeleteContinueWatching(ctx context.Context, userID string, animeID int64) error { _ = s.repo.DeleteContinueWatchingEntry(ctx, db.DeleteContinueWatchingEntryParams{ UserID: userID,