Files
AnimeTV-Backend/src/modules/episode/repositories/GET/getAllEpisodeWithThumbnailLink.repository.ts
Vivy Bot f3522f6cac
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 29s
🚚 chore: move get episode with thumbnile repository file
2026-02-05 21:02:53 +07:00

35 lines
807 B
TypeScript

import { AppError } from "../../../../helpers/error/instances/app";
import { episodeModel } from "../../episode.model";
export const getAllEpisodeWithThumbnailLinkRepository = async (
serviceReferenceId: string,
) => {
try {
return await episodeModel.findMany({
where: {
deletedAt: null,
},
select: {
id: true,
episode: true,
videos: {
where: {
deletedAt: null,
serviceId: serviceReferenceId,
},
select: {
code: true,
service: {
select: {
endpointThumbnail: true,
},
},
},
},
},
});
} catch (error) {
throw new AppError(500, "Failed to get all episode thumbnails", error);
}
};