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
Coming from Objection on Feathers v4, I was accustomed to specifying what related records I wanted. This avoided circular associations, and reduced the size of requests when I didn't need every related record for a particular record.
I understand in v5 that associations are meant to be done in resolvers. This works great, but I'm hoping to be able to add in a little extra control.
I've noticed that I can return undefined from a virtual property resolver and it isn't included in the response. So I'm looking at adding a query parameter ($expand) that contains an array of the associations I'd like to run.
In each virtual property resolver, I can then conditionally add the associated record(s).
Does this seem like the right track? Am I trying to reinvent something that there's already a "Feathers way" of doing?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Coming from Objection on Feathers v4, I was accustomed to specifying what related records I wanted. This avoided circular associations, and reduced the size of requests when I didn't need every related record for a particular record.
I understand in v5 that associations are meant to be done in resolvers. This works great, but I'm hoping to be able to add in a little extra control.
I've noticed that I can return undefined from a virtual property resolver and it isn't included in the response. So I'm looking at adding a query parameter ($expand) that contains an array of the associations I'd like to run.
In each virtual property resolver, I can then conditionally add the associated record(s).
Does this seem like the right track? Am I trying to reinvent something that there's already a "Feathers way" of doing?
Beta Was this translation helpful? Give feedback.
All reactions