diff --git a/src/modules/internal/services/http/updateAllEpisodeThumbnail.service.ts b/src/modules/internal/services/http/updateAllEpisodeThumbnail.service.ts index 2478c29..1c47c1e 100644 --- a/src/modules/internal/services/http/updateAllEpisodeThumbnail.service.ts +++ b/src/modules/internal/services/http/updateAllEpisodeThumbnail.service.ts @@ -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); }