This repository has been archived by the owner on Jun 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 137
[enhancement] Use array in @post hooks #313
Comments
i think this is not within the scope of typegoose, but you could make a simple function like below: function hookwrapper(next: () => void) {
return addNotePost(next, Entities.CONTACT);
}
@Post<Contact>("save", hookwrapper)
@Post<Contact>("findOneAndUpdate", hookwrapper) Note: this should work, but somehow i found that "save" and many others are not declared right (only "count" and "insertMany" are declared) |
hasezoey
referenced
this issue
in typegoose/typegoose
Aug 5, 2019
- implemented szokodiakos#313 - refactored hooks's types for the new mongoose - set rule "no-console" to warn instead of error (for debugging) - set rule "unified-signatures" to false because otherwise it is not possible in hooks.ts (or would be ugly) closes szokodiakos#313
1 task
hasezoey
referenced
this issue
in typegoose/typegoose
Aug 5, 2019
- implemented szokodiakos#313 - refactored hooks's types for the new mongoose - set rule "no-console" to warn instead of error (for debugging) - set rule "unified-signatures" to false because otherwise it is not possible in hooks.ts (or would be ugly) - adding migration note for hooks closes szokodiakos#313
@Ben305 this can be closed because it is included in v6.0.0 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have instances where I want to achieve the same thing using different hooks but just end up having to duplicate the code, would it be possible or be a good idea to allow an array of hooks to do the same thing?
Currently:
Enhancement:
The text was updated successfully, but these errors were encountered: