Closed frct1 closed 5 years ago
Hey @frct1, it's already possible to define model and instance methods easily. Just like in any normal class:
@Table
class User extends Model<User> {
instanceMethod() {}
static modelMethod() {}
}
So no need for defining them in the table options like @Table({instanceMethods: {}, model...})
Does this solve your issue?
Hello @RobinBuschmann WOOOOOOAH Incredible Got it, yes it solve the question Awesome! Thank you for answer Looked for this for a week, maybe more :D
I think i can create PR for updating README.md about instance/model methods (currently in web a lot of creepy solutions. Actually i'm didn't test them, but look like)
If you don't mind it
Thanks for asking, but it's already part of the sequelize documentation: https://sequelize.org/master/manual/models-definition.html#expansion-of-models.
Oh, it's become to be more sad I missed it in official docs :(
Versions
I'm submitting a ...
[ ] bug report [x] feature request
Actual behavior:
Many options to create instance methods through a lot of hard to read code Expected behavior:
Defining instance methods inside model definition with decorator or something like that Creating own decorator from lib to define instance or model method like:
Related code: