sendou.ink/app/features/api-public/routes/tournament.$id.players.ts
2026-01-25 22:13:00 +02:00

23 lines
682 B
TypeScript

import type { LoaderFunctionArgs } from "react-router";
import { z } from "zod";
import * as TournamentMatchRepository from "~/features/tournament-bracket/TournamentMatchRepository.server";
import { parseParams } from "~/utils/remix.server";
import { id } from "~/utils/zod";
import type { GetTournamentPlayersResponse } from "../schema";
const paramsSchema = z.object({
id,
});
export const loader = async ({ params }: LoaderFunctionArgs) => {
const { id } = parseParams({
params,
schema: paramsSchema,
});
const participants: GetTournamentPlayersResponse =
await TournamentMatchRepository.userParticipationByTournamentId(id);
return Response.json(participants);
};