Files
AnimeTV-Backend/src/modules/videoService/repositories/GET/getAllVideoServiceWithEpisode.repository.ts
Rafi Arrafif 482103c78a
Some checks failed
Integration Tests / integration-tests (pull_request) Failing after 29s
🚨 fix: resolve linting type error
2026-02-22 11:00:50 +07:00

45 lines
966 B
TypeScript

import { AppError } from "../../../../helpers/error/instances/app";
import { videoServiceModel } from "../../model";
export const getAllVideoServiceWithEpisodeRepository = async (
videoServiceId: string,
) => {
try {
return await videoServiceModel.findMany({
where: {
id: videoServiceId,
endpointThumbnail: {
not: null,
},
videos: {
some: {
episode: {
pictureThumbnail: null,
},
},
},
},
select: {
endpointThumbnail: true,
videos: {
select: {
thumbnailCode: true,
videoCode: true,
episode: {
select: {
id: true,
},
},
},
},
},
});
} catch (error) {
throw new AppError(
500,
"An error occurred while fetching video services with episodes.",
error,
);
}
};