Alternatives for a lifecycle hook after all eager fetching?
I'd like to be able to process a model after it's satisfied/hydrated its relations with an eager query. This is because the object as produced by following the relations is a bit more verbose than necessary.
I'm modelling the join table as a Model itself so I can have access to its extra columns. The result is that the related object is accessible only by first going through this join table model, which I'd like to be able to get rid of in a "post-eager" lifecycle hook.
Why couldn't you use the extra feature for many-to-many? https://vincit.github.io/objection.js/recipes/extra-properties.html#join-table-extra-properties
I'll admit it didn't work at first (I didn't see the extra column in parseDatabaseJson), so I found another suggestion and just went with that.
Ok. Well the extra properties should be in parseDatabaseJson already. If you want to go with your current implementation, there isn't such hook yet. There will be soon when I release objection 2.0.