watchlist: reset progress when marking anime as completed

This commit is contained in:
2026-04-26 18:15:50 +02:00
parent 098b4a1fc0
commit 068e95a900

View File

@@ -101,14 +101,15 @@ func (s *Service) CompleteAnime(ctx context.Context, userID string, animeID int6
UserID: userID,
AnimeID: animeID,
Status: "completed",
CurrentEpisode: sql.NullInt64{Int64: int64(episode), Valid: true},
CurrentEpisode: sql.NullInt64{Int64: 0, Valid: false},
CurrentTimeSeconds: 0,
UpdatedAt: sql.NullTime{Valid: true},
}); err != nil {
return fmt.Errorf("failed to mark watchlist as completed: %w", err)
}
if err := txQueries.SaveWatchProgress(ctx, database.SaveWatchProgressParams{
CurrentEpisode: sql.NullInt64{Int64: int64(episode), Valid: true},
CurrentEpisode: sql.NullInt64{Int64: 0, Valid: false},
CurrentTimeSeconds: 0,
UserID: userID,
AnimeID: animeID,