Added this stupid vibecoded app as a test
Build App / Build (push) Waiting to run

This commit is contained in:
2026-08-06 09:58:06 +02:00
parent d9e05fb487
commit a9860f4c94
51 changed files with 10154 additions and 7 deletions
@@ -0,0 +1,45 @@
import { session } from '$lib/stores/session.svelte';
import { apiRequest, buildPath, type RequestOptions } from './client';
import type { GameDTO } from './schema-helpers';
/** GameController is `[Authorize]`; reuse the session JWT unless one is passed in. */
function authed(options: RequestOptions): RequestOptions {
return { ...options, token: options.token ?? session.token };
}
/** GET /api/Game — every game, in database order (sort by `order` for display). */
export function listGames(options: RequestOptions = {}): Promise<GameDTO[]> {
return apiRequest<GameDTO[]>('/api/Game', authed(options));
}
/**
* POST /api/Game — `AddOrUpdate`: an `id` of 0 inserts, anything else updates.
* The update replaces every column, so send a full DTO rather than a patch.
* Returns the saved game with its assigned id.
*/
export function saveGame(game: GameDTO, options: RequestOptions = {}): Promise<GameDTO> {
return apiRequest<GameDTO>('/api/Game', { ...authed(options), method: 'POST', body: game });
}
/**
* DELETE /api/Game/{id} — 204 on success. The service swallows `DbUpdateException`,
* so a game still referenced by tournaments comes back as a 404 rather than a 409.
*/
export async function deleteGame(id: number, options: RequestOptions = {}): Promise<void> {
await apiRequest<void>(buildPath('/api/Game/{id}', { id }), {
...authed(options),
method: 'DELETE'
});
}
/**
* GET /api/Game/smash/{name} — searches start.gg's videogame catalogue by name.
* The `id` of each match is a **start.gg** videogame id, i.e. a candidate value for
* `GameDTO.smashId`, not a LaDOSE game id.
*/
export function searchSmashGames(
name: string,
options: RequestOptions = {}
): Promise<GameDTO[]> {
return apiRequest<GameDTO[]>(buildPath('/api/Game/smash/{name}', { name }), authed(options));
}