fix: filter out docs that don't match podcast episodes
This commit is contained in:
parent
3363b15587
commit
584d4535ca
|
@ -22,7 +22,7 @@ export const PodcastEpisodeDataType: UnbodyDataTypeConfig<
|
||||||
isMatch: (helpers, data, original) =>
|
isMatch: (helpers, data, original) =>
|
||||||
original
|
original
|
||||||
? original.pathString.includes('/Podcasts/') &&
|
? original.pathString.includes('/Podcasts/') &&
|
||||||
original.slug.startsWith('ep')
|
/^ep\d+-\d{8}-.*/.test(original.slug)
|
||||||
: false,
|
: false,
|
||||||
|
|
||||||
transform: async (helpers, data, original, root, context) => {
|
transform: async (helpers, data, original, root, context) => {
|
||||||
|
@ -97,7 +97,6 @@ export const PodcastEpisodeDataType: UnbodyDataTypeConfig<
|
||||||
coverImage,
|
coverImage,
|
||||||
show,
|
show,
|
||||||
showId: show?.id,
|
showId: show?.id,
|
||||||
featured: data.featured,
|
|
||||||
highlighted: data.highlighted,
|
highlighted: data.highlighted,
|
||||||
type: LPE.PostTypes.Podcast,
|
type: LPE.PostTypes.Podcast,
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,12 +519,14 @@ export class UnbodyService {
|
||||||
shows = [...data]
|
shows = [...data]
|
||||||
}
|
}
|
||||||
|
|
||||||
return unbodyDataTypes.transformMany<LPE.Podcast.Document>(
|
return unbodyDataTypes
|
||||||
podcastEpisodeDocument,
|
.transformMany<LPE.Podcast.Document>(
|
||||||
docs,
|
podcastEpisodeDocument,
|
||||||
undefined,
|
docs,
|
||||||
{ shows, parseContent },
|
undefined,
|
||||||
)
|
{ shows, parseContent },
|
||||||
|
)
|
||||||
|
.then((res) => res.filter((obj) => obj && obj.type === 'podcast'))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
getPodcastEpisode = ({
|
getPodcastEpisode = ({
|
||||||
|
|
Loading…
Reference in New Issue