fix: filter out docs that don't match podcast episodes

This commit is contained in:
Hossein Mehrabi 2023-08-18 14:23:46 +03:30
parent 3363b15587
commit 584d4535ca
No known key found for this signature in database
GPG Key ID: 45C04964191AFAA1
2 changed files with 9 additions and 8 deletions

View File

@ -22,7 +22,7 @@ export const PodcastEpisodeDataType: UnbodyDataTypeConfig<
isMatch: (helpers, data, original) =>
original
? original.pathString.includes('/Podcasts/') &&
original.slug.startsWith('ep')
/^ep\d+-\d{8}-.*/.test(original.slug)
: false,
transform: async (helpers, data, original, root, context) => {
@ -97,7 +97,6 @@ export const PodcastEpisodeDataType: UnbodyDataTypeConfig<
coverImage,
show,
showId: show?.id,
featured: data.featured,
highlighted: data.highlighted,
type: LPE.PostTypes.Podcast,
}

View File

@ -519,12 +519,14 @@ export class UnbodyService {
shows = [...data]
}
return unbodyDataTypes.transformMany<LPE.Podcast.Document>(
podcastEpisodeDocument,
docs,
undefined,
{ shows, parseContent },
)
return unbodyDataTypes
.transformMany<LPE.Podcast.Document>(
podcastEpisodeDocument,
docs,
undefined,
{ shows, parseContent },
)
.then((res) => res.filter((obj) => obj && obj.type === 'podcast'))
}, [])
getPodcastEpisode = ({