Lib: Add fetchers for RacePickPoints and RacePickPointsAcc

This commit is contained in:
2025-03-23 17:16:10 +01:00
parent f249205cd8
commit 9ec0bf0bd5

View File

@ -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<Response>,
): Promise<RacePickPoints[]> => {
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<Response>,
): Promise<RacePickPointsAcc[]> => {
const racepickpointsacc: RacePickPointsAcc[] = await pb
.collection("racepickpointsacc")
.getFullList({ fetch: fetch });
return racepickpointsacc;
};