-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.model.ts
63 lines (60 loc) · 1.04 KB
/
User.model.ts
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
import mongoose from "mongoose";
const UserSchema = new mongoose.Schema({
firebaseUserID: {
type: String,
required: true,
},
email: {
type: String,
required: true,
},
fullName: {
type: String,
required: true,
},
cashback: {
type: Number,
required: true,
},
allTimeCashback: {
type: Number,
required: true,
},
location: {
type: {
type: String,
required: true,
},
coordinates: [{ type: Number, required: false }],
street: {
type: String,
required: false,
},
},
createdAt: { type: Date, required: true, default: Date.now },
FCMs: [
{
type: String,
required: true,
},
],
likes: [
{
productID: {
type: mongoose.Types.ObjectId,
required: true,
},
},
],
favourites: [
{
shopID: {
type: mongoose.Types.ObjectId,
required: true,
},
},
],
});
UserSchema.index({ firebaseUserID: 1 });
const User = mongoose.model("user", UserSchema);
export default User;