Hooks not executing on related table queries #452
Replies: 1 comment 2 replies
-
|
Thank you for the inspiring words, I really appreciate knowing this library is useful and joyful for others! I have two specific ideas that would require triggering hooks of relations, the first doesn't seem to be complex and the second may be too complex, the ideas exist from day 1 of this library, but couldn't make it because of other issues and time limitations. This will be done for create/update/delete callbacks one day for sure, absolutely. But, I never thought of a use case for querying the data, could you share your use case? From docs: init(orm: typeof db) {
// data is of type `unknown` - it can be anything
this.afterQuery((data, q) => console.log('after any query'));The data here is unknown and can be anything because maybe it was triggered by selecting count, or even a custom SQL, so in current form it's not much useful, perhaps it is worth adding an additional functionality for your use case. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, first I would like to acknowledge how incredible this library is. Congratulations on the excellent work.
One of the main features, for me, are the
beforeHooksandafterHooks.I noticed that these hooks only work when the table being queried is the main one in a query.
For example, if I have hooks on the
customerstable, they are executed perfectly in a query like this:However, they are apparently ignored in a query like this:
Is there any way to execute the hooks in a query like this?
If not, is there any perspective of implementing this functionality?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions