feat: add service to fetch all videos from videoService

This commit is contained in:
2026-02-21 20:46:25 +07:00
parent 1038ad068f
commit 46d7dc8da8
4 changed files with 56 additions and 2 deletions

View File

@ -48,7 +48,8 @@ export const updateAllEpisodeThumbnailController = async (
return returnWriteResponse(
ctx.set,
204,
`Updating ${newEpisodeThumbnailsCount} episode thumbnails successfully.`,
`Updating episode thumbnails successfully.`,
newEpisodeThumbnailsCount,
);
} catch (error) {
return mainErrorHandler(ctx.set, error);

View File

@ -1,5 +1,6 @@
import { AppError } from "../../../../helpers/error/instances/app";
import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder";
import { getAllVideoServiceWithEpisodeRepository } from "../../../videoService/repositories/GET/getAllVideoServiceWithEpisode.repository";
export const updateAllEpisodeThumbnailService = async (
serviceReferenceId?: string,
@ -8,7 +9,17 @@ export const updateAllEpisodeThumbnailService = async (
if (!serviceReferenceId)
throw new AppError(400, "Service Reference ID is required.");
return serviceReferenceId;
const videosData = await getAllVideoServiceWithEpisodeRepository(
serviceReferenceId,
);
if (!videosData || videosData.length === 0)
throw new AppError(
404,
"No episode with no thumbnail found in the specified video service.",
);
return videosData;
} catch (error) {
ErrorForwarder(error);
}