How to eq() a table that is not a direct join?

I have 3 tables. battle, teams and user. They are linked to each other in this order, but battle does not have a direct relation with user.

I want to query every user that has at least one battle that is public. For this I have battle.public IS TRUE.

How do I join user and battle with supabase-js?

Here is a code example of my (failed) attempt:

const { data: users } = await this.$supabase
        .from('user')
        .select('id, name, team:inner(battle:inner(*))')
        .eq('battle.public', 'true')


Does anyone know?
Was this page helpful?