feat: add challenge and red-blue competitions across API and web

This commit is contained in:
Joey Yakimowich-Payne 2025-10-01 06:49:09 -06:00
commit 8fd3c4bb64
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
77 changed files with 5355 additions and 24 deletions

View file

@ -0,0 +1,24 @@
import { getPublic, postPublic } from './base'
export type RedBlueListItem = {
id: string
name: string
description?: string
}
export async function fetchRedBlueChallenges(): Promise<RedBlueListItem[]> {
const res = await getPublic<{ result: string; data: RedBlueListItem[] }>('/red-blue-challenges')
return res.data ?? []
}
export async function fetchRedBlueLeaderboard(id: string) {
const res = await getPublic<{ result: string; data: any }>(`/red-blue-challenges/${id}/leaderboard`)
return res.data
}
export async function submitRedBluePrompt(id: string, team: 'red' | 'blue', prompt: string) {
const res = await postPublic<{ result: string; data: any }>(`/red-blue-challenges/${id}/submit`, {
body: { team, prompt },
})
return res.data
}