UNPKG

@tomei/sso

Version:
52 lines (46 loc) 916 B
import { BelongsTo, Column, CreatedAt, DataType, ForeignKey, Model, Table, } from 'sequelize-typescript'; import User from './user.entity'; import { IUserPasswordHistoryAttr } from '../interfaces/user-password-history.interface'; @Table({ tableName: 'sso_UserPasswordHistory', timestamps: true, createdAt: 'CreatedAt', updatedAt: 'UpdatedAt', }) export default class UserPasswordHistoryModel extends Model implements IUserPasswordHistoryAttr { @Column({ primaryKey: true, allowNull: false, type: DataType.STRING(30), }) HistoryId: string; @ForeignKey(() => User) @Column({ allowNull: false, type: DataType.INTEGER, }) UserId: number; @Column({ allowNull: false, type: DataType.STRING(225), }) PasswordHash: string; @CreatedAt CreatedAt: Date; @BelongsTo(() => User, { as: 'User', foreignKey: 'UserId', }) User: User; }