-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.js
48 lines (44 loc) · 865 Bytes
/
db.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
42
43
44
45
46
47
48
const { Sequelize, Op } = require('sequelize');
const sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.PASSWORD, {
host: process.env.DB_HOST,
dialect: process.env.DB_DIALECT,
ssl: true,
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false
}
}
});
const Users = sequelize.define('users', {
handle: {
type: Sequelize.STRING,
unique: true,
},
userId: {
type: Sequelize.STRING,
unique: true,
},
passCode: {
type: Sequelize.STRING,
unique: true,
},
useCounter: Sequelize.INTEGER,
lastAccess: Sequelize.DATE,
jwt: Sequelize.STRING
});
const Lists = sequelize.define('lists', {
name: {
type: Sequelize.STRING,
unique: true,
},
size: {
type: Sequelize.INTEGER,
allowNull: false
}
});
module.exports = {
Users,
Lists,
Op
};