-
Notifications
You must be signed in to change notification settings - Fork 0
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 direct relationships targeting intermediate resources #3
Comments
Hi @joelalejandro! Do you have an idea how this should be implemented? Do you have ETA when this could be finished? Maybe I can help you with this one? Just to make sure I got this right...if we have movies and actors in many to many relationship we want to be able to make this request |
Hey @kristian240! I haven't had the time to check this out yet. This addon creates dynamically-instantiated resource definitions for intermediate tables to support many-to-many relationships: movies <=> movie_actors <=> actors In this case, the Let's assume your intermediate table has three fields: id, movie_id, actor_id. And, in another resource, you want to reduce FK repetition by reusing the {
relationships: {
movieAuthor: {
foreignKeyName: 'movie_actor_id',
belongsTo: true,
type: () => MovieActor
}
}
} If you feel up to the challenge, I can assign this issue to you! |
@joelalejandro not sure if I got a general idea, maybe I completely misunderstood this issue/feature from the begging. Because of this, I would like to ask you few more questions. When is this used? Why isn't enough? // Movie Resource
{
relationships: {
actors: {
type: () => Actors,
manyToMany: true,
}
}
} I do not see why the
Also, how is this different than creating a resource manually? If the resource is created automatically, then this example API does not look doable. Where is type: (types) => return types.find(MoveActorPredicate), In the end, does this have any effect to the final API? Should the following be possible after this implementation?
Or is something like Thanks for your time 😄 |
No description provided.
The text was updated successfully, but these errors were encountered: