@pintahub/database-schemas 2.0.7 → 2.0.9
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/Fulfillment.js +67 -0
- package/schemas/MoneyObject.js +18 -0
- package/schemas/Order.js +6 -13
- package/schemas/OrderItem.js +67 -0
package/package.json
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const {Schema} = require('mongoose')
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const Fulfillment = new Schema({
|
|
5
|
+
store: {
|
|
6
|
+
type: Schema.Types.ObjectId,
|
|
7
|
+
index: true,
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
order: {
|
|
12
|
+
type: Schema.Types.ObjectId,
|
|
13
|
+
index: true,
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
id: {
|
|
18
|
+
type: String,
|
|
19
|
+
trim: true,
|
|
20
|
+
index: true,
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
name: {
|
|
24
|
+
type: String,
|
|
25
|
+
trim: true,
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
shipment_status: {
|
|
29
|
+
type: String,
|
|
30
|
+
trim: true,
|
|
31
|
+
lowercase: true,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
tracking_number: {
|
|
35
|
+
type: String,
|
|
36
|
+
trim: true,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
tracking_url: {
|
|
40
|
+
type: String,
|
|
41
|
+
trim: true,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
tracking_company: {
|
|
45
|
+
type: String,
|
|
46
|
+
trim: true,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
notify_customer: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
updated_at: {
|
|
55
|
+
type: Date,
|
|
56
|
+
default: Date.now
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
created_at: {
|
|
60
|
+
type: Date,
|
|
61
|
+
default: Date.now,
|
|
62
|
+
index: true,
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
module.exports = Fulfillment
|
|
67
|
+
|
package/schemas/Order.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
|
+
const MoneyObject = require('./MoneyObject')
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
const ShippingAddress = new Schema({
|
|
@@ -16,19 +17,6 @@ const ShippingAddress = new Schema({
|
|
|
16
17
|
},
|
|
17
18
|
})
|
|
18
19
|
|
|
19
|
-
const MoneyObject = new Schema({
|
|
20
|
-
_id: false,
|
|
21
|
-
|
|
22
|
-
amount: {
|
|
23
|
-
type: Number,
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
currency: {
|
|
27
|
-
type: String,
|
|
28
|
-
trim: true,
|
|
29
|
-
default: 'USD',
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
20
|
|
|
33
21
|
const Order = new Schema({
|
|
34
22
|
store: {
|
|
@@ -88,6 +76,11 @@ const Order = new Schema({
|
|
|
88
76
|
trim: true,
|
|
89
77
|
},
|
|
90
78
|
|
|
79
|
+
last_synced_at: {
|
|
80
|
+
type: Date,
|
|
81
|
+
default: Date.now
|
|
82
|
+
},
|
|
83
|
+
|
|
91
84
|
updated_at: {
|
|
92
85
|
type: Date,
|
|
93
86
|
default: Date.now
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const {Schema} = require('mongoose')
|
|
2
|
+
const MoneyObject = require('./MoneyObject')
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const OrderItem = new Schema({
|
|
6
|
+
store: {
|
|
7
|
+
type: Schema.Types.ObjectId,
|
|
8
|
+
index: true,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
order: {
|
|
13
|
+
type: Schema.Types.ObjectId,
|
|
14
|
+
index: true,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
id: {
|
|
19
|
+
type: String,
|
|
20
|
+
trim: true,
|
|
21
|
+
index: true,
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
product: {
|
|
25
|
+
type: Schema.Types.ObjectId,
|
|
26
|
+
index: true,
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
quantity: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 1,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
price: {
|
|
35
|
+
type: MoneyObject,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
fulfillment_status: {
|
|
39
|
+
type: String,
|
|
40
|
+
trim: true,
|
|
41
|
+
lowercase: true,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
variant_id: {
|
|
45
|
+
type: String,
|
|
46
|
+
trim: true,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
variant_title: {
|
|
50
|
+
type: String,
|
|
51
|
+
trim: true,
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
updated_at: {
|
|
55
|
+
type: Date,
|
|
56
|
+
default: Date.now
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
created_at: {
|
|
60
|
+
type: Date,
|
|
61
|
+
default: Date.now,
|
|
62
|
+
index: true,
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
module.exports = OrderItem
|
|
67
|
+
|