BenutzerProfil

This commit is contained in:
Ashikagi
2026-03-23 21:38:11 +01:00
parent f5338ea3b2
commit cd77f88d96
22 changed files with 1145 additions and 109 deletions

View File

@@ -0,0 +1,28 @@
create or replace function public.delete_current_user_profile_data()
returns void
language plpgsql
security definer
set search_path = public
as $$
declare
v_user_id uuid;
begin
v_user_id := auth.uid();
if v_user_id is null then
raise exception 'Not authenticated';
end if;
delete from public.training_plans
where user_id = v_user_id;
delete from public.assessments
where user_id = v_user_id;
delete from public.user_profiles
where user_id = v_user_id;
end;
$$;
revoke all on function public.delete_current_user_profile_data() from public;
grant execute on function public.delete_current_user_profile_data() to authenticated;