-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.js
44 lines (40 loc) · 927 Bytes
/
models.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
const { Sequelize } = require("sequelize");
let connection;
if (process.env.NODE_ENV === "production")
connection = process.env.DATABASE_URL;
else
connection = {
database: "horology_db",
dialect: "postgres",
operatorsAliases: false,
define: {
underscored: true
}
};
const sequelize = new Sequelize(connection);
const Watch = sequelize.define("watches", {
name: Sequelize.STRING,
description: Sequelize.STRING,
price: Sequelize.INTEGER,
image: Sequelize.STRING,
image30: Sequelize.STRING,
image400: Sequelize.STRING,
brand: Sequelize.STRING,
gender: Sequelize.STRING,
publicId: Sequelize.STRING
});
const User = sequelize.define("users", {
username: Sequelize.STRING,
password: Sequelize.STRING,
admin: {
type: Sequelize.BOOLEAN,
defaultValue: true
},
wishlist: Sequelize.TEXT,
cart: Sequelize.TEXT
});
module.exports = {
sequelize,
Watch,
User
};