👔 feat: add logic to replace placeholder with thumbnail code

This commit is contained in:
2026-02-21 20:52:10 +07:00
parent 46d7dc8da8
commit 2a3467a737

View File

@ -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);
}