import {
BelongsTo,
Column,
CreatedAt,
DataType,
ForeignKey,
Model,
Table,
UpdatedAt,
} from 'sequelize-typescript';
import { BuildingTypeEnum } from '../enum/building-type.enum';
import GroupModel from './group.entity';
@Table({
tableName: 'sso_Building',
timestamps: true,
createdAt: 'CreatedAt',
updatedAt: 'UpdatedAt',
})
export default class BuildingModel extends Model {
@ForeignKey(() => GroupModel)
@Column({
primaryKey: true,
allowNull: false,
type: DataType.STRING(10),
})
GroupCode: string;
@Column({
allowNull: false,
type: DataType.STRING(100),
})
BuildingType: BuildingTypeEnum;
@Column({
allowNull: true,
type: DataType.STRING(200),
})
Email: string;
@Column({
allowNull: true,
type: DataType.STRING(20),
})
Mobile: string;
@Column({
allowNull: false,
type: DataType.STRING(20),
})
Phone: string;
@Column({
allowNull: true,
type: DataType.STRING(10),
})
Brand: string;
@Column({
allowNull: false,
type: DataType.INTEGER,
})
AreaManagerUserId: number;
@Column({
allowNull: false,
type: DataType.DATE,
})
OpeningDate: Date;
@Column({
allowNull: false,
type: DataType.DATE,
})
CeasedDate: Date;
@Column({
allowNull: true,
type: DataType.STRING(200),
})
OpeningHours: string;
@Column({
allowNull: false,
type: DataType.INTEGER,
})
CreatedById: number;
@Column({
allowNull: false,
type: DataType.INTEGER,
})
UpdatedById: number;
@CreatedAt
CreatedAt: Date;
@UpdatedAt
UpdatedAt: Date;
@BelongsTo(() => GroupModel, 'GroupCode')
Group: GroupModel;
}