@pintahub/database-schemas 4.4.8 → 4.6.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/settings.local.json +8 -0
- package/CLAUDE.md +16 -66
- package/package.json +1 -1
- package/schemas/Account.js +11 -1
- package/schemas/AnnouncementBar.js +12 -1
- package/schemas/Artwork.js +12 -1
- package/schemas/BlockedLocation.js +6 -0
- package/schemas/Collection.js +24 -0
- package/schemas/CreatorReport.js +33 -0
- package/schemas/CustomField.js +9 -0
- package/schemas/Customize.js +13 -0
- package/schemas/DimensionObject.js +3 -0
- package/schemas/ExportJob.js +19 -1
- package/schemas/FavoriteItem.js +8 -1
- package/schemas/FieldSetting.js +3 -0
- package/schemas/Fulfillment.js +13 -1
- package/schemas/Group.js +21 -1
- package/schemas/GroupArtwork.js +7 -1
- package/schemas/GroupItem.js +9 -1
- package/schemas/Image.js +8 -0
- package/schemas/ImageObject.js +6 -0
- package/schemas/LatestEvent.js +14 -0
- package/schemas/LogURL.js +7 -0
- package/schemas/MarketingCost.js +13 -0
- package/schemas/Media.js +11 -0
- package/schemas/MediaUpload.js +16 -1
- package/schemas/Menu.js +9 -0
- package/schemas/MenuItem.js +14 -0
- package/schemas/MoneyObject.js +3 -0
- package/schemas/Order.js +38 -1
- package/schemas/OrderItem.js +17 -1
- package/schemas/Payout.js +10 -1
- package/schemas/Post.js +19 -1
- package/schemas/PriceRange.js +6 -0
- package/schemas/Product.js +67 -5
- package/schemas/ProductFeature.js +26 -0
- package/schemas/ProductImage.js +15 -0
- package/schemas/ProductImport.js +26 -0
- package/schemas/ProductRaw.js +22 -0
- package/schemas/ProductReport.js +104 -0
- package/schemas/ProductTag.js +8 -1
- package/schemas/ProductType.js +9 -1
- package/schemas/Publication.js +7 -0
- package/schemas/RecentView.js +5 -1
- package/schemas/Review.js +18 -1
- package/schemas/SearchTerm.js +4 -0
- package/schemas/Shop.js +10 -0
- package/schemas/ShopifyAPI.js +11 -1
- package/schemas/ShopifyObject.js +14 -1
- package/schemas/ShortDomain.js +10 -1
- package/schemas/ShortLog.js +10 -0
- package/schemas/ShortUrl.js +14 -0
- package/schemas/Store.js +19 -1
- package/schemas/StoreEvent.js +13 -1
- package/schemas/StoreSetting.js +25 -1
- package/schemas/TrackPage.js +9 -1
- package/schemas/TransferJob.js +22 -0
- package/schemas/User.js +6 -0
- package/schemas/WebhookEvent.js +7 -1
- package/schemas/products/MediaObject.js +8 -0
- package/schemas/products/SeoObject.js +3 -0
- package/schemas/products/VideoObject.js +6 -0
- package/schemas/types/BrandSettings.js +3 -0
- package/schemas/types/DMCASetting.js +3 -0
- package/schemas/types/FacebookObject.js +3 -0
- package/schemas/types/FooterSetting.js +2 -0
- package/schemas/types/FreeShippingSetting.js +3 -0
- package/schemas/types/GoogleAnalytics.js +2 -0
- package/schemas/types/KlaviyoObject.js +9 -0
- package/schemas/types/MerchizeSettings.js +3 -0
- package/schemas/types/SocialsObject.js +8 -0
- package/schemas/types/TopBarSettings.js +2 -0
- package/schemas/types/TrustpilotObject.js +4 -0
package/schemas/ProductImport.js
CHANGED
|
@@ -1,58 +1,70 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/** Embedded parsed product data from import */
|
|
4
5
|
const Output = new Schema({
|
|
5
6
|
_id: false,
|
|
6
7
|
|
|
8
|
+
/** Display title */
|
|
7
9
|
title: {
|
|
8
10
|
type: String,
|
|
9
11
|
trim: true,
|
|
10
12
|
},
|
|
11
13
|
|
|
14
|
+
/** Product type */
|
|
12
15
|
product_type: {
|
|
13
16
|
type: String,
|
|
14
17
|
trim: true,
|
|
15
18
|
},
|
|
16
19
|
|
|
20
|
+
/** Tags */
|
|
17
21
|
tags: {
|
|
18
22
|
type: [String],
|
|
19
23
|
default: [],
|
|
20
24
|
},
|
|
21
25
|
|
|
26
|
+
/** Product vendor */
|
|
22
27
|
vendor: {
|
|
23
28
|
type: String,
|
|
24
29
|
trim: true,
|
|
25
30
|
},
|
|
26
31
|
|
|
32
|
+
/** Product options (e.g. size, color) */
|
|
27
33
|
options: {
|
|
28
34
|
type: [Schema.Types.Mixed],
|
|
29
35
|
default: [],
|
|
30
36
|
},
|
|
31
37
|
|
|
38
|
+
/** Product variants */
|
|
32
39
|
variants: {
|
|
33
40
|
type: [Schema.Types.Mixed],
|
|
34
41
|
default: [],
|
|
35
42
|
},
|
|
36
43
|
|
|
44
|
+
/** Product images */
|
|
37
45
|
images: {
|
|
38
46
|
type: [Schema.Types.Mixed],
|
|
39
47
|
default: [],
|
|
40
48
|
},
|
|
41
49
|
})
|
|
42
50
|
|
|
51
|
+
/** Product import job from external URL */
|
|
43
52
|
const ProductImport = new Schema({
|
|
53
|
+
/** @ref Store */
|
|
44
54
|
store: {
|
|
45
55
|
type: Schema.Types.ObjectId,
|
|
46
56
|
index: true,
|
|
47
57
|
required: true,
|
|
48
58
|
},
|
|
49
59
|
|
|
60
|
+
/** Source URL to import from */
|
|
50
61
|
url: {
|
|
51
62
|
type: String,
|
|
52
63
|
trim: true,
|
|
53
64
|
required: true,
|
|
54
65
|
},
|
|
55
66
|
|
|
67
|
+
/** Import status, e.g. 'pending', 'completed', 'failed' */
|
|
56
68
|
status: {
|
|
57
69
|
type: String,
|
|
58
70
|
trim: true,
|
|
@@ -60,51 +72,65 @@ const ProductImport = new Schema({
|
|
|
60
72
|
index: true,
|
|
61
73
|
},
|
|
62
74
|
|
|
75
|
+
/** Source platform, e.g. 'aliexpress', 'amazon' */
|
|
63
76
|
platform: {
|
|
64
77
|
type: String,
|
|
65
78
|
trim: true,
|
|
66
79
|
default: '',
|
|
67
80
|
},
|
|
68
81
|
|
|
82
|
+
/** Auto-detect source platform */
|
|
69
83
|
auto_detect: {
|
|
70
84
|
type: Boolean,
|
|
71
85
|
default: false,
|
|
72
86
|
},
|
|
73
87
|
|
|
88
|
+
/** @ref Product — products created from this import */
|
|
74
89
|
products: {
|
|
75
90
|
type: [Schema.Types.ObjectId],
|
|
76
91
|
default: [],
|
|
77
92
|
},
|
|
78
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Imported product visibility:
|
|
96
|
+
* - sensitive: hidden by default
|
|
97
|
+
* - visible: shown on storefront
|
|
98
|
+
*/
|
|
79
99
|
visibility: {
|
|
80
100
|
type: String,
|
|
81
101
|
default: 'sensitive',
|
|
82
102
|
enum: ['sensitive', 'visible']
|
|
83
103
|
},
|
|
84
104
|
|
|
105
|
+
/** Raw scraped data from source */
|
|
85
106
|
raw_data: {
|
|
86
107
|
type: Schema.Types.Mixed,
|
|
87
108
|
},
|
|
88
109
|
|
|
110
|
+
/** Parsed product data */
|
|
89
111
|
output: {
|
|
90
112
|
type: Output,
|
|
91
113
|
},
|
|
92
114
|
|
|
115
|
+
/** Error message if failed */
|
|
93
116
|
error_message: {
|
|
94
117
|
type: String,
|
|
95
118
|
trim: true,
|
|
96
119
|
},
|
|
97
120
|
|
|
121
|
+
/** When processing completed */
|
|
98
122
|
processed_at: {
|
|
99
123
|
type: Date,
|
|
100
124
|
default: Date.now,
|
|
101
125
|
},
|
|
102
126
|
|
|
127
|
+
/** Last update timestamp */
|
|
103
128
|
updated_at: {
|
|
104
129
|
type: Date,
|
|
105
130
|
default: Date.now,
|
|
106
131
|
},
|
|
107
132
|
|
|
133
|
+
/** Record creation timestamp */
|
|
108
134
|
created_at: {
|
|
109
135
|
type: Date,
|
|
110
136
|
default: Date.now,
|
package/schemas/ProductRaw.js
CHANGED
|
@@ -3,110 +3,132 @@ const MediaObject = require('./products/MediaObject')
|
|
|
3
3
|
const SeoObject = require('./products/SeoObject')
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
/** Raw synced product data from source platform (Shopify, etc.) */
|
|
6
7
|
const ProductRaw = new Schema({
|
|
8
|
+
/** @ref Store */
|
|
7
9
|
store: {
|
|
8
10
|
type: Schema.Types.ObjectId,
|
|
9
11
|
index: true,
|
|
10
12
|
required: true,
|
|
11
13
|
},
|
|
12
14
|
|
|
15
|
+
/** @ref Product */
|
|
13
16
|
product: {
|
|
14
17
|
type: Schema.Types.ObjectId,
|
|
15
18
|
required: true,
|
|
16
19
|
index: true,
|
|
17
20
|
},
|
|
18
21
|
|
|
22
|
+
/** Shopify product ID */
|
|
19
23
|
id: {
|
|
20
24
|
type: String,
|
|
21
25
|
trim: true,
|
|
22
26
|
index: true,
|
|
23
27
|
},
|
|
24
28
|
|
|
29
|
+
/** URL-friendly slug */
|
|
25
30
|
handle: {
|
|
26
31
|
type: String,
|
|
27
32
|
trim: true,
|
|
28
33
|
index: true,
|
|
29
34
|
},
|
|
30
35
|
|
|
36
|
+
/** Raw image data from source */
|
|
31
37
|
images: {
|
|
32
38
|
type: Array,
|
|
33
39
|
default: [],
|
|
34
40
|
},
|
|
35
41
|
|
|
42
|
+
/** Raw product options from source */
|
|
36
43
|
options: {
|
|
37
44
|
type: Array,
|
|
38
45
|
default: [],
|
|
39
46
|
},
|
|
40
47
|
|
|
48
|
+
/** Raw variant data from source */
|
|
41
49
|
variants: {
|
|
42
50
|
type: Array,
|
|
43
51
|
default: [],
|
|
44
52
|
},
|
|
45
53
|
|
|
54
|
+
/** Product media (images, videos) */
|
|
46
55
|
media: {
|
|
47
56
|
type: [MediaObject],
|
|
48
57
|
default: [],
|
|
49
58
|
},
|
|
50
59
|
|
|
60
|
+
/** Index of the default variant */
|
|
51
61
|
default_variant_index: {
|
|
52
62
|
type: Number,
|
|
53
63
|
default: 0,
|
|
54
64
|
},
|
|
55
65
|
|
|
66
|
+
/** @ref Collection — collections from source */
|
|
56
67
|
collections: {
|
|
57
68
|
type: [Schema.Types.ObjectId],
|
|
58
69
|
default: [],
|
|
59
70
|
},
|
|
60
71
|
|
|
72
|
+
/** Featured image */
|
|
61
73
|
featured_image: {
|
|
62
74
|
type: Schema.Types.Mixed,
|
|
63
75
|
default: {},
|
|
64
76
|
},
|
|
65
77
|
|
|
78
|
+
/** Product description in HTML from source */
|
|
66
79
|
description_html: {
|
|
67
80
|
type: String,
|
|
68
81
|
trim: true
|
|
69
82
|
},
|
|
70
83
|
|
|
84
|
+
/** Description */
|
|
71
85
|
description: {
|
|
72
86
|
type: String,
|
|
73
87
|
trim: true
|
|
74
88
|
},
|
|
75
89
|
|
|
90
|
+
/** Shopify online store URL */
|
|
76
91
|
onlineStore_url: {
|
|
77
92
|
type: String,
|
|
78
93
|
trim: true,
|
|
79
94
|
},
|
|
80
95
|
|
|
96
|
+
/** Product vendor */
|
|
81
97
|
vendor: {
|
|
82
98
|
type: String,
|
|
83
99
|
trim: true,
|
|
84
100
|
},
|
|
85
101
|
|
|
102
|
+
/** Product features HTML from source */
|
|
86
103
|
features_html: {
|
|
87
104
|
type: String,
|
|
88
105
|
trim: true,
|
|
89
106
|
},
|
|
90
107
|
|
|
108
|
+
/** Last sync timestamp */
|
|
91
109
|
synced_at: {
|
|
92
110
|
type: Date,
|
|
93
111
|
},
|
|
94
112
|
|
|
113
|
+
/** SEO metadata */
|
|
95
114
|
seo: {
|
|
96
115
|
type: SeoObject,
|
|
97
116
|
default: {},
|
|
98
117
|
},
|
|
99
118
|
|
|
119
|
+
/** Tags */
|
|
100
120
|
tags: {
|
|
101
121
|
type: [String],
|
|
102
122
|
trim: true,
|
|
103
123
|
},
|
|
104
124
|
|
|
125
|
+
/** Last update timestamp */
|
|
105
126
|
updated_at: {
|
|
106
127
|
type: Date,
|
|
107
128
|
default: Date.now,
|
|
108
129
|
},
|
|
109
130
|
|
|
131
|
+
/** Record creation timestamp */
|
|
110
132
|
created_at: {
|
|
111
133
|
type: Date,
|
|
112
134
|
default: Date.now,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const {Schema} = require('mongoose')
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Product violation reports submitted by customers or third parties
|
|
6
|
+
* (brand owners, lawyers) when a product has trademark, copyright,
|
|
7
|
+
* counterfeit, or other policy issues.
|
|
8
|
+
*/
|
|
9
|
+
const ProductReport = new Schema({
|
|
10
|
+
/** @ref Store */
|
|
11
|
+
store: {
|
|
12
|
+
type: Schema.Types.ObjectId,
|
|
13
|
+
index: true,
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
/** @ref Product — the reported product */
|
|
18
|
+
product: {
|
|
19
|
+
type: Schema.Types.ObjectId,
|
|
20
|
+
index: true,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Violation type:
|
|
26
|
+
* - trademark: brand name, logo, slogan infringement
|
|
27
|
+
* - copyright: images, designs, content infringement
|
|
28
|
+
* - counterfeit: fake or knock-off products
|
|
29
|
+
* - other: other policy violations
|
|
30
|
+
*/
|
|
31
|
+
type: {
|
|
32
|
+
type: String,
|
|
33
|
+
trim: true,
|
|
34
|
+
required: true,
|
|
35
|
+
index: true,
|
|
36
|
+
enum: ['trademark', 'copyright', 'counterfeit', 'other'],
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Report status:
|
|
41
|
+
* - pending: awaiting review
|
|
42
|
+
* - resolved: action taken (product removed/modified)
|
|
43
|
+
* - dismissed: report rejected as invalid
|
|
44
|
+
*/
|
|
45
|
+
status: {
|
|
46
|
+
type: String,
|
|
47
|
+
trim: true,
|
|
48
|
+
default: 'pending',
|
|
49
|
+
index: true,
|
|
50
|
+
enum: ['pending', 'resolved', 'dismissed'],
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/** Detailed description of the violation */
|
|
54
|
+
description: {
|
|
55
|
+
type: String,
|
|
56
|
+
trim: true,
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
/** Name of the person submitting the report */
|
|
60
|
+
reporter_name: {
|
|
61
|
+
type: String,
|
|
62
|
+
trim: true,
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/** Contact email of the reporter */
|
|
66
|
+
reporter_email: {
|
|
67
|
+
type: String,
|
|
68
|
+
trim: true,
|
|
69
|
+
index: true,
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/** Company/organization of the reporter (e.g. brand owner, law firm) */
|
|
73
|
+
reporter_company: {
|
|
74
|
+
type: String,
|
|
75
|
+
trim: true,
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/** Admin notes on how the report was resolved */
|
|
79
|
+
resolution_note: {
|
|
80
|
+
type: String,
|
|
81
|
+
trim: true,
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/** When the report was resolved or dismissed */
|
|
85
|
+
resolved_at: {
|
|
86
|
+
type: Date,
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
/** Last update timestamp */
|
|
90
|
+
updated_at: {
|
|
91
|
+
type: Date,
|
|
92
|
+
default: Date.now,
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
/** Record creation timestamp */
|
|
96
|
+
created_at: {
|
|
97
|
+
type: Date,
|
|
98
|
+
default: Date.now,
|
|
99
|
+
index: true,
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
module.exports = ProductReport
|
package/schemas/ProductTag.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/** Product tag with aggregated counts */
|
|
4
5
|
const ProductTag = new Schema({
|
|
6
|
+
/** @ref Store */
|
|
5
7
|
store: {
|
|
6
8
|
type: Schema.Types.ObjectId,
|
|
7
9
|
index: true,
|
|
8
10
|
required: true,
|
|
9
11
|
},
|
|
10
12
|
|
|
13
|
+
/** Tag display text */
|
|
11
14
|
value: {
|
|
12
15
|
type: String,
|
|
13
16
|
trim: true,
|
|
@@ -15,6 +18,7 @@ const ProductTag = new Schema({
|
|
|
15
18
|
index: true,
|
|
16
19
|
},
|
|
17
20
|
|
|
21
|
+
/** Normalized uppercase tag code */
|
|
18
22
|
code: {
|
|
19
23
|
type: String,
|
|
20
24
|
trim: true,
|
|
@@ -23,23 +27,27 @@ const ProductTag = new Schema({
|
|
|
23
27
|
uppercase: true,
|
|
24
28
|
},
|
|
25
29
|
|
|
30
|
+
/** Number of products with this tag */
|
|
26
31
|
products_count: {
|
|
27
32
|
type: Number,
|
|
28
33
|
default: 0,
|
|
29
34
|
index: true,
|
|
30
35
|
},
|
|
31
36
|
|
|
37
|
+
/** Total sales from products with this tag */
|
|
32
38
|
sales_count: {
|
|
33
39
|
type: Number,
|
|
34
40
|
default: 0,
|
|
35
41
|
index: true
|
|
36
42
|
},
|
|
37
43
|
|
|
44
|
+
/** Last update timestamp */
|
|
38
45
|
updated_at: {
|
|
39
46
|
type: Date,
|
|
40
47
|
default: Date.now
|
|
41
48
|
},
|
|
42
49
|
|
|
50
|
+
/** Record creation timestamp */
|
|
43
51
|
created_at: {
|
|
44
52
|
type: Date,
|
|
45
53
|
default: Date.now
|
|
@@ -47,4 +55,3 @@ const ProductTag = new Schema({
|
|
|
47
55
|
})
|
|
48
56
|
|
|
49
57
|
module.exports = ProductTag
|
|
50
|
-
|
package/schemas/ProductType.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/** Product type classification */
|
|
4
5
|
const ProductType = new Schema({
|
|
6
|
+
/** @ref Store */
|
|
5
7
|
store: {
|
|
6
8
|
type: Schema.Types.ObjectId,
|
|
7
9
|
index: true,
|
|
8
10
|
required: true,
|
|
9
11
|
},
|
|
10
12
|
|
|
13
|
+
/** Display name */
|
|
11
14
|
name: {
|
|
12
15
|
type: String,
|
|
13
16
|
trim: true,
|
|
@@ -15,33 +18,39 @@ const ProductType = new Schema({
|
|
|
15
18
|
index: true,
|
|
16
19
|
},
|
|
17
20
|
|
|
21
|
+
/** Number of products */
|
|
18
22
|
products_count: {
|
|
19
23
|
type: Number,
|
|
20
24
|
default: 0,
|
|
21
25
|
index: true,
|
|
22
26
|
},
|
|
23
27
|
|
|
28
|
+
/** Allow creating new products of this type */
|
|
24
29
|
enable_create_product: {
|
|
25
30
|
type: Boolean,
|
|
26
31
|
default: false,
|
|
27
32
|
index: true,
|
|
28
33
|
},
|
|
29
34
|
|
|
35
|
+
/** @ref Product — template product for this type */
|
|
30
36
|
base_product: {
|
|
31
37
|
type: Schema.Types.ObjectId,
|
|
32
38
|
},
|
|
33
39
|
|
|
40
|
+
/** Sort order (lower = higher priority) */
|
|
34
41
|
position: {
|
|
35
42
|
type: Number,
|
|
36
43
|
default: 999,
|
|
37
44
|
index: true,
|
|
38
45
|
},
|
|
39
46
|
|
|
47
|
+
/** Last update timestamp */
|
|
40
48
|
updated_at: {
|
|
41
49
|
type: Date,
|
|
42
50
|
default: Date.now
|
|
43
51
|
},
|
|
44
52
|
|
|
53
|
+
/** Record creation timestamp */
|
|
45
54
|
created_at: {
|
|
46
55
|
type: Date,
|
|
47
56
|
default: Date.now
|
|
@@ -49,4 +58,3 @@ const ProductType = new Schema({
|
|
|
49
58
|
})
|
|
50
59
|
|
|
51
60
|
module.exports = ProductType
|
|
52
|
-
|
package/schemas/Publication.js
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/** Product publication channel (e.g. online store, POS) */
|
|
4
5
|
const Publication = new Schema({
|
|
6
|
+
/** @ref Store */
|
|
5
7
|
store: {
|
|
6
8
|
type: Schema.Types.ObjectId,
|
|
7
9
|
index: true,
|
|
8
10
|
required: true,
|
|
9
11
|
},
|
|
10
12
|
|
|
13
|
+
/** Shopify publication ID */
|
|
11
14
|
id: {
|
|
12
15
|
type: String,
|
|
13
16
|
trim: true,
|
|
14
17
|
index: true,
|
|
15
18
|
},
|
|
16
19
|
|
|
20
|
+
/** Display name */
|
|
17
21
|
name: {
|
|
18
22
|
type: String,
|
|
19
23
|
trim: true,
|
|
20
24
|
required: true,
|
|
21
25
|
},
|
|
22
26
|
|
|
27
|
+
/** Channel status, e.g. 'active', 'inactive' */
|
|
23
28
|
status: {
|
|
24
29
|
type: String,
|
|
25
30
|
trim: true,
|
|
@@ -28,11 +33,13 @@ const Publication = new Schema({
|
|
|
28
33
|
default: 'active',
|
|
29
34
|
},
|
|
30
35
|
|
|
36
|
+
/** Last update timestamp */
|
|
31
37
|
updated_at: {
|
|
32
38
|
type: Date,
|
|
33
39
|
default: Date.now
|
|
34
40
|
},
|
|
35
41
|
|
|
42
|
+
/** Record creation timestamp */
|
|
36
43
|
created_at: {
|
|
37
44
|
type: Date,
|
|
38
45
|
default: Date.now
|
package/schemas/RecentView.js
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/** Recently viewed products — TTL: 90 days */
|
|
4
5
|
const RecentView = new Schema({
|
|
6
|
+
/** @ref Store */
|
|
5
7
|
store: {
|
|
6
8
|
type: Schema.Types.ObjectId,
|
|
7
9
|
index: true,
|
|
8
10
|
required: true,
|
|
9
11
|
},
|
|
10
12
|
|
|
13
|
+
/** Visitor session identifier */
|
|
11
14
|
session_id: {
|
|
12
15
|
type: String,
|
|
13
16
|
trim: true,
|
|
14
17
|
index: true,
|
|
15
18
|
},
|
|
16
19
|
|
|
20
|
+
/** @ref Product */
|
|
17
21
|
product: {
|
|
18
22
|
type: Schema.Types.ObjectId,
|
|
19
23
|
required: true,
|
|
20
24
|
},
|
|
21
25
|
|
|
26
|
+
/** TTL: auto-expires after 90 days */
|
|
22
27
|
created_at: {
|
|
23
28
|
type: Date,
|
|
24
29
|
default: Date.now,
|
|
@@ -29,4 +34,3 @@ const RecentView = new Schema({
|
|
|
29
34
|
|
|
30
35
|
|
|
31
36
|
module.exports = RecentView
|
|
32
|
-
|
package/schemas/Review.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/** Product review from a customer */
|
|
4
5
|
const Review = new Schema({
|
|
6
|
+
/** @ref Store */
|
|
5
7
|
store: {
|
|
6
8
|
type: Schema.Types.ObjectId,
|
|
7
9
|
index: true,
|
|
8
10
|
required: true,
|
|
9
11
|
},
|
|
10
12
|
|
|
13
|
+
/** Product type */
|
|
11
14
|
product_type: {
|
|
12
15
|
type: String,
|
|
13
16
|
trim: true,
|
|
14
17
|
index: true
|
|
15
18
|
},
|
|
16
19
|
|
|
20
|
+
/** Review moderation status, e.g. 'pending', 'approved', 'rejected' */
|
|
17
21
|
status: {
|
|
18
22
|
type: String,
|
|
19
23
|
trim: true,
|
|
@@ -21,77 +25,91 @@ const Review = new Schema({
|
|
|
21
25
|
default: 'pending',
|
|
22
26
|
},
|
|
23
27
|
|
|
28
|
+
/** Reviewer name */
|
|
24
29
|
name: {
|
|
25
30
|
type: String,
|
|
26
31
|
trim: true,
|
|
27
32
|
required: true,
|
|
28
33
|
},
|
|
29
34
|
|
|
35
|
+
/** Reviewer email */
|
|
30
36
|
email: {
|
|
31
37
|
type: String,
|
|
32
38
|
trim: true,
|
|
33
39
|
},
|
|
34
40
|
|
|
41
|
+
/** Rating value 1-5 */
|
|
35
42
|
vote_value: {
|
|
36
43
|
type: Number,
|
|
37
44
|
default: 5,
|
|
38
45
|
index: true,
|
|
39
46
|
},
|
|
40
47
|
|
|
48
|
+
/** Review text content */
|
|
41
49
|
content: {
|
|
42
50
|
type: String,
|
|
43
51
|
trim: true,
|
|
44
52
|
},
|
|
45
53
|
|
|
54
|
+
/** @ref Image — review photo */
|
|
46
55
|
image: {
|
|
47
56
|
type: Schema.Types.ObjectId,
|
|
48
57
|
index: true
|
|
49
58
|
},
|
|
50
59
|
|
|
60
|
+
/** Whether the reviewer is a verified buyer */
|
|
51
61
|
is_verified: {
|
|
52
62
|
type: Boolean,
|
|
53
63
|
default: true,
|
|
54
64
|
},
|
|
55
65
|
|
|
66
|
+
/** Reviewer country code, e.g. 'US', 'VN' */
|
|
56
67
|
country_code: {
|
|
57
68
|
type: String,
|
|
58
69
|
default: 'US',
|
|
59
70
|
trim: true,
|
|
60
71
|
},
|
|
61
72
|
|
|
73
|
+
/** Highlighted as a featured review */
|
|
62
74
|
is_featured: {
|
|
63
75
|
type: Boolean,
|
|
64
76
|
default: false,
|
|
65
77
|
index: true,
|
|
66
78
|
},
|
|
67
79
|
|
|
80
|
+
/** @ref Product */
|
|
68
81
|
product: {
|
|
69
82
|
type: Schema.Types.ObjectId,
|
|
70
83
|
},
|
|
71
84
|
|
|
85
|
+
/** Import source, e.g. 'aliexpress', 'manual' */
|
|
72
86
|
source: {
|
|
73
87
|
type: String,
|
|
74
88
|
trim: true,
|
|
75
89
|
index: true,
|
|
76
90
|
},
|
|
77
91
|
|
|
92
|
+
/** External review ID from import source */
|
|
78
93
|
external_id: {
|
|
79
94
|
type: String,
|
|
80
95
|
trim: true,
|
|
81
96
|
index: true,
|
|
82
97
|
},
|
|
83
98
|
|
|
99
|
+
/** When the review was submitted */
|
|
84
100
|
submitted_at: {
|
|
85
101
|
type: Date,
|
|
86
102
|
default: Date.now,
|
|
87
103
|
index: true,
|
|
88
104
|
},
|
|
89
105
|
|
|
106
|
+
/** Last update timestamp */
|
|
90
107
|
updated_at: {
|
|
91
108
|
type: Date,
|
|
92
109
|
default: Date.now,
|
|
93
110
|
},
|
|
94
111
|
|
|
112
|
+
/** Record creation timestamp */
|
|
95
113
|
created_at: {
|
|
96
114
|
type: Date,
|
|
97
115
|
default: Date.now,
|
|
@@ -101,4 +119,3 @@ const Review = new Schema({
|
|
|
101
119
|
|
|
102
120
|
|
|
103
121
|
module.exports = Review
|
|
104
|
-
|
package/schemas/SearchTerm.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/** Search term tracking from the storefront */
|
|
4
5
|
const SearchTerm = new Schema({
|
|
6
|
+
/** @ref Store */
|
|
5
7
|
store: {
|
|
6
8
|
type: Schema.Types.ObjectId,
|
|
7
9
|
index: true,
|
|
8
10
|
required: true,
|
|
9
11
|
},
|
|
10
12
|
|
|
13
|
+
/** Search query entered by the visitor */
|
|
11
14
|
term: {
|
|
12
15
|
type: String,
|
|
13
16
|
trim: true,
|
|
14
17
|
required: true,
|
|
15
18
|
},
|
|
16
19
|
|
|
20
|
+
/** Record creation timestamp */
|
|
17
21
|
created_at: {
|
|
18
22
|
type: Date,
|
|
19
23
|
default: Date.now,
|