juice-shop

Форк
0
/
address.ts 
75 строк · 1.5 Кб
1
/*
2
 * Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors.
3
 * SPDX-License-Identifier: MIT
4
 */
5

6
import {
7
  type CreationOptional,
8
  type InferAttributes,
9
  type InferCreationAttributes,
10
  Model,
11
  DataTypes,
12
  type Sequelize
13
} from 'sequelize'
14
/* jslint node: true */
15
class Address extends Model<
16
InferAttributes<Address>,
17
InferCreationAttributes<Address>
18
> {
19
  declare UserId: number
20
  declare id: CreationOptional<number>
21
  declare fullName: string
22
  declare mobileNum: number
23
  declare zipCode: string
24
  declare streetAddress: string
25
  declare city: string
26
  declare state: string | null
27
  declare country: string
28
}
29

30
const AddressModelInit = (sequelize: Sequelize) => {
31
  Address.init(
32
    {
33
      UserId: {
34
        type: DataTypes.INTEGER
35
      },
36
      id: {
37
        type: DataTypes.INTEGER,
38
        primaryKey: true,
39
        autoIncrement: true
40
      },
41
      fullName: {
42
        type: DataTypes.STRING
43
      },
44
      mobileNum: {
45
        type: DataTypes.INTEGER,
46
        validate: {
47
          isInt: true,
48
          min: 1000000,
49
          max: 9999999999
50
        }
51
      },
52
      zipCode: {
53
        type: DataTypes.STRING,
54
        validate: {
55
          len: [1, 8]
56
        }
57
      },
58
      streetAddress: {
59
        type: DataTypes.STRING,
60
        validate: {
61
          len: [1, 160]
62
        }
63
      },
64
      city: DataTypes.STRING,
65
      state: DataTypes.STRING,
66
      country: DataTypes.STRING
67
    },
68
    {
69
      tableName: 'Addresses',
70
      sequelize
71
    }
72
  )
73
}
74

75
export { Address as AddressModel, AddressModelInit }
76

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.