forked from juice-shop/juice-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddress.ts
40 lines (37 loc) · 788 Bytes
/
address.ts
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
/*
* Copyright (c) 2014-2021 Bjoern Kimminich & the OWASP Juice Shop contributors.
* SPDX-License-Identifier: MIT
*/
/* jslint node: true */
export = (sequelize, { STRING, INTEGER }) => {
const Address = sequelize.define('Address', {
fullName: STRING,
mobileNum: {
type: INTEGER,
validate: {
isInt: true,
min: 1000000,
max: 9999999999
}
},
zipCode: {
type: STRING,
validate: {
len: [1, 8]
}
},
streetAddress: {
type: STRING,
validate: {
len: [1, 160]
}
},
city: STRING,
state: STRING,
country: STRING
})
Address.associate = ({ User }) => {
Address.belongsTo(User, { constraints: true, foreignKeyConstraint: true })
}
return Address
}