@pintahub/database-schemas 4.5.0 → 4.6.1
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 +9 -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 +3 -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/Product.js
CHANGED
|
@@ -3,202 +3,241 @@ const ImageObject = require('./ImageObject')
|
|
|
3
3
|
const PriceRange = require('./PriceRange')
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
/** Embedded product import source */
|
|
6
7
|
const ProductSource = new Schema({
|
|
7
8
|
_id: false,
|
|
8
9
|
|
|
10
|
+
/** @ref ProductImport */
|
|
9
11
|
job: {
|
|
10
12
|
type: Schema.Types.ObjectId,
|
|
11
13
|
}
|
|
12
14
|
})
|
|
13
15
|
|
|
16
|
+
/** Embedded product metadata for Google Shopping */
|
|
14
17
|
const ProductMeta = new Schema({
|
|
15
18
|
_id: false,
|
|
16
19
|
|
|
20
|
+
/** Primary product color */
|
|
17
21
|
main_color: {
|
|
18
22
|
type: String,
|
|
19
23
|
trim: true,
|
|
20
24
|
},
|
|
21
25
|
|
|
26
|
+
/** Target age group */
|
|
22
27
|
age_group: {
|
|
23
28
|
type: String,
|
|
24
29
|
trim: true,
|
|
25
30
|
},
|
|
26
31
|
|
|
32
|
+
/** Target gender */
|
|
27
33
|
gender: {
|
|
28
34
|
type: String,
|
|
29
35
|
trim: true,
|
|
30
36
|
},
|
|
31
37
|
})
|
|
32
38
|
|
|
39
|
+
/** Core product */
|
|
33
40
|
const Product = new Schema({
|
|
41
|
+
/** @ref Store */
|
|
34
42
|
store: {
|
|
35
43
|
type: Schema.Types.ObjectId,
|
|
36
44
|
index: true,
|
|
37
45
|
required: true,
|
|
38
46
|
},
|
|
39
47
|
|
|
48
|
+
/** @ref Shop */
|
|
40
49
|
shop: {
|
|
41
50
|
type: Schema.Types.ObjectId,
|
|
42
51
|
index: true,
|
|
43
52
|
},
|
|
44
53
|
|
|
54
|
+
/** Shopify product ID */
|
|
45
55
|
id: {
|
|
46
56
|
type: String,
|
|
47
57
|
trim: true,
|
|
48
58
|
index: true,
|
|
49
59
|
},
|
|
50
60
|
|
|
61
|
+
/** URL-friendly slug */
|
|
51
62
|
handle: {
|
|
52
63
|
type: String,
|
|
53
64
|
trim: true,
|
|
54
65
|
index: true,
|
|
55
66
|
},
|
|
56
67
|
|
|
68
|
+
/** Display title */
|
|
57
69
|
title: {
|
|
58
70
|
type: String,
|
|
59
71
|
trim: true,
|
|
60
72
|
},
|
|
61
73
|
|
|
74
|
+
/** Alternative/secondary title */
|
|
62
75
|
alternative_title: {
|
|
63
76
|
type: String,
|
|
64
77
|
trim: true,
|
|
65
78
|
},
|
|
66
79
|
|
|
80
|
+
/** Product type */
|
|
67
81
|
product_type: {
|
|
68
82
|
type: String,
|
|
69
83
|
trim: true,
|
|
70
84
|
index: true,
|
|
71
85
|
},
|
|
72
86
|
|
|
87
|
+
/** Product category */
|
|
73
88
|
category: {
|
|
74
89
|
type: String,
|
|
75
90
|
trim: true,
|
|
76
91
|
index: true,
|
|
77
92
|
},
|
|
78
93
|
|
|
94
|
+
/** Product status, e.g. 'draft', 'active', 'archived' */
|
|
79
95
|
status: {
|
|
80
96
|
type: String,
|
|
81
97
|
default: 'draft',
|
|
82
98
|
index: true
|
|
83
99
|
},
|
|
84
100
|
|
|
101
|
+
/** Featured image */
|
|
85
102
|
featured_image: {
|
|
86
103
|
type: ImageObject,
|
|
87
104
|
},
|
|
88
105
|
|
|
106
|
+
/** Current selling price range */
|
|
89
107
|
price_range: {
|
|
90
108
|
type: PriceRange,
|
|
91
109
|
default: {},
|
|
92
110
|
},
|
|
93
111
|
|
|
112
|
+
/** Original price range (before discount) */
|
|
94
113
|
compare_at_price_range: {
|
|
95
114
|
type: PriceRange,
|
|
96
115
|
default: {},
|
|
97
116
|
},
|
|
98
117
|
|
|
118
|
+
/** Publish date */
|
|
99
119
|
published_at: {
|
|
100
120
|
type: Date,
|
|
101
121
|
index: true
|
|
102
122
|
},
|
|
103
123
|
|
|
124
|
+
/** Tags */
|
|
104
125
|
tags: {
|
|
105
126
|
type: [String],
|
|
106
127
|
trim: true,
|
|
107
128
|
index: true,
|
|
108
129
|
},
|
|
109
130
|
|
|
131
|
+
/** @ref Collection — collections this product belongs to */
|
|
110
132
|
collections: {
|
|
111
133
|
type: [Schema.Types.ObjectId],
|
|
112
134
|
default: [],
|
|
113
135
|
index: true,
|
|
114
136
|
},
|
|
115
137
|
|
|
138
|
+
/** Publication channel IDs */
|
|
116
139
|
publications: {
|
|
117
140
|
type: [String],
|
|
118
141
|
default: [],
|
|
119
142
|
index: true,
|
|
120
143
|
},
|
|
121
144
|
|
|
145
|
+
/** Number of carts containing this product */
|
|
122
146
|
count_in_carts: {
|
|
123
147
|
type: Number,
|
|
124
148
|
},
|
|
125
149
|
|
|
150
|
+
/** @ref ProductFeature — extended product details */
|
|
126
151
|
product_feature: {
|
|
127
152
|
type: Schema.Types.ObjectId,
|
|
128
153
|
},
|
|
129
154
|
|
|
155
|
+
/** @ref ProductRaw — raw synced data */
|
|
130
156
|
raw: {
|
|
131
157
|
type: Schema.Types.ObjectId,
|
|
132
158
|
},
|
|
133
159
|
|
|
160
|
+
/** Whether this product is on sale */
|
|
134
161
|
is_sale_off: {
|
|
135
162
|
type: Boolean,
|
|
136
163
|
default: false,
|
|
137
164
|
index: true,
|
|
138
165
|
},
|
|
139
166
|
|
|
167
|
+
/** Product vendor */
|
|
140
168
|
vendor: {
|
|
141
169
|
type: String,
|
|
142
170
|
trim: true,
|
|
143
171
|
index: true,
|
|
144
172
|
},
|
|
145
173
|
|
|
174
|
+
/** @ref Group — product group/bundle */
|
|
146
175
|
group: {
|
|
147
176
|
type: Schema.Types.ObjectId,
|
|
148
177
|
index: true,
|
|
149
178
|
},
|
|
150
179
|
|
|
180
|
+
/** Last Shopify sync timestamp */
|
|
151
181
|
last_synced_at: {
|
|
152
182
|
type: Date,
|
|
153
183
|
default: Date.now,
|
|
154
184
|
index: true,
|
|
155
185
|
},
|
|
156
186
|
|
|
187
|
+
/** Total page views */
|
|
157
188
|
views_count: {
|
|
158
189
|
type: Number,
|
|
159
190
|
default: 0,
|
|
160
191
|
index: true,
|
|
161
192
|
},
|
|
162
193
|
|
|
194
|
+
/** @ref Product — original product (for transfers) */
|
|
163
195
|
source_product: {
|
|
164
196
|
type: Schema.Types.ObjectId,
|
|
165
197
|
},
|
|
166
198
|
|
|
199
|
+
/** Google Shopping metadata */
|
|
167
200
|
meta: {
|
|
168
201
|
type: ProductMeta,
|
|
169
202
|
default: {}
|
|
170
203
|
},
|
|
171
204
|
|
|
172
|
-
|
|
205
|
+
/** Temporary flag: product import in progress */
|
|
206
|
+
is_imported: {
|
|
173
207
|
type: Boolean,
|
|
174
208
|
default: false,
|
|
175
209
|
index: true,
|
|
176
210
|
},
|
|
177
211
|
|
|
178
|
-
|
|
212
|
+
/** Temporary flag: image upload in progress */
|
|
213
|
+
is_uploaded: {
|
|
179
214
|
type: Boolean,
|
|
180
215
|
default: false,
|
|
181
216
|
index: true,
|
|
182
217
|
},
|
|
183
218
|
|
|
219
|
+
/** Trello card ID for project tracking */
|
|
184
220
|
trello_id: {
|
|
185
221
|
type: String,
|
|
186
222
|
trim: true,
|
|
187
223
|
index: true,
|
|
188
224
|
},
|
|
189
225
|
|
|
226
|
+
/** SKU / internal product code */
|
|
190
227
|
code: {
|
|
191
228
|
type: String,
|
|
192
229
|
trim: true,
|
|
193
230
|
index: true,
|
|
194
231
|
},
|
|
195
232
|
|
|
233
|
+
/** Design idea or concept notes */
|
|
196
234
|
user_idea: {
|
|
197
235
|
type: String,
|
|
198
236
|
trim: true,
|
|
199
237
|
index: true,
|
|
200
238
|
},
|
|
201
239
|
|
|
240
|
+
/** Visibility on storefront: 'visible' or 'sensitive' */
|
|
202
241
|
visibility: {
|
|
203
242
|
type: String,
|
|
204
243
|
trim: true,
|
|
@@ -206,120 +245,143 @@ const Product = new Schema({
|
|
|
206
245
|
default: 'visible',
|
|
207
246
|
},
|
|
208
247
|
|
|
248
|
+
/** Short description */
|
|
209
249
|
short_description: {
|
|
210
250
|
type: String,
|
|
211
251
|
trim: true,
|
|
212
252
|
},
|
|
213
253
|
|
|
254
|
+
/** Total sales count */
|
|
214
255
|
sales_count: {
|
|
215
256
|
type: Number,
|
|
216
257
|
default: 0,
|
|
217
258
|
index: true,
|
|
218
259
|
},
|
|
219
260
|
|
|
261
|
+
/** Number of times favorited */
|
|
220
262
|
favorites_count: {
|
|
221
263
|
type: Number,
|
|
222
264
|
default: 0,
|
|
223
265
|
index: true,
|
|
224
266
|
},
|
|
225
267
|
|
|
268
|
+
/** Import source info */
|
|
226
269
|
source: {
|
|
227
270
|
type: ProductSource,
|
|
228
271
|
},
|
|
229
272
|
|
|
273
|
+
/** Whether this is the primary product in a group */
|
|
230
274
|
is_primary: {
|
|
231
275
|
type: Boolean,
|
|
232
276
|
default: true,
|
|
233
277
|
index: true,
|
|
234
278
|
},
|
|
235
279
|
|
|
280
|
+
/** Whether product is available for purchase */
|
|
236
281
|
available_for_sale: {
|
|
237
282
|
type: Boolean,
|
|
238
283
|
default: true,
|
|
239
284
|
index: true,
|
|
240
285
|
},
|
|
241
286
|
|
|
287
|
+
/** Version identifier */
|
|
242
288
|
version: {
|
|
243
289
|
type: String,
|
|
244
290
|
trim: true,
|
|
245
291
|
},
|
|
246
292
|
|
|
293
|
+
/** Highlighted as featured */
|
|
247
294
|
is_featured: {
|
|
248
295
|
type: Boolean,
|
|
249
296
|
default: false,
|
|
250
297
|
},
|
|
251
298
|
|
|
299
|
+
/** Marked as trending */
|
|
252
300
|
is_trending: {
|
|
253
301
|
type: Boolean,
|
|
254
302
|
default: false,
|
|
255
303
|
index: true,
|
|
256
304
|
},
|
|
257
305
|
|
|
306
|
+
/** @ref Customize — customization config */
|
|
258
307
|
customize: {
|
|
259
308
|
type: Schema.Types.ObjectId,
|
|
260
309
|
},
|
|
261
310
|
|
|
311
|
+
/** Whether this product supports customization */
|
|
262
312
|
customizable: {
|
|
263
313
|
type: Boolean,
|
|
264
314
|
default: false,
|
|
265
315
|
index: true,
|
|
266
316
|
},
|
|
267
317
|
|
|
318
|
+
/** Page template name */
|
|
268
319
|
template: {
|
|
269
320
|
type: String,
|
|
270
321
|
trim: true,
|
|
271
322
|
},
|
|
272
323
|
|
|
324
|
+
/** Featured statistics text */
|
|
273
325
|
featured_stats: {
|
|
274
326
|
type: String,
|
|
275
327
|
trim: true,
|
|
276
328
|
},
|
|
277
329
|
|
|
330
|
+
/** Internal notes (not shown to customers) */
|
|
278
331
|
private_note: {
|
|
279
332
|
type: String,
|
|
280
333
|
trim: true,
|
|
281
334
|
},
|
|
282
335
|
|
|
336
|
+
/** Advertising notes */
|
|
283
337
|
ads_note: {
|
|
284
338
|
type: String,
|
|
285
339
|
trim: true,
|
|
286
340
|
},
|
|
287
341
|
|
|
342
|
+
/** Show description on product page */
|
|
288
343
|
show_description: {
|
|
289
344
|
type: Boolean,
|
|
290
345
|
default: false,
|
|
291
346
|
},
|
|
292
347
|
|
|
348
|
+
/** Total media file size */
|
|
293
349
|
media_size: {
|
|
294
350
|
type: Number,
|
|
295
351
|
trim: true,
|
|
296
352
|
},
|
|
297
353
|
|
|
298
|
-
|
|
354
|
+
/** Temporary field for product editing workflow */
|
|
355
|
+
stage: {
|
|
299
356
|
type: String,
|
|
300
357
|
trim: true,
|
|
301
358
|
},
|
|
302
359
|
|
|
303
|
-
|
|
360
|
+
/** External ID from import source */
|
|
361
|
+
external_id: {
|
|
304
362
|
type: String,
|
|
305
363
|
trim: true,
|
|
306
364
|
index: true,
|
|
307
365
|
},
|
|
308
366
|
|
|
367
|
+
/** Number of times this product has been transferred */
|
|
309
368
|
transfer_count: {
|
|
310
369
|
type: Number,
|
|
311
370
|
default: 0,
|
|
312
371
|
},
|
|
313
372
|
|
|
373
|
+
/** Soft delete timestamp */
|
|
314
374
|
deleted_at: {
|
|
315
375
|
type: Date,
|
|
316
376
|
},
|
|
317
377
|
|
|
378
|
+
/** Last update timestamp */
|
|
318
379
|
updated_at: {
|
|
319
380
|
type: Date,
|
|
320
381
|
default: Date.now,
|
|
321
382
|
},
|
|
322
383
|
|
|
384
|
+
/** Record creation timestamp */
|
|
323
385
|
created_at: {
|
|
324
386
|
type: Date,
|
|
325
387
|
default: Date.now,
|
|
@@ -327,6 +389,7 @@ const Product = new Schema({
|
|
|
327
389
|
}
|
|
328
390
|
})
|
|
329
391
|
|
|
392
|
+
/** Full-text search index */
|
|
330
393
|
Product.index({
|
|
331
394
|
title: 'text',
|
|
332
395
|
alternative_title: 'text',
|
|
@@ -336,4 +399,3 @@ Product.index({
|
|
|
336
399
|
|
|
337
400
|
|
|
338
401
|
module.exports = Product
|
|
339
|
-
|
|
@@ -2,40 +2,49 @@ const {Schema} = require('mongoose')
|
|
|
2
2
|
const VideoObject = require('./products/VideoObject')
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
/** Embedded size guide image */
|
|
5
6
|
const SizeGuide = new Schema({
|
|
6
7
|
_id: false,
|
|
7
8
|
|
|
9
|
+
/** Size guide image URL */
|
|
8
10
|
image_url: {
|
|
9
11
|
type: String,
|
|
10
12
|
trim: true,
|
|
11
13
|
},
|
|
12
14
|
})
|
|
13
15
|
|
|
16
|
+
/** Embedded date range in days (from/to) */
|
|
14
17
|
const DateRange = new Schema({
|
|
15
18
|
_id: false,
|
|
16
19
|
|
|
20
|
+
/** Minimum days */
|
|
17
21
|
from: {
|
|
18
22
|
type: Number,
|
|
19
23
|
},
|
|
20
24
|
|
|
25
|
+
/** Maximum days */
|
|
21
26
|
to: {
|
|
22
27
|
type: Number,
|
|
23
28
|
}
|
|
24
29
|
})
|
|
25
30
|
|
|
31
|
+
/** Extended product details (description, shipping, sizing, etc.) */
|
|
26
32
|
const ProductFeature = new Schema({
|
|
33
|
+
/** @ref Store */
|
|
27
34
|
store: {
|
|
28
35
|
type: Schema.Types.ObjectId,
|
|
29
36
|
index: true,
|
|
30
37
|
required: true,
|
|
31
38
|
},
|
|
32
39
|
|
|
40
|
+
/** Shopify product ID */
|
|
33
41
|
id: {
|
|
34
42
|
type: String,
|
|
35
43
|
trim: true,
|
|
36
44
|
index: true,
|
|
37
45
|
},
|
|
38
46
|
|
|
47
|
+
/** Product type */
|
|
39
48
|
product_type: {
|
|
40
49
|
type: String,
|
|
41
50
|
trim: true,
|
|
@@ -43,80 +52,97 @@ const ProductFeature = new Schema({
|
|
|
43
52
|
index: true,
|
|
44
53
|
},
|
|
45
54
|
|
|
55
|
+
/** Full product description in HTML */
|
|
46
56
|
body_html: {
|
|
47
57
|
type: String,
|
|
48
58
|
trim: true,
|
|
49
59
|
},
|
|
50
60
|
|
|
61
|
+
/** Description */
|
|
51
62
|
description: {
|
|
52
63
|
type: String,
|
|
53
64
|
trim: true,
|
|
54
65
|
},
|
|
55
66
|
|
|
67
|
+
/** Size guide */
|
|
56
68
|
size_guide: {
|
|
57
69
|
type: SizeGuide,
|
|
58
70
|
},
|
|
59
71
|
|
|
72
|
+
/** Production time range in days */
|
|
60
73
|
production_time: {
|
|
61
74
|
type: DateRange,
|
|
62
75
|
},
|
|
63
76
|
|
|
77
|
+
/** Shipping time range in days */
|
|
64
78
|
shipping_time: {
|
|
65
79
|
type: DateRange,
|
|
66
80
|
},
|
|
67
81
|
|
|
82
|
+
/** Production process description */
|
|
68
83
|
production_description: {
|
|
69
84
|
type: String,
|
|
70
85
|
trim: true,
|
|
71
86
|
},
|
|
72
87
|
|
|
88
|
+
/** Ship-from country code */
|
|
73
89
|
country_code: {
|
|
74
90
|
type: String,
|
|
75
91
|
trim: true,
|
|
76
92
|
},
|
|
77
93
|
|
|
94
|
+
/** Origin/made-in text */
|
|
78
95
|
origin_text: {
|
|
79
96
|
type: String,
|
|
80
97
|
trim: true,
|
|
81
98
|
},
|
|
82
99
|
|
|
100
|
+
/** Product material */
|
|
83
101
|
material: {
|
|
84
102
|
type: String,
|
|
85
103
|
trim: true,
|
|
86
104
|
},
|
|
87
105
|
|
|
106
|
+
/** Google Shopping product category */
|
|
88
107
|
google_product_category: {
|
|
89
108
|
type: String,
|
|
90
109
|
trim: true,
|
|
91
110
|
},
|
|
92
111
|
|
|
112
|
+
/** Product weight */
|
|
93
113
|
weight: {
|
|
94
114
|
type: Number,
|
|
95
115
|
},
|
|
96
116
|
|
|
117
|
+
/** Product video */
|
|
97
118
|
video: {
|
|
98
119
|
type: VideoObject,
|
|
99
120
|
},
|
|
100
121
|
|
|
122
|
+
/** Number of reviews */
|
|
101
123
|
reviews_count: {
|
|
102
124
|
type: Number,
|
|
103
125
|
default: 0,
|
|
104
126
|
},
|
|
105
127
|
|
|
128
|
+
/** Average review rating (1-5) */
|
|
106
129
|
avg_rating: {
|
|
107
130
|
type: Number,
|
|
108
131
|
default: 5,
|
|
109
132
|
},
|
|
110
133
|
|
|
134
|
+
/** Last sync timestamp */
|
|
111
135
|
synced_at: {
|
|
112
136
|
type: Date,
|
|
113
137
|
},
|
|
114
138
|
|
|
139
|
+
/** Last update timestamp */
|
|
115
140
|
updated_at: {
|
|
116
141
|
type: Date,
|
|
117
142
|
default: Date.now,
|
|
118
143
|
},
|
|
119
144
|
|
|
145
|
+
/** Record creation timestamp */
|
|
120
146
|
created_at: {
|
|
121
147
|
type: Date,
|
|
122
148
|
default: Date.now,
|
package/schemas/ProductImage.js
CHANGED
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
const {Schema} = require('mongoose')
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/** Embedded image dimensions */
|
|
4
5
|
const DimensionObject = new Schema({
|
|
5
6
|
_id: false,
|
|
6
7
|
|
|
8
|
+
/** Width in pixels */
|
|
7
9
|
width: {
|
|
8
10
|
type: Number,
|
|
9
11
|
},
|
|
10
12
|
|
|
13
|
+
/** Height in pixels */
|
|
11
14
|
height: {
|
|
12
15
|
type: Number,
|
|
13
16
|
}
|
|
14
17
|
})
|
|
15
18
|
|
|
19
|
+
/** Product image with dimensions and upload status */
|
|
16
20
|
const ProductImage = new Schema({
|
|
21
|
+
/** @ref Store */
|
|
17
22
|
store: {
|
|
18
23
|
type: Schema.Types.ObjectId,
|
|
19
24
|
index: true,
|
|
20
25
|
required: true,
|
|
21
26
|
},
|
|
22
27
|
|
|
28
|
+
/** @ref Product */
|
|
23
29
|
product: {
|
|
24
30
|
type: Schema.Types.ObjectId,
|
|
25
31
|
index: true,
|
|
26
32
|
required: true,
|
|
27
33
|
},
|
|
28
34
|
|
|
35
|
+
/** Shopify image ID */
|
|
29
36
|
id: {
|
|
30
37
|
type: String,
|
|
31
38
|
trim: true,
|
|
32
39
|
index: true,
|
|
33
40
|
},
|
|
34
41
|
|
|
42
|
+
/** URL */
|
|
35
43
|
url: {
|
|
36
44
|
type: String,
|
|
37
45
|
trim: true,
|
|
38
46
|
},
|
|
39
47
|
|
|
48
|
+
/** Upload/processing status, e.g. 'pending', 'completed' */
|
|
40
49
|
status: {
|
|
41
50
|
type: String,
|
|
42
51
|
trim: true,
|
|
@@ -44,30 +53,36 @@ const ProductImage = new Schema({
|
|
|
44
53
|
default: 'pending'
|
|
45
54
|
},
|
|
46
55
|
|
|
56
|
+
/** MIME type, e.g. image/png */
|
|
47
57
|
mimetype: {
|
|
48
58
|
type: String,
|
|
49
59
|
trim: true,
|
|
50
60
|
},
|
|
51
61
|
|
|
62
|
+
/** File size in bytes */
|
|
52
63
|
size: {
|
|
53
64
|
type: Number,
|
|
54
65
|
},
|
|
55
66
|
|
|
67
|
+
/** Image width/height */
|
|
56
68
|
dimension: {
|
|
57
69
|
type: DimensionObject
|
|
58
70
|
},
|
|
59
71
|
|
|
72
|
+
/** Upload retry count */
|
|
60
73
|
attempts: {
|
|
61
74
|
type: Number,
|
|
62
75
|
default: 0,
|
|
63
76
|
index: true
|
|
64
77
|
},
|
|
65
78
|
|
|
79
|
+
/** Last update timestamp */
|
|
66
80
|
updated_at: {
|
|
67
81
|
type: Date,
|
|
68
82
|
default: Date.now
|
|
69
83
|
},
|
|
70
84
|
|
|
85
|
+
/** Record creation timestamp */
|
|
71
86
|
created_at: {
|
|
72
87
|
type: Date,
|
|
73
88
|
default: Date.now,
|