diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index 0fb951d..b926258 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -7,6 +7,8 @@ import type { Hottake, Race, RacePick, + RacePickPoints, + RacePickPointsAcc, RaceResult, SeasonPick, SeasonPickedUser, @@ -261,3 +263,29 @@ export const fetch_seasonpickedusers = async ( return seasonpickedusers; }; + +/** + * Fetch all [RacePickPoints] from the database + */ +export const fetch_racepickpoints = async ( + fetch: (_: any) => Promise, +): Promise => { + const racepickpoints: RacePickPoints[] = await pb + .collection("racepickpoints") + .getFullList({ fetch: fetch }); + + return racepickpoints; +}; + +/** + * Fetch all [RacePickPointsAcc] from the database, ordered descendingly by total points. + */ +export const fetch_racepickpointsacc = async ( + fetch: (_: any) => Promise, +): Promise => { + const racepickpointsacc: RacePickPointsAcc[] = await pb + .collection("racepickpointsacc") + .getFullList({ fetch: fetch }); + + return racepickpointsacc; +};