Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model is error #1702

Open
1 of 2 tasks
helloqinsong opened this issue Dec 8, 2023 · 1 comment
Open
1 of 2 tasks

Model is error #1702

helloqinsong opened this issue Dec 8, 2023 · 1 comment

Comments

@helloqinsong
Copy link

helloqinsong commented Dec 8, 2023

Issue

Versions

  • sequelize:
  • sequelize-typescript:
  • typescript:

Issue type

  • bug report
  • feature request

Actual behavior

Expected behavior

Steps to reproduce

Related code

![image](https://github.com/sequelize/sequelize-typescript/assets/54099383/b7a8fda0-ca61-4951-a09b-4e438cfc9cc4)
import {
  Column,
  Model,
  Table,
  PrimaryKey,
  AutoIncrement,
  DataType,
} from 'sequelize-typescript';
import { BcryptService } from '../common/bcrypt';

@Table({
  tableName: 'user',
})
export class UserModel extends Model<UserModel> {
  @PrimaryKey
  @AutoIncrement
  @Column({
    type: DataType.INTEGER,
    allowNull: false,
    unique: true,
  })
  id: number;

  @Column({ comment: '用户名' })
  name: string;

  @Column({ comment: '密码', type: DataType.STRING })
  set password(val: string) {
    this.setDataValue('password', new BcryptService().hash(val));
  }

  @Column({ comment: '权限' })
  role: number;

  @Column({ defaultValue: true })
  isActive: boolean;
}

insert short code snippets here

Tasks

No tasks being tracked yet.
@helloqinsong
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant