-
Notifications
You must be signed in to change notification settings - Fork 9
/
UserSchema.js
123 lines (118 loc) · 2.12 KB
/
UserSchema.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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
const mongoose = require("mongoose");
const UserSchema = new mongoose.Schema(
{
firstName: {
type: String,
required: true,
},
lastName: {
type: String,
required: true,
},
email: {
type: String,
required: true,
},
password: {
type: String,
},
username: {
type: String,
},
cartproducts: [
{
productType: {
type: String,
required: true,
},
productName: {
type: String,
required: true,
},
productPrice: {
type: Number,
required: true,
},
productDescription: {
type: String,
required: true,
},
productImage: {
type: String,
required: true,
},
productQty: {
type: Number,
required: true,
},
productSize: {
type: String,
},
productSlug: {
type: String,
required: true,
},
purchasedQty: {
type: Number,
default: 0,
},
totalPrice: {
type: Number,
},
},
],
address: {
type: String,
},
state: {
type: String,
},
pincode: {
type: String,
},
city: {
type: String,
},
phone: {
type: String,
},
sellproducts: [
{
name: {
type: String,
required: true,
},
qty: {
type: String,
required: true,
},
size: {
type: String,
},
slug: {
type: String,
required: true,
},
price: {
type: Number,
required: true,
},
category: {
type: String,
required: true,
},
desc: {
type: String,
required: true,
},
img: {
type: String,
required: true,
},
},
],
},
{ timetamps: true }
);
const Users = mongoose.models.user || mongoose.model("user", UserSchema);
export default Users;