Working leaderboard

This commit is contained in:
2026-02-07 15:44:38 +01:00
parent f930f0bca1
commit 969500f5a4
5 changed files with 99 additions and 266 deletions
+18
View File
@@ -1,3 +1,21 @@
"use server";
import { SupabaseClient } from "@supabase/supabase-js";
import "server-only";
import { LeaderboardUser } from "./types";
export async function getGlobalLeaderboard(
supabase: SupabaseClient,
): Promise<LeaderboardUser[]> {
const { data, error } = await supabase.rpc("get_global_leaderboard");
if (error) throw error;
return data;
}
export async function getWeeklyLeaderboard(
supabase: SupabaseClient,
): Promise<LeaderboardUser[]> {
const { data, error } = await supabase.rpc("get_weekly_leaderboard");
if (error) throw error;
return data;
}