forked from juice-shop/juice-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.js
41 lines (38 loc) · 766 Bytes
/
card.js
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
/*
* Copyright (c) 2014-2020 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
/* jslint node: true */
module.exports = (sequelize, { STRING, INTEGER }) => {
const Card = sequelize.define('Card', {
fullName: STRING,
cardNum: {
type: INTEGER,
validate: {
isInt: true,
min: 1000000000000000,
max: 9999999999999999
}
},
expMonth: {
type: INTEGER,
validate: {
isInt: true,
min: 1,
max: 12
}
},
expYear: {
type: INTEGER,
validate: {
isInt: true,
min: 2080,
max: 2099
}
}
})
Card.associate = ({ User }) => {
Card.belongsTo(User, { constraints: true, foreignKeyConstraint: true })
}
return Card
}