import type { ReqHandler } from "@ethicdevs/react-monolith";
import { AppRoute, AppRouteParams } from "../../routes.defs";
import { makePipelineService } from "../../services/pipelines";
import PipelinesView, {
PipelinesViewProps,
} from "../../views/pipelines/PipelinesView";
const getPipelinesView: ReqHandler<
AppRouteParams,
AppRoute.REPOSITORY_PIPELINES_LIST
> = async (request, reply) => {
const { orgSlug, repoSlug } = request.params;
const pipelineService = makePipelineService({ request, runner: {} });
const pipelines = await pipelineService.listByRepo(orgSlug, repoSlug);
const reqHandler = reply.makeRequestHandler(request, reply);
return reqHandler<PipelinesViewProps>(PipelinesView.name, {
pipelines,
orgSlug,
repoSlug,
});
};
export default getPipelinesView;