watchlist: reset progress when marking anime as completed
This commit is contained in:
@@ -101,14 +101,15 @@ func (s *Service) CompleteAnime(ctx context.Context, userID string, animeID int6
|
|||||||
UserID: userID,
|
UserID: userID,
|
||||||
AnimeID: animeID,
|
AnimeID: animeID,
|
||||||
Status: "completed",
|
Status: "completed",
|
||||||
CurrentEpisode: sql.NullInt64{Int64: int64(episode), Valid: true},
|
CurrentEpisode: sql.NullInt64{Int64: 0, Valid: false},
|
||||||
CurrentTimeSeconds: 0,
|
CurrentTimeSeconds: 0,
|
||||||
|
UpdatedAt: sql.NullTime{Valid: true},
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("failed to mark watchlist as completed: %w", err)
|
return fmt.Errorf("failed to mark watchlist as completed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := txQueries.SaveWatchProgress(ctx, database.SaveWatchProgressParams{
|
if err := txQueries.SaveWatchProgress(ctx, database.SaveWatchProgressParams{
|
||||||
CurrentEpisode: sql.NullInt64{Int64: int64(episode), Valid: true},
|
CurrentEpisode: sql.NullInt64{Int64: 0, Valid: false},
|
||||||
CurrentTimeSeconds: 0,
|
CurrentTimeSeconds: 0,
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
AnimeID: animeID,
|
AnimeID: animeID,
|
||||||
|
|||||||
Reference in New Issue
Block a user