import type { ServiceMethodFactory } from "@ethicdevs/react-monolith";
import type { Pipeline } from "@prisma/client";
import type { PipelineServiceDeps } from "./types";
const makeListByRepo: ServiceMethodFactory<
PipelineServiceDeps,
[string, string],
Promise<Pipeline[]>
> = ({ request }) => {
return async (orgSlug: string, repoSlug: string) => {
return request.prisma.pipeline.findMany({
where: {
repo: {
organization: {
slug: orgSlug,
},
slug: repoSlug,
},
},
orderBy: { createdAt: "desc" },
});
};
};
export default makeListByRepo;