- 
                Notifications
    
You must be signed in to change notification settings  - Fork 286
 
Open
Description
I'm using sequelize-typescript in my project. To define a model, I create two separate classes: an entity class and a model class:
// Entity class
class User {
  username: string;
  fullName: string;
}
// Model class
@Table({ tableName: "user" })
class UserModel extends Model implements User {
  @Column
  username: string;
  
  @Column
  fullName: string;
}I do this in order to separate my entitiy's interfaces from sequelize model's interface (using in repository pattern). It's a bit inconvinient since I have to do the declaring job twice.
So can we integrate extends Model to @Table decorator? So that I only have to define everything in Entity classes. For example:
@Table({ tableName: "user", extends: false })
class User {
  @Column
  username: string;
  
  @Column
  fullName: string;
}Metadata
Metadata
Assignees
Labels
No labels