Lib: Add seasonpickresult table schema + fetcher
This commit is contained in:
@ -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<Response>,
|
||||
): Promise<SeasonPickResult[]> => {
|
||||
const seasonpickresults: SeasonPickResult[] = await pb
|
||||
.collection("seasonpickresults")
|
||||
.getFullList({ fetch: fetch });
|
||||
|
||||
return seasonpickresults;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetch all [Users] (sorted ascending by username) with file URLs for avatars
|
||||
*/
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user