Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>sequelize-ts-helperNew to Visual Studio Code? Get it now.
sequelize-ts-helper

sequelize-ts-helper

zyq

|
2,063 installs
| (0) | Free
a helper to generate sequelize model association field
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

sequelize-ts-helper

This is the README for extension "sequelize-ts-helper".

Features

generate association mixin field in typescript sequelize model;

feature

if you can't view image. you can open it in browser(click me)

  • @BelongsToMany
// before
@BelongsToMany(() => Role, {
  as: 'roles',
  through: 'userRole',
})
public roles: IRole;

// after
@BelongsToMany(() => Role, {
  as: 'roles',
  through: 'userRole',
})
public roles: IRole;

public getRoles: BelongsToManyGetAssociationsMixin<Role>;

public setRoles: BelongsToManySetAssociationsMixin<Role, number>;

public addRoles: BelongsToManyAddAssociationsMixin<Role, number>;

public addRole: BelongsToManyAddAssociationMixin<Role, number>;

public createRole: BelongsToManyCreateAssociationMixin<Role>;

public removeRole: BelongsToManyRemoveAssociationMixin<Role, number>;

public removeRoles: BelongsToManyRemoveAssociationsMixin<Role, number>;

public hasRole: BelongsToManyHasAssociationMixin<Role, number>;

public hasRoles: BelongsToManyHasAssociationsMixin<Role, number>;

public countRoles: BelongsToManyCountAssociationsMixin;
  • @HasOne
// before
@HasOne(() => Role, {
  as: 'roles',
  through: 'userRole',
})
public roles: IRole;

// after
@HasOne(() => Role, {
  as: 'roles',
  through: 'userRole',
})
public roles: IRole;

public getRole: HasOneGetAssociationMixin<Role>;

public setRole: HasOneSetAssociationMixin<Role, number>;

public createRole: HasOneCreateAssociationMixin<Role>;
  • @HasMany
// before
@HasMany(() => Role, {
  as: 'roles',
  through: 'userRole',
})
public roles: IRole;

// after
@HasMany(() => Role, {
  as: 'roles',
  through: 'userRole',
})
public roles: IRole;

public getRoles: HasManyGetAssociationsMixin<Role>;

public setRoles: HasManySetAssociationsMixin<Role, number>;

public addRoles: HasManyAddAssociationsMixin<Role, number>;

public addRole: HasManyAddAssociationMixin<Role, number>;

public createRole: HasManyCreateAssociationMixin<Role>;

public removeRole: HasManyRemoveAssociationMixin<Role, number>;

public removeRoles: HasManyRemoveAssociationsMixin<Role, number>;

public hasRole: HasManyHasAssociationMixin<Role, number>;

public hasRoles: HasManyHasAssociationsMixin<Role, number>;

public countRoles: HasManyCountAssociationsMixin;
  • @BelongsTo
// before
@BelongsTo(() => Role, {
  as: 'roles',
  through: 'userRole',
})
public roles: IRole;

// after
@BelongsTo(() => Role, {
  as: 'roles',
  through: 'userRole',
})
public roles: IRole;

public getRole: BelongsToGetAssociationMixin<Role>;

public setRole: BelongsToSetAssociationMixin<Role, number>;

public createRole: BelongsToCreateAssociationMixin<Role>;

Note: Now only supported a-z A-Z 0-9 _ $ in variable declaration

Release Notes

1.0.0

Initial release of sequelize-ts-helper

1.0.1

  • add '_' and '$' in variable regular expression
  • support Double quotation marks(")

1.0.2

  • add image in README

1.0.3

  • use lodash.upperfirst

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft