feat: add endpoint to get all episodes by media
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 57s

This commit is contained in:
2026-02-04 23:31:12 +07:00
parent d6fa5efaff
commit c1f90c40f2
4 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import { AppError } from "../../../../helpers/error/instances/app";
import { mediaModel } from "../../../media/model";
export const getAllEpisodeFromMediaRepository = async (mediaSlug: string) => {
try {
return mediaModel.findUnique({
where: { slug: mediaSlug },
select: {
episodes: {
select: {
id: true,
name: true,
episode: true,
pictureThumbnail: true,
},
},
},
});
} catch (error) {
throw new AppError(500, "Failed to fetch episodes from media", error);
}
};