'medreport.update_account' should also update email

This commit is contained in:
2025-09-08 23:43:24 +03:00
parent 2c63875806
commit 0e063cd5dc
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
CREATE OR REPLACE FUNCTION medreport.update_account(p_name character varying, p_last_name text, p_personal_code text, p_phone text, p_city text, p_has_consent_personal_data boolean, p_uid uuid, p_email character varying)
RETURNS void
LANGUAGE plpgsql
AS $function$begin
update medreport.accounts
set name = coalesce(p_name, name),
last_name = coalesce(p_last_name, last_name),
personal_code = coalesce(p_personal_code, personal_code),
phone = coalesce(p_phone, phone),
city = coalesce(p_city, city),
has_consent_personal_data = coalesce(p_has_consent_personal_data,
has_consent_personal_data),
email = coalesce(p_email, email)
where id = p_uid;
end;$function$
;
grant
execute on function medreport.update_account(
p_name character varying,
p_last_name text,
p_personal_code text,
p_phone text,
p_city text,
p_has_consent_personal_data boolean,
p_uid uuid,
p_email character varying) to authenticated,
service_role;