Made accounts and their transaction accessible to account members only.

This commit is contained in:
2026-10-11 13:28:16 +02:00
parent 21f0c17af9
commit 3faea141dd
34 changed files with 462 additions and 295 deletions
@@ -0,0 +1,10 @@
CREATE FUNCTION accessible_accounts (p_user_id UUID) RETURNS SETOF accounts LANGUAGE sql STABLE AS $$
SELECT accounts.*
FROM accounts
WHERE EXISTS (
SELECT 1
FROM account_members
WHERE account_members.account_id = accounts.id
AND account_members.user_id = p_user_id
)
$$;