You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need a query that finds all the families that user1 and user2 are a part of (think of families as "groups") and where user1 is an admin and user2 is not. In SQL I'm able to do this with a self join and a ON TRUE. I was curious if this was possible with Geddy Model. I have the following:
This gets all memberships for payee_id where their permission level is 0 OR where payer_id has a permission level of 1, but it doesn't find where they are in the same family. Is there anyway to do this? Here's the SQL:
I'm imagining a many-to-many situation, where a Family has many MembershipModels, and so do Users.
A rough prototype of what I suspect would work is:
Family.all({and:['membership.userId': firstUserId,'membership.userId': secondUserId,]},{includes: 'Membership'},function(err,families){console.log("Families that have both members:");console.dir(families);});
I need a query that finds all the families that user1 and user2 are a part of (think of families as "groups") and where user1 is an admin and user2 is not. In SQL I'm able to do this with a self join and a
ON TRUE
. I was curious if this was possible with Geddy Model. I have the following:This gets all memberships for payee_id where their permission level is 0 OR where payer_id has a permission level of 1, but it doesn't find where they are in the same family. Is there anyway to do this? Here's the SQL:
The text was updated successfully, but these errors were encountered: