@pintahub/database-schemas 2.0.2 → 2.0.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/database-schemas",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/schemas/Media.js CHANGED
@@ -41,6 +41,12 @@ const Media = new Schema({
41
41
  type: Number,
42
42
  },
43
43
 
44
+ attempts: {
45
+ type: Number,
46
+ default: 0,
47
+ index: true
48
+ },
49
+
44
50
  updated_at: {
45
51
  type: Date,
46
52
  default: Date.now
@@ -48,7 +54,8 @@ const Media = new Schema({
48
54
 
49
55
  created_at: {
50
56
  type: Date,
51
- default: Date.now
57
+ default: Date.now,
58
+ index: true
52
59
  }
53
60
  })
54
61
 
@@ -0,0 +1,78 @@
1
+ const {Schema} = require('mongoose')
2
+
3
+
4
+ const DimensionObject = new Schema({
5
+ _id: false,
6
+
7
+ width: {
8
+ type: Number,
9
+ },
10
+
11
+ height: {
12
+ type: Number,
13
+ }
14
+ })
15
+
16
+ const ProductImage = new Schema({
17
+ store: {
18
+ type: Schema.Types.ObjectId,
19
+ index: true,
20
+ required: true,
21
+ },
22
+
23
+ product: {
24
+ type: Schema.Types.ObjectId,
25
+ index: true,
26
+ required: true,
27
+ },
28
+
29
+ id: {
30
+ type: String,
31
+ trim: true,
32
+ index: true,
33
+ },
34
+
35
+ url: {
36
+ type: String,
37
+ trim: true,
38
+ },
39
+
40
+ status: {
41
+ type: String,
42
+ trim: true,
43
+ index: true,
44
+ default: 'pending'
45
+ },
46
+
47
+ mimetype: {
48
+ type: String,
49
+ trim: true,
50
+ },
51
+
52
+ size: {
53
+ type: Number,
54
+ },
55
+
56
+ dimension: {
57
+ type: DimensionObject
58
+ },
59
+
60
+ attempts: {
61
+ type: Number,
62
+ default: 0,
63
+ index: true
64
+ },
65
+
66
+ updated_at: {
67
+ type: Date,
68
+ default: Date.now
69
+ },
70
+
71
+ created_at: {
72
+ type: Date,
73
+ default: Date.now,
74
+ index: true
75
+ }
76
+ })
77
+
78
+ module.exports = ProductImage