Files
AnimeTV-Backend/src/modules/media/repositories/GET/getAllMedia.repository.ts
Vivy Bot 4b9ade64c3
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 56s
feat: add get all media endpoint
2026-02-03 15:25:15 +07:00

18 lines
457 B
TypeScript

import { AppError } from "../../../../helpers/error/instances/app";
import { mediaModel } from "../../model";
export const getAllMediaRepository = async (page: number) => {
try {
const limit = 10;
return await mediaModel.findMany({
take: limit,
skip: (page - 1) * limit,
where: {
deletedAt: null,
},
});
} catch (error) {
throw new AppError(500, "Failed to get all media from repository", error);
}
};