👔 feat: add logic to replace placeholder with thumbnail code
This commit is contained in:
@ -19,7 +19,20 @@ export const updateAllEpisodeThumbnailService = async (
|
||||
"No episode with no thumbnail found in the specified video service.",
|
||||
);
|
||||
|
||||
return videosData;
|
||||
const updatePayload = videosData.map((videoService) => {
|
||||
const { endpointThumbnail, videos } = videoService;
|
||||
return videos
|
||||
.filter((video) => video.thumbnailCode !== null)
|
||||
.map((video) => ({
|
||||
episodeId: video.episode.id,
|
||||
thumbnailCode: endpointThumbnail?.replace(
|
||||
":code:",
|
||||
video.thumbnailCode!,
|
||||
),
|
||||
}));
|
||||
});
|
||||
|
||||
return updatePayload;
|
||||
} catch (error) {
|
||||
ErrorForwarder(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user