diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index 29ed023..d7bef97 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -6,6 +6,7 @@ import type { Race, RacePick, RaceResult, + SeasonPick, Substitution, Team, User, @@ -142,7 +143,6 @@ export const fetch_currentrace = async ( export const fetch_racepicks = async ( fetch: (_: any) => Promise, ): Promise => { - // Don't expand race/pxx/dnf since we already fetched those const racepicks: RacePick[] = await pb .collection("racepicks") .getFullList({ fetch: fetch, expand: "user" }); @@ -150,6 +150,19 @@ export const fetch_racepicks = async ( return racepicks; }; +/** + * Fetch all [SeasonPicks] from the database + */ +export const fetch_seasonpicks = async ( + fetch: (_: any) => Promise, +): Promise => { + const seasonpicks: SeasonPick[] = await pb + .collection("seasonpicks") + .getFullList({ fetch: fetch, expand: "user" }); + + return seasonpicks; +}; + /** * Fetch all [Users] (with the extra field "picked" that is truthy * if the user already picked for the current race)