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
78
79
80
81
82
83
84
85
|
const Sequelize = require('sequelize');
function setUpModels(database) {
const models = {
"transaction": database.define('transaction', {
when: {
type: Sequelize.DATE,
allowNull: false,
},
amount: {
type: Sequelize.DECIMAL,
allowNull: false,
},
where: {
type: Sequelize.STRING,
allowNull: false,
},
category: {
type: Sequelize.STRING,
allowNull: false,
},
subcategory: {
type: Sequelize.STRING,
allowNull: false,
},
username: {
type: Sequelize.STRING,
allowNull: false,
},
}),
"goals": database.define('goal', {
username: {
type: Sequelize.STRING,
allowNull: false,
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
total: {
type: Sequelize.DECIMAL,
allowNull: false,
},
amount: {
type: Sequelize.DECIMAL,
allowNull: false,
}
}),
"expected": database.define('expected', {
username: {
type: Sequelize.STRING,
allowNull: false,
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
total: {
type: Sequelize.DECIMAL,
allowNull: false,
},
days: {
type: Sequelize.INTEGER,
allowNull: false,
}
}),
"users": database.define('user', {
username: {
type: Sequelize.STRING,
allowNull: false,
},
password: {
type: Sequelize.STRING,
allowNull: false,
},
salt: {
type: Sequelize.STRING,
allowNull: false,
},
}),
}
return models;
}
module.exports = {
setUpModels
}
|