phase 3 17 admin panel
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user