Lib: Add fetcher for seasonpicks
This commit is contained in:
@ -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<Response>,
|
||||
): Promise<RacePick[]> => {
|
||||
// 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<Response>,
|
||||
): Promise<SeasonPick[]> => {
|
||||
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)
|
||||
|
Reference in New Issue
Block a user