'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

@@ -68,6 +68,7 @@ class AuthApi {
p_name: data.firstName, p_name: data.firstName,
p_last_name: data.lastName, p_last_name: data.lastName,
p_personal_code: data.personalCode, p_personal_code: data.personalCode,
p_email: data.email || '',
p_phone: data.phone || '', p_phone: data.phone || '',
p_city: data.city || '', p_city: data.city || '',
p_has_consent_personal_data: data.userConsent, p_has_consent_personal_data: data.userConsent,

View File

@@ -2053,6 +2053,7 @@ export type Database = {
p_personal_code: string p_personal_code: string
p_phone: string p_phone: string
p_uid: string p_uid: string
p_email: string
} }
Returns: undefined Returns: undefined
} }

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;