juice-shop
75 строк · 1.5 Кб
1/*
2* Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors.
3* SPDX-License-Identifier: MIT
4*/
5
6import {7type CreationOptional,8type InferAttributes,9type InferCreationAttributes,10Model,11DataTypes,12type Sequelize13} from 'sequelize'14/* jslint node: true */
15class Address extends Model<16InferAttributes<Address>,17InferCreationAttributes<Address>18> {19declare UserId: number20declare id: CreationOptional<number>21declare fullName: string22declare mobileNum: number23declare zipCode: string24declare streetAddress: string25declare city: string26declare state: string | null27declare country: string28}
29
30const AddressModelInit = (sequelize: Sequelize) => {31Address.init(32{33UserId: {34type: DataTypes.INTEGER35},36id: {37type: DataTypes.INTEGER,38primaryKey: true,39autoIncrement: true40},41fullName: {42type: DataTypes.STRING43},44mobileNum: {45type: DataTypes.INTEGER,46validate: {47isInt: true,48min: 1000000,49max: 999999999950}51},52zipCode: {53type: DataTypes.STRING,54validate: {55len: [1, 8]56}57},58streetAddress: {59type: DataTypes.STRING,60validate: {61len: [1, 160]62}63},64city: DataTypes.STRING,65state: DataTypes.STRING,66country: DataTypes.STRING67},68{69tableName: 'Addresses',70sequelize
71}72)73}
74
75export { Address as AddressModel, AddressModelInit }76