17 lines
428 B
SQL
17 lines
428 B
SQL
-- 1) Qual é meu uid?
|
|
select auth.uid() as my_uid;
|
|
|
|
-- 2) Tenho membership ativa no tenant atual?
|
|
select *
|
|
from tenant_members
|
|
where tenant_id = 'e8b10543-fb36-4e75-9d37-6fece9745637'
|
|
and user_id = auth.uid()
|
|
order by created_at desc;
|
|
|
|
-- 3) Se você usa status:
|
|
select *
|
|
from tenant_members
|
|
where tenant_id = 'e8b10543-fb36-4e75-9d37-6fece9745637'
|
|
and user_id = auth.uid()
|
|
and status = 'active'
|
|
order by created_at desc; |