diff --git a/src/lib/api/competition-admin.ts b/src/lib/api/competition-admin.ts index 6bd984a..8f277fd 100644 --- a/src/lib/api/competition-admin.ts +++ b/src/lib/api/competition-admin.ts @@ -88,7 +88,7 @@ function buildNetworkError(message: string): CompetitionApiResult { // ============================================================================ /** - * GET /competition/templates + * GET /competitions/templates * List competition templates */ export async function listTemplates( @@ -101,7 +101,7 @@ export async function listTemplates( if (filters?.sport_id !== undefined) params.set('sport_id', String(filters.sport_id)); if (filters?.include_inactive) params.set('include_inactive', 'true'); - const response = await apiFetch(`/competition/templates?${params}`, { + const response = await apiFetch(`/competitions/templates?${params}`, { method: 'GET', headers: { 'Content-Type': 'application/json' }, }); @@ -117,14 +117,14 @@ export async function listTemplates( } /** - * GET /competition/templates/{template_id} + * GET /competitions/templates/{template_id} * Get a single template */ export async function getTemplate( templateId: number ): Promise> { try { - const response = await apiFetch(`/competition/templates/${templateId}`, { + const response = await apiFetch(`/competitions/templates/${templateId}`, { method: 'GET', headers: { 'Content-Type': 'application/json' }, }); @@ -140,7 +140,7 @@ export async function getTemplate( } /** - * POST /competition/templates + * POST /competitionss/templates * Create a new template */ export async function createTemplate( @@ -148,7 +148,7 @@ export async function createTemplate( request: CreateTemplateRequest ): Promise> { try { - const response = await apiFetch('/competition/templates', { + const response = await apiFetch('/competitions/templates', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ...request, facility_id: facilityId }), @@ -165,7 +165,7 @@ export async function createTemplate( } /** - * PATCH /competition/templates/{template_id} + * PATCH /competitions/templates/{template_id} * Update a template */ export async function updateTemplate( @@ -173,7 +173,7 @@ export async function updateTemplate( request: UpdateTemplateRequest ): Promise> { try { - const response = await apiFetch(`/competition/templates/${templateId}`, { + const response = await apiFetch(`/competitions/templates/${templateId}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(request), @@ -224,14 +224,14 @@ export async function listCompetitions( } /** - * GET /competition/{competition_id} + * GET /competitions/{competition_id} * Get competition with stages */ export async function getCompetition( competitionId: number ): Promise> { try { - const response = await apiFetch(`/competition/${competitionId}`, { + const response = await apiFetch(`/competitions/${competitionId}`, { method: 'GET', headers: { 'Content-Type': 'application/json' }, }); @@ -247,7 +247,7 @@ export async function getCompetition( } /** - * POST /competition + * POST /competitions * Create a new competition */ export async function createCompetition( @@ -255,7 +255,7 @@ export async function createCompetition( request: CreateCompetitionRequest ): Promise> { try { - const response = await apiFetch('/competition', { + const response = await apiFetch('/competitions', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ...request, facility_id: facilityId }), @@ -272,7 +272,7 @@ export async function createCompetition( } /** - * PATCH /competition/{competition_id} + * PATCH /competitions/{competition_id} * Update a competition */ export async function updateCompetition( @@ -280,7 +280,7 @@ export async function updateCompetition( request: UpdateCompetitionRequest ): Promise> { try { - const response = await apiFetch(`/competition/${competitionId}`, { + const response = await apiFetch(`/competitions/${competitionId}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(request), @@ -297,14 +297,14 @@ export async function updateCompetition( } /** - * POST /competition/{competition_id}/publish + * POST /competitions/{competition_id}/publish * Publish a competition (draft -> published) */ export async function publishCompetition( competitionId: number ): Promise> { try { - const response = await apiFetch(`/competition/${competitionId}/publish`, { + const response = await apiFetch(`/competitions/${competitionId}/publish`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, }); @@ -320,14 +320,14 @@ export async function publishCompetition( } /** - * POST /competition/{competition_id}/start + * POST /competitions/{competition_id}/start * Start a competition (published -> running) */ export async function startCompetition( competitionId: number ): Promise> { try { - const response = await apiFetch(`/competition/${competitionId}/start`, { + const response = await apiFetch(`/competitions/${competitionId}/start`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, }); @@ -343,14 +343,14 @@ export async function startCompetition( } /** - * POST /competition/{competition_id}/finish + * POST /competitions/{competition_id}/finish * Finish a competition (running -> finished) */ export async function finishCompetition( competitionId: number ): Promise> { try { - const response = await apiFetch(`/competition/${competitionId}/finish`, { + const response = await apiFetch(`/competitions/${competitionId}/finish`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, }); @@ -366,14 +366,14 @@ export async function finishCompetition( } /** - * POST /competition/{competition_id}/cancel + * POST /competitions/{competition_id}/cancel * Cancel a competition */ export async function cancelCompetition( competitionId: number ): Promise> { try { - const response = await apiFetch(`/competition/${competitionId}/cancel`, { + const response = await apiFetch(`/competitions/${competitionId}/cancel`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, }); @@ -393,7 +393,7 @@ export async function cancelCompetition( // ============================================================================ /** - * GET /competition/{competition_id}/registrations + * GET /competitions/{competition_id}/registrations * List registrations for a competition */ export async function listRegistrations( @@ -405,7 +405,7 @@ export async function listRegistrations( if (filters?.status) params.set('status', filters.status); const queryString = params.toString(); - const endpoint = `/competition/${competitionId}/registrations${queryString ? `?${queryString}` : ''}`; + const endpoint = `/competitions/${competitionId}/registrations${queryString ? `?${queryString}` : ''}`; const response = await apiFetch(endpoint, { method: 'GET', @@ -423,7 +423,7 @@ export async function listRegistrations( } /** - * POST /competition/{competition_id}/registrations/{registration_id}/approve + * POST /competitions/{competition_id}/registrations/{registration_id}/approve * Approve a registration */ export async function approveRegistration( @@ -432,7 +432,7 @@ export async function approveRegistration( ): Promise> { try { const response = await apiFetch( - `/competition/${competitionId}/registrations/${registrationId}/approve`, + `/competitions/${competitionId}/registrations/${registrationId}/approve`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -446,7 +446,7 @@ export async function approveRegistration( } /** - * POST /competition/{competition_id}/registrations/{registration_id}/reject + * POST /competitions/{competition_id}/registrations/{registration_id}/reject * Reject a registration */ export async function rejectRegistration( @@ -455,7 +455,7 @@ export async function rejectRegistration( ): Promise> { try { const response = await apiFetch( - `/competition/${competitionId}/registrations/${registrationId}/reject`, + `/competitions/${competitionId}/registrations/${registrationId}/reject`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -473,7 +473,7 @@ export async function rejectRegistration( // ============================================================================ /** - * GET /competition/{competition_id}/participants + * GET /competitions/{competition_id}/participants * List participants for a competition */ export async function listParticipants( @@ -486,7 +486,7 @@ export async function listParticipants( if (filters?.stage_group_id !== undefined) params.set('stage_group_id', String(filters.stage_group_id)); const queryString = params.toString(); - const endpoint = `/competition/${competitionId}/participants${queryString ? `?${queryString}` : ''}`; + const endpoint = `/competitions/${competitionId}/participants${queryString ? `?${queryString}` : ''}`; const response = await apiFetch(endpoint, { method: 'GET', @@ -504,7 +504,7 @@ export async function listParticipants( } /** - * POST /competition/{competition_id}/participants + * POST /competitions/{competition_id}/participants * Create a participant manually (without registration) */ export async function createParticipant( @@ -512,7 +512,7 @@ export async function createParticipant( request: CreateParticipantRequest ): Promise> { try { - const response = await apiFetch(`/competition/${competitionId}/participants`, { + const response = await apiFetch(`/competitions/${competitionId}/participants`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(request), @@ -529,7 +529,7 @@ export async function createParticipant( } /** - * POST /competition/participants/{participant_id}/assign-group + * POST /competitions/participants/{participant_id}/assign-group * Assign a participant to a group */ export async function assignParticipantToGroup( @@ -537,7 +537,7 @@ export async function assignParticipantToGroup( groupId: number ): Promise> { try { - const response = await apiFetch(`/competition/participants/${participantId}/assign-group`, { + const response = await apiFetch(`/competitions/participants/${participantId}/assign-group`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ group_id: groupId }), @@ -550,7 +550,7 @@ export async function assignParticipantToGroup( } /** - * POST /competition/participants/{participant_id}/seed + * POST /competitions/participants/{participant_id}/seed * Set participant seed */ export async function setParticipantSeed( @@ -558,7 +558,7 @@ export async function setParticipantSeed( seed: number ): Promise> { try { - const response = await apiFetch(`/competition/participants/${participantId}/seed`, { + const response = await apiFetch(`/competitions/participants/${participantId}/seed`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ seed }), @@ -571,14 +571,14 @@ export async function setParticipantSeed( } /** - * POST /competition/participants/{participant_id}/withdraw + * POST /competitions/participants/{participant_id}/withdraw * Withdraw a participant */ export async function withdrawParticipant( participantId: number ): Promise> { try { - const response = await apiFetch(`/competition/participants/${participantId}/withdraw`, { + const response = await apiFetch(`/competitions/participants/${participantId}/withdraw`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, }); @@ -594,7 +594,7 @@ export async function withdrawParticipant( // ============================================================================ /** - * POST /competition/{competition_id}/stages/{stage_id}/generate-fixtures + * POST /competitions/{competition_id}/stages/{stage_id}/generate-fixtures * Generate fixtures for a stage */ export async function generateFixtures( @@ -604,7 +604,7 @@ export async function generateFixtures( ): Promise> { try { const response = await apiFetch( - `/competition/${competitionId}/stages/${stageId}/generate-fixtures`, + `/competitions/${competitionId}/stages/${stageId}/generate-fixtures`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -619,7 +619,7 @@ export async function generateFixtures( } /** - * GET /competition/{competition_id}/stages/{stage_id}/fixtures + * GET /competitions/{competition_id}/stages/{stage_id}/fixtures * List fixtures for a stage */ export async function listFixtures( @@ -633,7 +633,7 @@ export async function listFixtures( if (filters?.round_index !== undefined) params.set('round_index', String(filters.round_index)); const queryString = params.toString(); - const endpoint = `/competition/${competitionId}/stages/${stageId}/fixtures${queryString ? `?${queryString}` : ''}`; + const endpoint = `/competitions/${competitionId}/stages/${stageId}/fixtures${queryString ? `?${queryString}` : ''}`; const response = await apiFetch(endpoint, { method: 'GET', @@ -651,14 +651,14 @@ export async function listFixtures( } /** - * GET /competition/matches/{match_id} + * GET /competitions/matches/{match_id} * Get a single match */ export async function getMatch( matchId: number ): Promise> { try { - const response = await apiFetch(`/competition/matches/${matchId}`, { + const response = await apiFetch(`/competitions/matches/${matchId}`, { method: 'GET', headers: { 'Content-Type': 'application/json' }, }); @@ -674,7 +674,7 @@ export async function getMatch( } /** - * POST /competition/matches/{match_id}/link-slot + * POST /competitions/matches/{match_id}/link-slot * Link a match to a slot instance */ export async function linkMatchToSlot( @@ -682,7 +682,7 @@ export async function linkMatchToSlot( request: LinkSlotRequest ): Promise> { try { - const response = await apiFetch(`/competition/matches/${matchId}/link-slot`, { + const response = await apiFetch(`/competitions/matches/${matchId}/link-slot`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(request), @@ -695,14 +695,14 @@ export async function linkMatchToSlot( } /** - * POST /competition/matches/{match_id}/unlink-slot + * POST /competitions/matches/{match_id}/unlink-slot * Unlink a match from its slot instance */ export async function unlinkMatchFromSlot( matchId: number ): Promise> { try { - const response = await apiFetch(`/competition/matches/${matchId}/unlink-slot`, { + const response = await apiFetch(`/competitions/matches/${matchId}/unlink-slot`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, }); @@ -714,7 +714,7 @@ export async function unlinkMatchFromSlot( } /** - * POST /competition/matches/{match_id}/set-winner + * POST /competitions/matches/{match_id}/set-winner * Manually set match winner */ export async function setMatchWinner( @@ -722,7 +722,7 @@ export async function setMatchWinner( request: SetWinnerRequest ): Promise> { try { - const response = await apiFetch(`/competition/matches/${matchId}/set-winner`, { + const response = await apiFetch(`/competitions/matches/${matchId}/set-winner`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(request), @@ -735,14 +735,14 @@ export async function setMatchWinner( } /** - * POST /competition/matches/{match_id}/void + * POST /competitions/matches/{match_id}/void * Void a match */ export async function voidMatch( matchId: number ): Promise> { try { - const response = await apiFetch(`/competition/matches/${matchId}/void`, { + const response = await apiFetch(`/competitions/matches/${matchId}/void`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, }); @@ -758,7 +758,7 @@ export async function voidMatch( // ============================================================================ /** - * GET /competition/{competition_id}/stages/{stage_id}/standings + * GET /competitions/{competition_id}/stages/{stage_id}/standings * Get standings for a stage */ export async function getStandings( @@ -771,7 +771,7 @@ export async function getStandings( if (filters?.group_id !== undefined) params.set('group_id', String(filters.group_id)); const queryString = params.toString(); - const endpoint = `/competition/${competitionId}/stages/${stageId}/standings${queryString ? `?${queryString}` : ''}`; + const endpoint = `/competitions/${competitionId}/stages/${stageId}/standings${queryString ? `?${queryString}` : ''}`; const response = await apiFetch(endpoint, { method: 'GET', @@ -789,7 +789,7 @@ export async function getStandings( } /** - * POST /competition/{competition_id}/stages/{stage_id}/standings/recalculate + * POST /competitions/{competition_id}/stages/{stage_id}/standings/recalculate * Recalculate standings */ export async function recalculateStandings( @@ -799,7 +799,7 @@ export async function recalculateStandings( ): Promise> { try { const response = await apiFetch( - `/competition/${competitionId}/stages/${stageId}/standings/recalculate`, + `/competitions/${competitionId}/stages/${stageId}/standings/recalculate`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -818,7 +818,7 @@ export async function recalculateStandings( // ============================================================================ /** - * GET /competition/{competition_id}/stages/{stage_id}/leaderboard + * GET /competitions/{competition_id}/stages/{stage_id}/leaderboard * Get leaderboard for a challenge stage */ export async function getLeaderboard( @@ -833,7 +833,7 @@ export async function getLeaderboard( if (offset !== 0) params.set('offset', String(offset)); const queryString = params.toString(); - const endpoint = `/competition/${competitionId}/stages/${stageId}/leaderboard${queryString ? `?${queryString}` : ''}`; + const endpoint = `/competitions/${competitionId}/stages/${stageId}/leaderboard${queryString ? `?${queryString}` : ''}`; const response = await apiFetch(endpoint, { method: 'GET', @@ -847,7 +847,7 @@ export async function getLeaderboard( } /** - * POST /competition/{competition_id}/stages/{stage_id}/leaderboard/recalculate + * POST /competitions/{competition_id}/stages/{stage_id}/leaderboard/recalculate * Recalculate leaderboard */ export async function recalculateLeaderboard( @@ -856,7 +856,7 @@ export async function recalculateLeaderboard( ): Promise> { try { const response = await apiFetch( - `/competition/${competitionId}/stages/${stageId}/leaderboard/recalculate`, + `/competitions/${competitionId}/stages/${stageId}/leaderboard/recalculate`, { method: 'POST', headers: { 'Content-Type': 'application/json' },