feat: migrate watchlist module to modular domain pattern

This commit is contained in:
2026-05-13 10:33:24 +02:00
parent c32ffd54de
commit c94a2fed04
6 changed files with 256 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package repository
import (
"context"
"mal/internal/db"
"mal/internal/domain"
)
type watchlistRepository struct {
queries *db.Queries
}
func NewWatchlistRepository(queries *db.Queries) domain.WatchlistRepository {
return &watchlistRepository{queries: queries}
}
func (r *watchlistRepository) UpsertAnime(ctx context.Context, arg db.UpsertAnimeParams) (db.Anime, error) {
return r.queries.UpsertAnime(ctx, arg)
}
func (r *watchlistRepository) GetAnime(ctx context.Context, id int64) (db.Anime, error) {
return r.queries.GetAnime(ctx, id)
}
func (r *watchlistRepository) UpsertWatchListEntry(ctx context.Context, arg db.UpsertWatchListEntryParams) (db.WatchListEntry, error) {
return r.queries.UpsertWatchListEntry(ctx, arg)
}
func (r *watchlistRepository) DeleteWatchListEntry(ctx context.Context, arg db.DeleteWatchListEntryParams) error {
return r.queries.DeleteWatchListEntry(ctx, arg)
}
func (r *watchlistRepository) GetUserWatchList(ctx context.Context, userID string) ([]db.GetUserWatchListRow, error) {
return r.queries.GetUserWatchList(ctx, userID)
}
func (r *watchlistRepository) DeleteContinueWatchingEntry(ctx context.Context, arg db.DeleteContinueWatchingEntryParams) error {
return r.queries.DeleteContinueWatchingEntry(ctx, arg)
}
func (r *watchlistRepository) SaveWatchProgress(ctx context.Context, arg db.SaveWatchProgressParams) error {
return r.queries.SaveWatchProgress(ctx, arg)
}