As seen in the docs:
class Author extends AuthorCodegen {
constructor(em: EntityManager, opts: AuthorOpts) {
super(em, opts);
}
}
authorConfig.beforeFlush(async () => ...);
authorConfig.afterCommit(async () => ...);
At first glance, this feels confusing. As a developer, I'd assume the hooks should be placed on the model/entity. Something like this could make more sense:
class Author extends AuthorCodegen {
static beforeFlush = [
async () => ...,
async () => ...,
]
}
Secondly, coming from the rails hook hell, it's pretty easy to have hooks being placed in different parts of the app, causing hook hell and losing track of where changes are being made and what hooks are being made.
As seen in the docs:
At first glance, this feels confusing. As a developer, I'd assume the hooks should be placed on the model/entity. Something like this could make more sense:
Secondly, coming from the rails hook hell, it's pretty easy to have hooks being placed in different parts of the app, causing hook hell and losing track of where changes are being made and what hooks are being made.