✨ feat: add endpoint to get all episodes by media
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 57s
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 57s
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
import { AppError } from "../../../../helpers/error/instances/app";
|
||||
import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder";
|
||||
import { getAllEpisodeFromMediaRepository } from "../../repositories/GET/getAllEpisodeFromMedia.repository";
|
||||
|
||||
export const getAllEpisodeFromSpecificMediaService = async (
|
||||
mediaSlug: string,
|
||||
) => {
|
||||
try {
|
||||
const mediaData = await getAllEpisodeFromMediaRepository(mediaSlug);
|
||||
if (!mediaData)
|
||||
throw new AppError(404, `Media with slug ${mediaSlug} not found`);
|
||||
return mediaData.episodes;
|
||||
} catch (error) {
|
||||
ErrorForwarder(error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user