File size: 1,594 Bytes
6150c79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39bf8fb
6150c79
 
 
 
39bf8fb
6150c79
 
 
59e31fe
6150c79
 
 
59e31fe
6150c79
 
 
59e31fe
6150c79
 
 
59e31fe
6150c79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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;