Update Version (Beta): login + leaderboard/ word definition

This commit is contained in:
Zakaria
2026-05-13 11:24:27 -04:00
parent 66f8207985
commit fe5649dc2d
6 changed files with 60 additions and 107 deletions
+1 -32
View File
@@ -674,37 +674,7 @@ begin
end;
$$;
create or replace function public.get_player_history(history_limit integer default 10)
returns table (
hour_start timestamptz,
word text,
won boolean,
guess_count integer,
completed_at timestamptz
)
language plpgsql
security definer
set search_path = public
as $$
begin
if auth.uid() is null then
raise exception 'Authentication required';
end if;
return query
select
rounds.hour_start,
rounds.word,
rounds.won,
rounds.guess_count,
rounds.completed_at
from public.wordle_rounds rounds
where rounds.user_id = auth.uid()
and rounds.completed_at is not null
order by rounds.hour_start desc
limit greatest(1, least(coalesce(history_limit, 10), 25));
end;
$$;
drop function if exists public.get_player_history(integer);
create or replace function public.get_hourly_summary()
returns table (
@@ -760,6 +730,5 @@ grant execute on function public.submit_guess(uuid, text) to authenticated;
grant execute on function public.get_user_stats() to authenticated;
grant execute on function public.get_hourly_leaderboard() to anon, authenticated;
grant execute on function public.get_leaderboard(text) to anon, authenticated;
grant execute on function public.get_player_history(integer) to authenticated;
grant execute on function public.get_hourly_summary() to anon, authenticated;
grant execute on function public.complete_hourly_round(uuid, boolean, integer) to authenticated;