How to do the query to obtain the animal of a sing...
# help
b
How to do the query to obtain the animal of a single user . Help me
s
Are you asking about SQL query or using the supabase-js client library?
b
Supabase js
s
Copy code
js
 const { data, error } = await supabase
      .from('app_users')
      .select(
        `
          *,
          galpon(container(animal(*)))
        `
      )
      .eq('user_id', user_id);
b
and if I want only the animals with the same status true
Could not find a relationship between app_user and galpon in the schema cache
help me with this error
s
Your relationship is probably not formed properly
b
final response = await client .from('app_users') .select( '*, galpon(container(animal(**)))' ) .eq('user_id', user.id) .execute();
It should return the animals data, but it only returns galpon data, why?
s
You currently have two * in your animal brackets which is incorrect, it should only be one *, also if its not working its due to the foreign keys not setup properly
b
right, I just realized
final response = await client .from('app_users') .select( '* , galpon( * ,container( *, animal( * )))' ) .eq('user_id', user.id) .execute();
this way it works
I have one last query, how do I make the animals filter only those that state equals true?