Lib: Add seasonpickresult table schema + fetcher

This commit is contained in:
2025-12-25 20:28:07 +01:00
parent 24a713b471
commit 94e728bf39
2 changed files with 26 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import type {
ScrapedTeamStanding, ScrapedTeamStanding,
SeasonPick, SeasonPick,
SeasonPickedUser, SeasonPickedUser,
SeasonPickResult,
Substitution, Substitution,
Team, Team,
User, User,
@ -115,6 +116,19 @@ export const fetch_raceresults = async (
return raceresults; return raceresults;
}; };
/**
* Fetch all [SeasonPickResults] from the database. Should either contain 0 or 1 element.
*/
export const fetch_seasonpickresults = async (
fetch: (_: any) => Promise<Response>,
): Promise<SeasonPickResult[]> => {
const seasonpickresults: SeasonPickResult[] = await pb
.collection("seasonpickresults")
.getFullList({ fetch: fetch });
return seasonpickresults;
};
/** /**
* Fetch all [Users] (sorted ascending by username) with file URLs for avatars * Fetch all [Users] (sorted ascending by username) with file URLs for avatars
*/ */

View File

@ -109,6 +109,18 @@ export interface RaceResult {
dnfs: string[]; dnfs: string[];
} }
export interface SeasonPickResult {
id: string;
correcthottake: string[];
wdcwinner: string;
wccwinner: string;
mostovertakes: string[];
mostdnfs: string[];
doohanstarts: number;
teamwinners: string[];
podiums: string[];
}
export interface CurrentPickedUser { export interface CurrentPickedUser {
id: string; id: string;
username: string; username: string;