feat: endpoint for bulk insert video

This commit is contained in:
2026-01-30 15:56:43 +07:00
parent ab0c8afca4
commit 11a607b4da
7 changed files with 122 additions and 0 deletions

View File

@ -0,0 +1,28 @@
import { AppError } from "../../../helpers/error/instances/app";
import { prisma } from "../../../utils/databases/prisma/connection";
export const findEpisodeWithMediaIdRepository = async ({
media,
episode,
}: {
media: string;
episode: number;
}) => {
try {
const foundEpisode = await prisma.episode.findUnique({
where: {
mediaId_episode: {
mediaId: media,
episode: episode,
},
},
select: {
id: true,
},
});
if (!foundEpisode) throw new AppError(404, "Episode not found");
return foundEpisode;
} catch (error) {
throw new AppError(500, "Error finding episode with media id", error);
}
};