feat: implement backend podcast subscription controllers and frontend library page with optimistic updates

This commit is contained in:
Michael committed 2026-04-16 13:07:46 +02:00
1 parent 38521c45dc
commit 872ef5c31a
5 files changed
+92 -25

No files matched your search

+16 -3
View File
@@ -195,6 +195,12 @@ export const rssParserService = {
// Update podcast metadata
podcast.lastFetched = new Date();
podcast.episodeCount = await Episode.countDocuments({ podcastId });
if (episodes.length > 0) {
podcast.lastEpisodeTitle = episodes[0].title;
podcast.lastEpisodeDate = episodes[0].pubDate;
}
await podcast.save();
const result = {
@@ -231,9 +237,10 @@ export const rssParserService = {
throw new Error('Podcast already in database');
}
// Parse feed if not provided
if (!feedData) {
feedData = await rssParserService.parseFeed(rssUrl);
// Always parse feed to get fresh description and episodes, even if partial data provided
if (!feedData || !feedData.description || !feedData.episodes || feedData.episodes.length === 0) {
const freshData = await rssParserService.parseFeed(rssUrl);
feedData = { ...feedData, ...freshData };
}
// Create podcast
@@ -275,6 +282,12 @@ export const rssParserService = {
podcast.episodeCount = await Episode.countDocuments({ podcastId: podcast._id });
podcast.lastFetched = new Date();
if (episodes.length > 0) {
podcast.lastEpisodeTitle = episodes[0].title;
podcast.lastEpisodeDate = episodes[0].pubDate;
}
await podcast.save();
return {