@pintahub/database-schemas 2.0.3 → 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.3",
3
+ "version": "2.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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