Spaces:
Runtime error
Runtime error
import { | |
DataTypes, | |
Model, | |
CreationOptional | |
} from 'sequelize'; | |
import { sequelize } from './index'; | |
import { PwWorkOrdersInterface } from '../shared/interfaces/pwWorkOrdersInterface'; | |
class PwWorkOrders extends Model<PwWorkOrdersInterface> implements PwWorkOrdersInterface | |
{ | |
declare id: CreationOptional<number>; | |
declare pw_id: number; | |
declare number: number; | |
declare location: string; | |
declare portfolio_id: number; | |
declare building_id: number; | |
declare unit_id: number; | |
declare status: string; | |
declare assigned_vendors: string[]; | |
} | |
PwWorkOrders.init( | |
{ | |
id: { | |
type: DataTypes.BIGINT.UNSIGNED, | |
autoIncrement: true, | |
primaryKey: true, | |
unique: true, | |
}, | |
pw_id: { | |
type: DataTypes.BIGINT, | |
allowNull: false, | |
unique: true, | |
}, | |
number: { | |
type: DataTypes.BIGINT, | |
allowNull: false, | |
unique: true, | |
}, | |
location: { | |
type: DataTypes.STRING, | |
allowNull: true, | |
}, | |
portfolio_id: { | |
type: DataTypes.BIGINT, | |
allowNull: true, | |
}, | |
building_id: { | |
type: DataTypes.BIGINT, | |
allowNull: true, | |
}, | |
unit_id: { | |
type: DataTypes.BIGINT, | |
allowNull: true, | |
}, | |
status: { | |
type: DataTypes.STRING, | |
allowNull: false, | |
}, | |
assigned_vendors: { | |
type: DataTypes.JSON, | |
allowNull: true, | |
}, | |
}, | |
{ | |
sequelize, | |
tableName: 'pw_workorders', | |
underscored: true, | |
freezeTableName: true, | |
timestamps: true, | |
createdAt: 'created_at', | |
updatedAt: 'updated_at', | |
} | |
); | |
export default PwWorkOrders; | |