phase 3 17 admin panel

This commit is contained in:
2026-03-06 19:53:08 +00:00
parent 8fb576afc7
commit 94fa7c2df1
3 changed files with 378 additions and 1 deletions

View File

@@ -120,4 +120,52 @@ export async function processPaymentWebhook(ticketId: number): Promise<void> {
});
}
// ─── Admin: Tournaments ───────────────────────────────────────────────────────
export interface TournamentCreate {
title: string;
description?: string;
event_date: string; // ISO-8601
}
export interface TournamentAdminResponse {
id: number;
title: string;
description: string | null;
event_date: string;
}
export interface SectorConfigInput {
sector_name: string;
rows: number;
seats_per_row: number;
price: number;
}
/**
* POST /api/tournaments
* Creates a new tournament. Requires a superuser token (403 otherwise).
*/
export async function createTournamentApi(
data: TournamentCreate
): Promise<TournamentAdminResponse> {
const response = await apiClient.post<TournamentAdminResponse>("/tournaments", data);
return response.data;
}
/**
* POST /api/tournaments/{tournament_id}/generate-seats
* Bulk-generates seats for a tournament. Requires a superuser token.
*/
export async function generateSeatsApi(
tournamentId: number,
sectors: SectorConfigInput[]
): Promise<{ message: string }> {
const response = await apiClient.post<{ message: string }>(
`/tournaments/${tournamentId}/generate-seats`,
{ sectors }
);
return response.data;
}
export default apiClient;