✨ feat: add service to fetch all videos from videoService
This commit is contained in:
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user