import {
BelongsTo,
Column,
CreatedAt,
DataType,
ForeignKey,
HasMany,
Model,
Table,
UpdatedAt,
} from 'sequelize-typescript';
import User from './user.entity';
@Table({
tableName: 'sso_Staff',
timestamps: true,
createdAt: 'CreatedAt',
updatedAt: 'UpdatedAt',
})
export default class Staff extends Model {
@Column({
primaryKey: true,
allowNull: false,
type: DataType.STRING(10),
})
StaffNo: string;
@ForeignKey(() => User)
@Column({
allowNull: false,
type: DataType.INTEGER,
})
UserId: number;
@Column({
allowNull: true,
type: DataType.STRING(20),
})
IdNo: string;
@Column({
allowNull: false,
type: DataType.STRING(100),
})
StaffType: string;
@Column({
allowNull: false,
type: DataType.STRING(100),
})
JobTitle: string;
@Column({
allowNull: true,
type: DataType.STRING(20),
})
CarPlate: string;
@Column({
allowNull: true,
type: DataType.INTEGER,
})
Floor: string;
@Column({
allowNull: true,
type: DataType.STRING(20),
})
Extension: number;
@Column({
allowNull: false,
type: DataType.STRING(100),
})
Status: string;
@CreatedAt
CreatedAt: Date;
@UpdatedAt
UpdatedAt: Date;
@BelongsTo(() => User, 'UserId')
User: User;
@BelongsTo(() => User, 'CreatedById')
CreatedByUser: User;
@BelongsTo(() => User, 'UpdatedById')
UpdatedByUser: User;
}