diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index 056c2c3..5ae9e49 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -18,6 +18,7 @@ import type { ScrapedTeamStanding, SeasonPick, SeasonPickedUser, + SeasonPickResult, Substitution, Team, User, @@ -115,6 +116,19 @@ export const fetch_raceresults = async ( return raceresults; }; +/** + * Fetch all [SeasonPickResults] from the database. Should either contain 0 or 1 element. + */ +export const fetch_seasonpickresults = async ( + fetch: (_: any) => Promise, +): Promise => { + const seasonpickresults: SeasonPickResult[] = await pb + .collection("seasonpickresults") + .getFullList({ fetch: fetch }); + + return seasonpickresults; +}; + /** * Fetch all [Users] (sorted ascending by username) with file URLs for avatars */ diff --git a/src/lib/schema.ts b/src/lib/schema.ts index 678cd5a..790e8b8 100644 --- a/src/lib/schema.ts +++ b/src/lib/schema.ts @@ -109,6 +109,18 @@ export interface RaceResult { 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 { id: string; username: string;