Some checks failed
Integration Tests / integration-tests (pull_request) Failing after 29s
45 lines
966 B
TypeScript
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,
|
|
);
|
|
}
|
|
};
|