-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.js
51 lines (47 loc) · 934 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
45
46
47
48
49
50
51
const mongoose = require("mongoose");
require("./connection");
const UserSchema = new mongoose.Schema({
username: {
type: String,
required: [true, "Can't be blank"],
unique: true,
},
email: {
type: String,
lowercase: true,
unique: true,
required: [true, "Can't be blank"],
},
bio: {
type: String,
default: "",
},
password: {
type: String,
required: [true, "Can't be blank"],
},
picture: {
type: String,
default:
"https://res.cloudinary.com/chifarol/image/upload/v1664278102/ChatApp/user/person_FILL1_wght400_GRAD0_opsz48_bdhxq9.png",
},
rooms: {
type: [[]],
default: [],
},
dms: {
type: [[]],
default: [],
},
blocked: {
type: [String],
default: [],
},
online: {
type: Boolean,
default: false,
},
});
const model = mongoose.model;
const User = model("User", UserSchema);
module.exports = { model, User };