🚚 chore: move get episode with thumbnile repository file
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 29s
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 29s
This commit is contained in:
@ -0,0 +1,34 @@
|
||||
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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user