feat: update API and database structure for membership confirmation and wallet integration

- Refactor API calls to use 'medreport' schema for membership confirmation and account updates
- Enhance success notification component to include wallet balance and expiration details
- Modify database types to reflect new 'medreport' schema and add product-related tables
- Update localization files to support new wallet messages
- Adjust SQL migration scripts for proper schema references and function definitions
This commit is contained in:
Danel Kungla
2025-07-09 10:01:12 +03:00
parent 4f36f9c037
commit 9371ff7710
6 changed files with 234 additions and 452 deletions

View File

@@ -1,28 +1,28 @@
alter table "public"."accounts_memberships" add column "has_seen_confirmation" boolean not null default false;
alter table "medreport"."accounts_memberships" add column "has_seen_confirmation" boolean not null default false;
set check_function_bodies = off;
CREATE OR REPLACE FUNCTION public.has_unseen_membership_confirmation(p_user_id uuid DEFAULT auth.uid())
CREATE OR REPLACE FUNCTION medreport.has_unseen_membership_confirmation(p_user_id uuid DEFAULT auth.uid())
RETURNS boolean
LANGUAGE sql
SECURITY DEFINER
SET search_path TO 'public', 'extensions'
SET search_path TO 'medreport', 'extensions'
AS $function$
select exists (
select 1
from public.accounts_memberships am
from medreport.accounts_memberships am
where am.user_id = p_user_id
and am.has_seen_confirmation = false
);
$function$
;
grant execute on function public.has_unseen_membership_confirmation(uuid)
grant execute on function medreport.has_unseen_membership_confirmation(uuid)
to authenticated, anon;
drop function if exists "public"."has_personal_code"(account_id uuid);
drop function if exists "medreport"."has_personal_code"(account_id uuid);
CREATE OR REPLACE FUNCTION public.has_consent_personal_data(account_id uuid)
CREATE OR REPLACE FUNCTION medreport.has_consent_personal_data(account_id uuid)
RETURNS boolean
LANGUAGE plpgsql
SECURITY DEFINER
@@ -30,12 +30,12 @@ CREATE OR REPLACE FUNCTION public.has_consent_personal_data(account_id uuid)
AS $function$BEGIN
RETURN EXISTS (
SELECT 1
FROM public.accounts
FROM medreport.accounts
WHERE id = account_id
AND has_consent_personal_data IS TRUE
);
END;$function$
;
grant execute on function public.has_consent_personal_data(uuid)
grant execute on function medreport.has_consent_personal_data(uuid)
to authenticated, anon;