@cendo/database-schemas 2.1.9 → 2.2.0
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/CLAUDE.md +2 -0
- package/package.json +1 -1
- package/schemas/CarrierSetting.js +9 -1
- package/schemas/FulfillmentStore.js +12 -0
- package/schemas/ImportFile.js +7 -1
- package/schemas/ImportRow.js +11 -0
- package/schemas/Label.js +15 -0
- package/schemas/Media.js +16 -0
- package/schemas/Order.js +45 -1
- package/schemas/OrderFulfillment.js +25 -0
- package/schemas/OrderHistory.js +8 -1
- package/schemas/OrderItem.js +23 -0
- package/schemas/OrderLog.js +10 -1
- package/schemas/Product.js +24 -0
- package/schemas/ShippingCarrier.js +8 -0
- package/schemas/Shop.js +14 -1
- package/schemas/ShopSetting.js +9 -1
- package/schemas/SourceItem.js +19 -1
- package/schemas/SourceOrder.js +12 -0
- package/schemas/TestResponse.js +10 -0
- package/schemas/WebhookEvent.js +11 -1
- package/schemas/types/AttachmentObject.js +6 -0
- package/schemas/types/DimensionObject.js +6 -0
- package/schemas/types/FulfillmentObject.js +6 -0
- package/schemas/types/MoneyObject.js +6 -0
- package/schemas/types/ShippingAddress.js +18 -1
- package/schemas/types/TrackingObject.js +8 -1
|
@@ -2,96 +2,121 @@ const {Schema} = require('mongoose')
|
|
|
2
2
|
const TrackingObject = require('./types/TrackingObject')
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Item — Embedded sub-document for items in a fulfillment shipment.
|
|
7
|
+
*/
|
|
5
8
|
const Item = new Schema({
|
|
6
9
|
_id: false,
|
|
7
10
|
|
|
11
|
+
/** Item ID from the fulfillment provider */
|
|
8
12
|
external_id: {
|
|
9
13
|
type: String,
|
|
10
14
|
trim: true,
|
|
11
15
|
},
|
|
12
16
|
|
|
17
|
+
/** SKU code in the fulfillment system */
|
|
13
18
|
sku: {
|
|
14
19
|
type: String,
|
|
15
20
|
trim: true,
|
|
16
21
|
},
|
|
17
22
|
|
|
23
|
+
/** Variant code in the fulfillment system */
|
|
18
24
|
variant_code: {
|
|
19
25
|
type: String,
|
|
20
26
|
trim: true,
|
|
21
27
|
},
|
|
22
28
|
|
|
29
|
+
/** Quantity of this item in the shipment */
|
|
23
30
|
quantity: {
|
|
24
31
|
type: Number,
|
|
25
32
|
}
|
|
26
33
|
})
|
|
27
34
|
|
|
35
|
+
/**
|
|
36
|
+
* OrderFulfillment — Fulfillment/shipment records.
|
|
37
|
+
* Tracks production and shipping for orders sent to a fulfillment provider.
|
|
38
|
+
*/
|
|
28
39
|
const OrderFulfillment = new Schema({
|
|
40
|
+
/** Reference to the Shop */
|
|
29
41
|
shop: {
|
|
30
42
|
type: Schema.Types.ObjectId,
|
|
31
43
|
index: true,
|
|
32
44
|
},
|
|
33
45
|
|
|
46
|
+
/** Reference to the parent Order */
|
|
34
47
|
order: {
|
|
35
48
|
type: Schema.Types.ObjectId,
|
|
36
49
|
index: true,
|
|
37
50
|
required: true,
|
|
38
51
|
},
|
|
39
52
|
|
|
53
|
+
/** Reference to the FulfillmentStore handling this shipment */
|
|
40
54
|
fulfillment_store: {
|
|
41
55
|
type: Schema.Types.ObjectId,
|
|
42
56
|
},
|
|
43
57
|
|
|
58
|
+
/** Fulfillment/shipment number from the provider */
|
|
44
59
|
number: {
|
|
45
60
|
type: String,
|
|
46
61
|
trim: true,
|
|
47
62
|
index: true,
|
|
48
63
|
},
|
|
49
64
|
|
|
65
|
+
/** Fulfillment ID from the provider's system */
|
|
50
66
|
external_id: {
|
|
51
67
|
type: String,
|
|
52
68
|
trim: true,
|
|
53
69
|
},
|
|
54
70
|
|
|
71
|
+
/** Current production status from the provider (e.g., 'in_production', 'shipped') */
|
|
55
72
|
production_status: {
|
|
56
73
|
type: String,
|
|
57
74
|
trim: true,
|
|
58
75
|
index: true,
|
|
59
76
|
},
|
|
60
77
|
|
|
78
|
+
/** Shipping tracking information (embedded) */
|
|
61
79
|
tracking: {
|
|
62
80
|
type: TrackingObject,
|
|
63
81
|
},
|
|
64
82
|
|
|
83
|
+
/** List of items included in this shipment (embedded) */
|
|
65
84
|
items: {
|
|
66
85
|
type: [Item],
|
|
67
86
|
index: true,
|
|
68
87
|
},
|
|
69
88
|
|
|
89
|
+
/** Whether tracking info has been imported back to the source platform */
|
|
70
90
|
tracking_imported: {
|
|
71
91
|
type: Boolean,
|
|
72
92
|
default: false,
|
|
73
93
|
},
|
|
74
94
|
|
|
95
|
+
/** Timestamp when tracking was requested from the carrier */
|
|
75
96
|
request_tracking_at: {
|
|
76
97
|
type: Date,
|
|
77
98
|
},
|
|
78
99
|
|
|
100
|
+
/** Timestamp when this fulfillment was pushed to the provider */
|
|
79
101
|
pushed_at: {
|
|
80
102
|
type: Date,
|
|
81
103
|
default: Date.now,
|
|
82
104
|
},
|
|
83
105
|
|
|
106
|
+
/** Last sync timestamp from the fulfillment provider */
|
|
84
107
|
synced_at: {
|
|
85
108
|
type: Date,
|
|
86
109
|
default: Date.now,
|
|
87
110
|
index: true,
|
|
88
111
|
},
|
|
89
112
|
|
|
113
|
+
/** Last modification timestamp */
|
|
90
114
|
updated_at: {
|
|
91
115
|
type: Date,
|
|
92
116
|
default: Date.now
|
|
93
117
|
},
|
|
94
118
|
|
|
119
|
+
/** Creation timestamp */
|
|
95
120
|
created_at: {
|
|
96
121
|
type: Date,
|
|
97
122
|
default: Date.now,
|
package/schemas/OrderHistory.js
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* OrderHistory — Audit log of actions performed on an order.
|
|
6
|
+
*/
|
|
4
7
|
const OrderHistory = new Schema({
|
|
8
|
+
/** Reference to the Order */
|
|
5
9
|
order: {
|
|
6
10
|
type: Schema.Types.ObjectId,
|
|
7
11
|
index: true,
|
|
8
12
|
required: true,
|
|
9
13
|
},
|
|
10
14
|
|
|
15
|
+
/** Action identifier (e.g., 'validation_updated', 'fulfillment_created') */
|
|
11
16
|
action: {
|
|
12
17
|
type: String,
|
|
13
18
|
trim: true,
|
|
14
19
|
index: true,
|
|
15
20
|
},
|
|
16
21
|
|
|
22
|
+
/** Human-readable description of the action */
|
|
17
23
|
description: {
|
|
18
24
|
type: String,
|
|
19
25
|
trim: true,
|
|
20
26
|
},
|
|
21
27
|
|
|
28
|
+
/** Additional context data for the action */
|
|
22
29
|
meta: {
|
|
23
30
|
type: Schema.Types.Mixed,
|
|
24
31
|
},
|
|
25
32
|
|
|
33
|
+
/** Timestamp of the action */
|
|
26
34
|
created_at: {
|
|
27
35
|
type: Date,
|
|
28
36
|
default: Date.now,
|
|
@@ -31,4 +39,3 @@ const OrderHistory = new Schema({
|
|
|
31
39
|
})
|
|
32
40
|
|
|
33
41
|
module.exports = OrderHistory
|
|
34
|
-
|
package/schemas/OrderItem.js
CHANGED
|
@@ -1,99 +1,122 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* OrderItem — Line items within an order.
|
|
6
|
+
* Each record represents a product/SKU purchased in an order.
|
|
7
|
+
*/
|
|
4
8
|
const OrderItem = new Schema({
|
|
9
|
+
/** Reference to the parent Order */
|
|
5
10
|
order: {
|
|
6
11
|
type: Schema.Types.ObjectId,
|
|
7
12
|
required: true,
|
|
8
13
|
index: true,
|
|
9
14
|
},
|
|
10
15
|
|
|
16
|
+
/** Line item ID from the source platform */
|
|
11
17
|
external_id: {
|
|
12
18
|
type: String,
|
|
13
19
|
trim: true,
|
|
14
20
|
index: true,
|
|
15
21
|
},
|
|
16
22
|
|
|
23
|
+
/** Internal SKU identifier */
|
|
17
24
|
sku_id: {
|
|
18
25
|
type: String,
|
|
19
26
|
trim: true,
|
|
20
27
|
index: true,
|
|
21
28
|
},
|
|
22
29
|
|
|
30
|
+
/** Seller's own SKU code */
|
|
23
31
|
seller_sku: {
|
|
24
32
|
type: String,
|
|
25
33
|
trim: true,
|
|
26
34
|
},
|
|
27
35
|
|
|
36
|
+
/** Product display name */
|
|
28
37
|
product_name: {
|
|
29
38
|
type: String,
|
|
30
39
|
trim: true,
|
|
31
40
|
},
|
|
32
41
|
|
|
42
|
+
/** Variant description (e.g., size, color) */
|
|
33
43
|
variant_name: {
|
|
34
44
|
type: String,
|
|
35
45
|
trim: true,
|
|
36
46
|
},
|
|
37
47
|
|
|
48
|
+
/** Quantity ordered */
|
|
38
49
|
quantity: {
|
|
39
50
|
type: Number,
|
|
40
51
|
default: 1,
|
|
41
52
|
},
|
|
42
53
|
|
|
54
|
+
/** Internal note for this line item */
|
|
43
55
|
note: {
|
|
44
56
|
type: String,
|
|
45
57
|
trim: true,
|
|
46
58
|
},
|
|
47
59
|
|
|
60
|
+
/** Customer note or personalization text from platform */
|
|
48
61
|
external_note: {
|
|
49
62
|
type: String,
|
|
50
63
|
trim: true,
|
|
51
64
|
},
|
|
52
65
|
|
|
66
|
+
/** Engraving/personalization text for custom products */
|
|
53
67
|
engrave_text: {
|
|
54
68
|
type: String,
|
|
55
69
|
trim: true,
|
|
56
70
|
},
|
|
57
71
|
|
|
72
|
+
/** SKU code used by the fulfillment provider */
|
|
58
73
|
fulfillment_sku: {
|
|
59
74
|
type: String,
|
|
60
75
|
trim: true,
|
|
61
76
|
},
|
|
62
77
|
|
|
78
|
+
/** Customization/personalization job ID */
|
|
63
79
|
customize_id: {
|
|
64
80
|
type: String,
|
|
65
81
|
trim: true,
|
|
66
82
|
},
|
|
67
83
|
|
|
84
|
+
/** Number of attempts to sync mockup/design media */
|
|
68
85
|
sync_media_attempts: {
|
|
69
86
|
type: Number,
|
|
70
87
|
default: 0,
|
|
71
88
|
},
|
|
72
89
|
|
|
90
|
+
/** Last time media sync was attempted */
|
|
73
91
|
last_sync_media_at: {
|
|
74
92
|
type: Date,
|
|
75
93
|
},
|
|
76
94
|
|
|
95
|
+
/** Reference to the Media record for the product mockup image */
|
|
77
96
|
mockup: {
|
|
78
97
|
type: Schema.Types.ObjectId,
|
|
79
98
|
// ref: 'Media'
|
|
80
99
|
},
|
|
81
100
|
|
|
101
|
+
/** Reference to the Media record for the print-ready design file */
|
|
82
102
|
design: {
|
|
83
103
|
type: Schema.Types.ObjectId,
|
|
84
104
|
// ref: 'Media'
|
|
85
105
|
},
|
|
86
106
|
|
|
107
|
+
/** External sync identifier for deduplication */
|
|
87
108
|
sync_id: {
|
|
88
109
|
type: String,
|
|
89
110
|
trim: true,
|
|
90
111
|
},
|
|
91
112
|
|
|
113
|
+
/** Last modification timestamp */
|
|
92
114
|
updated_at: {
|
|
93
115
|
type: Date,
|
|
94
116
|
default: Date.now
|
|
95
117
|
},
|
|
96
118
|
|
|
119
|
+
/** Creation timestamp */
|
|
97
120
|
created_at: {
|
|
98
121
|
type: Date,
|
|
99
122
|
default: Date.now,
|
package/schemas/OrderLog.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* OrderLog — Operational event logging for orders.
|
|
6
|
+
* Auto-deleted after 90 days via TTL index.
|
|
7
|
+
*/
|
|
4
8
|
const OrderLog = new Schema({
|
|
9
|
+
/** Reference to the Order */
|
|
5
10
|
order: {
|
|
6
11
|
type: Schema.Types.ObjectId,
|
|
7
12
|
index: true,
|
|
8
13
|
required: true,
|
|
9
14
|
},
|
|
10
15
|
|
|
16
|
+
/** Log level: 'info' | 'warning' | 'error' */
|
|
11
17
|
level: {
|
|
12
18
|
type: String,
|
|
13
19
|
trim: true,
|
|
@@ -15,21 +21,25 @@ const OrderLog = new Schema({
|
|
|
15
21
|
enum: ['info', 'warning', 'error']
|
|
16
22
|
},
|
|
17
23
|
|
|
24
|
+
/** Log category/source label */
|
|
18
25
|
label: {
|
|
19
26
|
type: String,
|
|
20
27
|
trim: true,
|
|
21
28
|
default: '',
|
|
22
29
|
},
|
|
23
30
|
|
|
31
|
+
/** Log message content */
|
|
24
32
|
message: {
|
|
25
33
|
type: String,
|
|
26
34
|
trim: true,
|
|
27
35
|
},
|
|
28
36
|
|
|
37
|
+
/** Structured data associated with the log entry */
|
|
29
38
|
meta: {
|
|
30
39
|
type: Schema.Types.Mixed,
|
|
31
40
|
},
|
|
32
41
|
|
|
42
|
+
/** Timestamp (TTL: 90 days) */
|
|
33
43
|
created_at: {
|
|
34
44
|
type: Date,
|
|
35
45
|
default: Date.now,
|
|
@@ -39,4 +49,3 @@ const OrderLog = new Schema({
|
|
|
39
49
|
})
|
|
40
50
|
|
|
41
51
|
module.exports = OrderLog
|
|
42
|
-
|
package/schemas/Product.js
CHANGED
|
@@ -1,44 +1,66 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Product — Product/SKU catalog.
|
|
6
|
+
* Maps seller SKUs to fulfillment SKUs and customization configs.
|
|
7
|
+
*/
|
|
4
8
|
const Product = new Schema({
|
|
9
|
+
/** Reference to the Shop this product belongs to */
|
|
5
10
|
shop: {
|
|
6
11
|
type: Schema.Types.ObjectId,
|
|
7
12
|
index: true,
|
|
8
13
|
},
|
|
9
14
|
|
|
15
|
+
/** Product display name */
|
|
10
16
|
name: {
|
|
11
17
|
type: String,
|
|
12
18
|
trim: true,
|
|
13
19
|
},
|
|
14
20
|
|
|
21
|
+
/** Primary SKU identifier */
|
|
15
22
|
sku_id: {
|
|
16
23
|
type: String,
|
|
17
24
|
trim: true,
|
|
18
25
|
index: true,
|
|
19
26
|
},
|
|
20
27
|
|
|
28
|
+
/** Seller's own SKU code */
|
|
21
29
|
seller_sku: {
|
|
22
30
|
type: String,
|
|
23
31
|
trim: true,
|
|
24
32
|
index: true,
|
|
25
33
|
},
|
|
26
34
|
|
|
35
|
+
/** SKU code used by the fulfillment provider */
|
|
27
36
|
fulfillment_sku: {
|
|
28
37
|
type: String,
|
|
29
38
|
trim: true,
|
|
30
39
|
},
|
|
31
40
|
|
|
41
|
+
/** URL to the customization/personalization tool */
|
|
32
42
|
customize_url: {
|
|
33
43
|
type: String,
|
|
34
44
|
trim: true,
|
|
35
45
|
},
|
|
36
46
|
|
|
47
|
+
/** SKU code in the customization system */
|
|
37
48
|
customize_sku: {
|
|
38
49
|
type: String,
|
|
39
50
|
trim: true,
|
|
40
51
|
},
|
|
41
52
|
|
|
53
|
+
/** Reference to the Media record for the product mockup image */
|
|
54
|
+
mockup: {
|
|
55
|
+
type: Schema.Types.ObjectId,
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/** Reference to the Media record for the print-ready design file */
|
|
59
|
+
design: {
|
|
60
|
+
type: Schema.Types.ObjectId,
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
/** Product status (default 'active') */
|
|
42
64
|
status: {
|
|
43
65
|
type: String,
|
|
44
66
|
trim: true,
|
|
@@ -46,11 +68,13 @@ const Product = new Schema({
|
|
|
46
68
|
index: true
|
|
47
69
|
},
|
|
48
70
|
|
|
71
|
+
/** Last modification timestamp */
|
|
49
72
|
updated_at: {
|
|
50
73
|
type: Date,
|
|
51
74
|
default: Date.now
|
|
52
75
|
},
|
|
53
76
|
|
|
77
|
+
/** Creation timestamp */
|
|
54
78
|
created_at: {
|
|
55
79
|
type: Date,
|
|
56
80
|
default: Date.now,
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* ShippingCarrier — Shipping carrier master data.
|
|
6
|
+
*/
|
|
4
7
|
const ShippingCarrier = new Schema({
|
|
8
|
+
/** Display name of the carrier */
|
|
5
9
|
name: {
|
|
6
10
|
type: String,
|
|
7
11
|
trim: true,
|
|
8
12
|
required: true,
|
|
9
13
|
},
|
|
10
14
|
|
|
15
|
+
/** Unique carrier code */
|
|
11
16
|
code: {
|
|
12
17
|
type: String,
|
|
13
18
|
trim: true,
|
|
@@ -15,6 +20,7 @@ const ShippingCarrier = new Schema({
|
|
|
15
20
|
index: true,
|
|
16
21
|
},
|
|
17
22
|
|
|
23
|
+
/** Carrier status: 'active' | 'inactive' */
|
|
18
24
|
status: {
|
|
19
25
|
type: String,
|
|
20
26
|
enum: ['active', 'inactive'],
|
|
@@ -22,11 +28,13 @@ const ShippingCarrier = new Schema({
|
|
|
22
28
|
index: true,
|
|
23
29
|
},
|
|
24
30
|
|
|
31
|
+
/** Last modification timestamp */
|
|
25
32
|
updated_at: {
|
|
26
33
|
type: Date,
|
|
27
34
|
default: Date.now
|
|
28
35
|
},
|
|
29
36
|
|
|
37
|
+
/** Creation timestamp */
|
|
30
38
|
created_at: {
|
|
31
39
|
type: Date,
|
|
32
40
|
default: Date.now,
|
package/schemas/Shop.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Shop — Store/shop configuration.
|
|
6
|
+
* Represents a sales channel connected to the system.
|
|
7
|
+
*/
|
|
4
8
|
const Shop = new Schema({
|
|
9
|
+
/** Display name of the shop */
|
|
5
10
|
name: {
|
|
6
11
|
type: String,
|
|
7
12
|
trim: true,
|
|
8
13
|
},
|
|
9
14
|
|
|
15
|
+
/** Platform type (default 'tiktok') */
|
|
10
16
|
type: {
|
|
11
17
|
type: String,
|
|
12
18
|
trim: true,
|
|
@@ -14,12 +20,14 @@ const Shop = new Schema({
|
|
|
14
20
|
index: true,
|
|
15
21
|
},
|
|
16
22
|
|
|
23
|
+
/** External shop/store ID on the platform */
|
|
17
24
|
shop_id: {
|
|
18
25
|
type: String,
|
|
19
26
|
trim: true,
|
|
20
27
|
index: true,
|
|
21
28
|
},
|
|
22
29
|
|
|
30
|
+
/** Shop status (default 'active') */
|
|
23
31
|
status: {
|
|
24
32
|
type: String,
|
|
25
33
|
trim: true,
|
|
@@ -27,30 +35,36 @@ const Shop = new Schema({
|
|
|
27
35
|
index: true,
|
|
28
36
|
},
|
|
29
37
|
|
|
38
|
+
/** Default FulfillmentStore assigned to this shop */
|
|
30
39
|
fulfillment_store: {
|
|
31
40
|
type: Schema.Types.ObjectId,
|
|
32
41
|
},
|
|
33
42
|
|
|
43
|
+
/** Mapped shop ID in the Nhanh.vn system */
|
|
34
44
|
nhanh_id: {
|
|
35
45
|
type: String,
|
|
36
46
|
trim: true,
|
|
37
47
|
index: true,
|
|
38
48
|
},
|
|
39
49
|
|
|
50
|
+
/** UI display color for the shop */
|
|
40
51
|
color: {
|
|
41
52
|
type: String,
|
|
42
53
|
trim: true,
|
|
43
54
|
},
|
|
44
55
|
|
|
56
|
+
/** Default ShippingCarrier for this shop */
|
|
45
57
|
default_carrier: {
|
|
46
58
|
type: Schema.Types.ObjectId,
|
|
47
59
|
},
|
|
48
60
|
|
|
61
|
+
/** Last modification timestamp */
|
|
49
62
|
updated_at: {
|
|
50
63
|
type: Date,
|
|
51
64
|
default: Date.now
|
|
52
65
|
},
|
|
53
66
|
|
|
67
|
+
/** Creation timestamp */
|
|
54
68
|
created_at: {
|
|
55
69
|
type: Date,
|
|
56
70
|
default: Date.now,
|
|
@@ -60,4 +74,3 @@ const Shop = new Schema({
|
|
|
60
74
|
|
|
61
75
|
|
|
62
76
|
module.exports = Shop
|
|
63
|
-
|
package/schemas/ShopSetting.js
CHANGED
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* ShopSetting — Key-value settings per shop.
|
|
6
|
+
* Stores dynamic configuration for a specific shop.
|
|
7
|
+
*/
|
|
4
8
|
const ShopSetting = new Schema({
|
|
9
|
+
/** Reference to the Shop */
|
|
5
10
|
shop: {
|
|
6
11
|
type: Schema.Types.ObjectId,
|
|
7
12
|
required: true,
|
|
8
13
|
index: true,
|
|
9
14
|
},
|
|
10
15
|
|
|
16
|
+
/** Setting key name */
|
|
11
17
|
key: {
|
|
12
18
|
type: String,
|
|
13
19
|
trim: true,
|
|
14
20
|
index: true,
|
|
15
21
|
},
|
|
16
22
|
|
|
23
|
+
/** Setting value (any type) */
|
|
17
24
|
value: {
|
|
18
25
|
type: Schema.Types.Mixed,
|
|
19
26
|
},
|
|
20
27
|
|
|
28
|
+
/** Last modification timestamp */
|
|
21
29
|
updated_at: {
|
|
22
30
|
type: Date,
|
|
23
31
|
default: Date.now
|
|
24
32
|
},
|
|
25
33
|
|
|
34
|
+
/** Creation timestamp */
|
|
26
35
|
created_at: {
|
|
27
36
|
type: Date,
|
|
28
37
|
default: Date.now,
|
|
@@ -32,4 +41,3 @@ const ShopSetting = new Schema({
|
|
|
32
41
|
|
|
33
42
|
|
|
34
43
|
module.exports = ShopSetting
|
|
35
|
-
|
package/schemas/SourceItem.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* SourceItem — Raw line item data from the source platform.
|
|
6
|
+
* Includes customization/personalization details for print-on-demand products.
|
|
7
|
+
*/
|
|
4
8
|
const SourceItem = new Schema({
|
|
9
|
+
/** Reference to the parent SourceOrder */
|
|
5
10
|
order: {
|
|
6
11
|
type: Schema.Types.ObjectId,
|
|
7
12
|
required: true,
|
|
8
13
|
index: true,
|
|
9
14
|
},
|
|
10
15
|
|
|
16
|
+
/** Line item ID on the source platform */
|
|
11
17
|
id: {
|
|
12
18
|
type: String,
|
|
13
19
|
trim: true,
|
|
@@ -15,61 +21,73 @@ const SourceItem = new Schema({
|
|
|
15
21
|
required: true,
|
|
16
22
|
},
|
|
17
23
|
|
|
24
|
+
/** Product name from the source platform */
|
|
18
25
|
product_name: {
|
|
19
26
|
type: String,
|
|
20
27
|
trim: true,
|
|
21
28
|
},
|
|
22
29
|
|
|
30
|
+
/** Variant name from the source platform */
|
|
23
31
|
variant_name: {
|
|
24
32
|
type: String,
|
|
25
33
|
trim: true,
|
|
26
34
|
},
|
|
27
35
|
|
|
36
|
+
/** SKU from the source platform */
|
|
28
37
|
sku: {
|
|
29
38
|
type: String,
|
|
30
39
|
trim: true,
|
|
31
40
|
},
|
|
32
41
|
|
|
42
|
+
/** Quantity ordered */
|
|
33
43
|
quantity: {
|
|
34
44
|
type: Number,
|
|
35
45
|
default: 1,
|
|
36
46
|
},
|
|
37
47
|
|
|
48
|
+
/** Raw line item properties/attributes from the platform */
|
|
38
49
|
properties: {
|
|
39
50
|
type: [Schema.Types.Mixed],
|
|
40
51
|
default: []
|
|
41
52
|
},
|
|
42
53
|
|
|
54
|
+
/** Parsed customization properties */
|
|
43
55
|
customize_properties: {
|
|
44
56
|
type: Schema.Types.Mixed,
|
|
45
57
|
default: {}
|
|
46
58
|
},
|
|
47
59
|
|
|
60
|
+
/** Customization job ID extracted from properties */
|
|
48
61
|
customize_id: {
|
|
49
62
|
type: String,
|
|
50
63
|
trim: true,
|
|
51
64
|
},
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
/** Reference to the linked OrderItem for design processing */
|
|
67
|
+
customize_item: {
|
|
54
68
|
type: Schema.Types.ObjectId,
|
|
55
69
|
index: true,
|
|
56
70
|
},
|
|
57
71
|
|
|
72
|
+
/** URL to the mockup image from the customization system */
|
|
58
73
|
mockup_url: {
|
|
59
74
|
type: String,
|
|
60
75
|
trim: true,
|
|
61
76
|
},
|
|
62
77
|
|
|
78
|
+
/** URL to the print-ready design file from the customization system */
|
|
63
79
|
design_url: {
|
|
64
80
|
type: String,
|
|
65
81
|
trim: true,
|
|
66
82
|
},
|
|
67
83
|
|
|
84
|
+
/** Last modification timestamp */
|
|
68
85
|
updated_at: {
|
|
69
86
|
type: Date,
|
|
70
87
|
default: Date.now
|
|
71
88
|
},
|
|
72
89
|
|
|
90
|
+
/** Creation timestamp */
|
|
73
91
|
created_at: {
|
|
74
92
|
type: Date,
|
|
75
93
|
default: Date.now,
|