Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support linked relations #7

Open
kwrooijen opened this issue Aug 16, 2020 · 0 comments
Open

Support linked relations #7

kwrooijen opened this issue Aug 16, 2020 · 0 comments
Labels
discussion enhancement New feature or request

Comments

@kwrooijen
Copy link
Owner

kwrooijen commented Aug 16, 2020

Currently relations are linked directly. That doesn't work well for the following use case:

user
---
id : uuid
user_organization
---
id : uuid
user_id : foreign key user(id)
organization_id : foreign key organization(id)
organization
---
id : uuid

In this case, users are linked to organizations through the user_organization table. We need to somehow resolve a user / organization relations through user_organization.

Possibly something along the lines of:

;; User model
[:map 
 {:has-many {:organization {:field :user/organizations, :through :user_organization/organization_id}}
 ,,,
 }]

;; Organizatin model
[:map 
 {:has-many {:user {:field :organization/users, :through :user_organization/user_id}}
 ,,,
 }]
@kwrooijen kwrooijen added enhancement New feature or request discussion labels Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant