fix(watchlist): clear progress on continue delete
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package watchlist
|
package watchlist
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
"log"
|
||||||
@@ -240,6 +241,17 @@ func (h *Handler) HandleDeleteContinueWatching(w http.ResponseWriter, r *http.Re
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := h.svc.db.SaveWatchProgress(r.Context(), database.SaveWatchProgressParams{
|
||||||
|
CurrentEpisode: sql.NullInt64{Valid: false},
|
||||||
|
CurrentTimeSeconds: 0,
|
||||||
|
UserID: user.ID,
|
||||||
|
AnimeID: animeID,
|
||||||
|
}); err != nil {
|
||||||
|
log.Printf("continue watching delete failed to clear watchlist progress: user_id=%s anime_id=%d err=%v", user.ID, animeID, err)
|
||||||
|
http.Error(w, "failed to delete continue watching entry", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user