feat: add upcoming seasons sync and notification for sequels
This commit is contained in:
@@ -328,5 +328,12 @@ func (h *Handler) HandleNotifications(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
templates.Notifications(watching).Render(r.Context(), w)
|
||||
upcomingSeasons, err := h.svc.GetUpcomingSeasons(r.Context(), userID)
|
||||
if err != nil {
|
||||
log.Printf("upcoming seasons error: %v", err)
|
||||
http.Error(w, "Failed to fetch upcoming seasons", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
templates.Notifications(watching, upcomingSeasons).Render(r.Context(), w)
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ func (s *Service) GetWatchingAnime(ctx context.Context, userID string) ([]templa
|
||||
// Skip if we can't fetch anime details
|
||||
continue
|
||||
}
|
||||
|
||||
result = append(result, templates.WatchingAnimeWithDetails{
|
||||
Entry: row,
|
||||
Anime: anime,
|
||||
@@ -91,3 +90,11 @@ func (s *Service) GetWatchingAnime(ctx context.Context, userID string) ([]templa
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *Service) GetUpcomingSeasons(ctx context.Context, userID string) ([]database.GetUpcomingSeasonsRow, error) {
|
||||
rows, err := s.db.GetUpcomingSeasons(ctx, userID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get upcoming seasons: %w", err)
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user