@pintahub/database-schemas 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/schemas/DimensionObject.js +16 -0
- package/schemas/Image.js +41 -0
- package/schemas/Product.js +4 -0
- package/schemas/Review.js +12 -12
package/package.json
CHANGED
package/schemas/Image.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const {Schema} = require('mongoose')
|
|
2
|
+
const DimensionObject = require('./DimensionObject')
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const Image = new Schema({
|
|
6
|
+
store: {
|
|
7
|
+
type: Schema.Types.ObjectId,
|
|
8
|
+
index: true,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
path: {
|
|
13
|
+
type: String,
|
|
14
|
+
trim: true
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
dimension: {
|
|
18
|
+
type: DimensionObject
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
mimetype: {
|
|
22
|
+
type: String,
|
|
23
|
+
trim: true,
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
size: {
|
|
27
|
+
type: Number,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
updated_at: {
|
|
31
|
+
type: Date,
|
|
32
|
+
default: Date.now
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
created_at: {
|
|
36
|
+
type: Date,
|
|
37
|
+
default: Date.now
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
module.exports = Image
|
package/schemas/Product.js
CHANGED
package/schemas/Review.js
CHANGED
|
@@ -11,7 +11,6 @@ const Review = new Schema({
|
|
|
11
11
|
product_type: {
|
|
12
12
|
type: String,
|
|
13
13
|
trim: true,
|
|
14
|
-
required: true,
|
|
15
14
|
index: true
|
|
16
15
|
},
|
|
17
16
|
|
|
@@ -21,6 +20,11 @@ const Review = new Schema({
|
|
|
21
20
|
required: true,
|
|
22
21
|
},
|
|
23
22
|
|
|
23
|
+
email: {
|
|
24
|
+
type: String,
|
|
25
|
+
trim: true,
|
|
26
|
+
},
|
|
27
|
+
|
|
24
28
|
vote_value: {
|
|
25
29
|
type: Number,
|
|
26
30
|
default: 5,
|
|
@@ -32,9 +36,9 @@ const Review = new Schema({
|
|
|
32
36
|
trim: true,
|
|
33
37
|
},
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
type:
|
|
37
|
-
|
|
39
|
+
image: {
|
|
40
|
+
type: Schema.Types.ObjectId,
|
|
41
|
+
index: true
|
|
38
42
|
},
|
|
39
43
|
|
|
40
44
|
is_verified: {
|
|
@@ -44,13 +48,13 @@ const Review = new Schema({
|
|
|
44
48
|
|
|
45
49
|
country_code: {
|
|
46
50
|
type: String,
|
|
51
|
+
default: 'US',
|
|
47
52
|
trim: true,
|
|
48
53
|
},
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
type:
|
|
52
|
-
|
|
53
|
-
index: true,
|
|
55
|
+
updated_at: {
|
|
56
|
+
type: Date,
|
|
57
|
+
default: Date.now,
|
|
54
58
|
},
|
|
55
59
|
|
|
56
60
|
created_at: {
|
|
@@ -60,10 +64,6 @@ const Review = new Schema({
|
|
|
60
64
|
}
|
|
61
65
|
})
|
|
62
66
|
|
|
63
|
-
Review.index({
|
|
64
|
-
product_type: 1,
|
|
65
|
-
name: 1,
|
|
66
|
-
})
|
|
67
67
|
|
|
68
68
|
module.exports = Review
|
|
69
69
|
|