'medreport.update_account' should also update email
This commit is contained in:
@@ -68,6 +68,7 @@ class AuthApi {
|
||||
p_name: data.firstName,
|
||||
p_last_name: data.lastName,
|
||||
p_personal_code: data.personalCode,
|
||||
p_email: data.email || '',
|
||||
p_phone: data.phone || '',
|
||||
p_city: data.city || '',
|
||||
p_has_consent_personal_data: data.userConsent,
|
||||
|
||||
@@ -2053,6 +2053,7 @@ export type Database = {
|
||||
p_personal_code: string
|
||||
p_phone: string
|
||||
p_uid: string
|
||||
p_email: string
|
||||
}
|
||||
Returns: undefined
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user