Lib: Update fetchers and schema after database changes

This commit is contained in:
2025-06-07 19:58:34 +02:00
parent 3339ffaa5f
commit d54ee01227
2 changed files with 25 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import type {
RacePick,
RacePickPoints,
RacePickPointsAcc,
RacePickPointsTotal,
RaceResult,
ScrapedDriverStanding,
ScrapedRaceResult,
@ -281,7 +282,7 @@ export const fetch_racepickpoints = async (
};
/**
* Fetch all [RacePickPointsAcc] from the database, ordered descendingly by total points.
* Fetch all [RacePickPointsAcc] from the database, ordered ascendingly by step.
*/
export const fetch_racepickpointsacc = async (
fetch: (_: any) => Promise<Response>,
@ -293,6 +294,19 @@ export const fetch_racepickpointsacc = async (
return racepickpointsacc;
};
/**
* Fetch all [RacePickPointsTotal] from the database, ordered descendingly by total points.
*/
export const fetch_racepickpointstotal = async (
fetch: (_: any) => Promise<Response>,
): Promise<RacePickPointsTotal[]> => {
const racepickpointstotal: RacePickPointsTotal[] = await pb
.collection("racepickpointstotal")
.getFullList({ fetch: fetch });
return racepickpointstotal;
};
/**
* Fetch all [ScrapedDriverStandings] from the database, ordered ascendingly by position.
*/

View File

@ -140,11 +140,21 @@ export interface RacePickPoints {
}
export interface RacePickPointsAcc {
id: string;
user: string;
step: number;
acc_pxx_points: number;
acc_dnf_points: number;
acc_points: number;
}
export interface RacePickPointsTotal {
id: string;
user: string;
total_pxx_points: number;
total_dnf_points: number;
total_points: number;
total_points_per_pick: number;
}
// Scraped Data