diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-17 19:14:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-17 19:23:56 +0900 |
| commit | faff26b13da82747fb0efdb6bf1312a9b14d3916 (patch) | |
| tree | eb510dc3f92bdb916ff5bdc1191763ff48cf4332 /frontend/app/api | |
| parent | 4615ca9b8b1989d315ae2322556697b97161b97b (diff) | |
| download | iosdc-japan-2025-albatross-faff26b13da82747fb0efdb6bf1312a9b14d3916.tar.gz iosdc-japan-2025-albatross-faff26b13da82747fb0efdb6bf1312a9b14d3916.tar.zst iosdc-japan-2025-albatross-faff26b13da82747fb0efdb6bf1312a9b14d3916.zip | |
feat(backend,frontend): implement tournament page
Diffstat (limited to 'frontend/app/api')
| -rw-r--r-- | frontend/app/api/client.ts | 17 | ||||
| -rw-r--r-- | frontend/app/api/schema.d.ts | 65 |
2 files changed, 82 insertions, 0 deletions
diff --git a/frontend/app/api/client.ts b/frontend/app/api/client.ts index 10dc7ef..6b7ce80 100644 --- a/frontend/app/api/client.ts +++ b/frontend/app/api/client.ts @@ -107,6 +107,23 @@ class AuthenticatedApiClient { return data; } + async getTournament( + game1: number, + game2: number, + game3: number, + game4: number, + game5: number, + ) { + const { data, error } = await client.GET("/tournament", { + params: { + header: this._getAuthorizationHeader(), + query: { game1, game2, game3, game4, game5 }, + }, + }); + if (error) throw new Error(error.message); + return data; + } + _getAuthorizationHeader() { return { Authorization: `Bearer ${this.token}` }; } diff --git a/frontend/app/api/schema.d.ts b/frontend/app/api/schema.d.ts index b58b27f..04bfc10 100644 --- a/frontend/app/api/schema.d.ts +++ b/frontend/app/api/schema.d.ts @@ -140,6 +140,23 @@ export interface paths { patch?: never; trace?: never; }; + "/tournament": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get tournament bracket data */ + get: operations["getTournament"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; } export type webhooks = Record<string, never>; export interface components { @@ -219,6 +236,21 @@ export interface components { /** @example echo 'hello world'; */ code: string | null; }; + Tournament: { + matches: components["schemas"]["TournamentMatch"][]; + }; + TournamentMatch: { + /** @example 1 */ + game_id: number; + player1?: components["schemas"]["User"]; + player2?: components["schemas"]["User"]; + /** @example 1 */ + player1_score?: number; + /** @example 1 */ + player2_score?: number; + /** @example 1 */ + winner?: number; + }; }; responses: { /** @description Bad request */ @@ -509,4 +541,37 @@ export interface operations { 404: components["responses"]["NotFound"]; }; }; + getTournament: { + parameters: { + query: { + game1: number; + game2: number; + game3: number; + game4: number; + game5: number; + }; + header: { + Authorization: components["parameters"]["header_authorization"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Tournament data */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + tournament: components["schemas"]["Tournament"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; } |
