Model is error
helloqinsong opened this issue · comments
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