@pintahub/database-schemas 5.6.0 → 5.7.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/README.md +1 -1
- package/package.json +1 -1
- package/schemas/Product.js +4 -1
- package/schemas/TempUpload.js +75 -0
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ Order, OrderItem, Fulfillment, Payout
|
|
|
94
94
|
Post, Menu, MenuItem, AnnouncementBar
|
|
95
95
|
|
|
96
96
|
### Media & Assets
|
|
97
|
-
Image, Artwork, Media, MediaUpload
|
|
97
|
+
Image, Artwork, Media, MediaUpload, TempUpload
|
|
98
98
|
|
|
99
99
|
### Analytics & Tracking
|
|
100
100
|
StoreEvent, LatestEvent, RecentView, SearchTerm, FavoriteItem, TrackPage, MarketingCost
|
package/package.json
CHANGED
package/schemas/Product.js
CHANGED
|
@@ -376,7 +376,10 @@ const Product = new Schema({
|
|
|
376
376
|
Product.index({store: 1, status: 1, is_primary: 1, sales_count: -1})
|
|
377
377
|
|
|
378
378
|
Product.index({store: 1, status: 1, collections: 1, views_count: -1}, {
|
|
379
|
-
partialFilterExpression: {
|
|
379
|
+
partialFilterExpression: {
|
|
380
|
+
status: 'active',
|
|
381
|
+
publications: 'online_store'
|
|
382
|
+
}
|
|
380
383
|
})
|
|
381
384
|
|
|
382
385
|
Product.index({store: 1, product_type: 1, status: 1})
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const {Schema} = require('mongoose')
|
|
2
|
+
const DimensionObject = require('./DimensionObject')
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/** Temporary S3 upload tracking — committed records get moved into Image (or equivalent); orphan records are cleaned up by a scan worker, with TTL as a safety-net. */
|
|
6
|
+
const TempUpload = new Schema({
|
|
7
|
+
/** @ref Store */
|
|
8
|
+
store: {
|
|
9
|
+
type: Schema.Types.ObjectId,
|
|
10
|
+
index: true,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
/** Client-generated session token (UUID) grouping uploads that belong to the same draft (e.g. one in-progress review). */
|
|
15
|
+
upload_token: {
|
|
16
|
+
type: String,
|
|
17
|
+
trim: true,
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
/** What the upload is for, e.g. 'review_image'. Lets one collection serve multiple flows. */
|
|
22
|
+
purpose: {
|
|
23
|
+
type: String,
|
|
24
|
+
trim: true,
|
|
25
|
+
index: true,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
/** S3 object key / storage path */
|
|
30
|
+
path: {
|
|
31
|
+
type: String,
|
|
32
|
+
trim: true,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/** Original file name uploaded by the user */
|
|
37
|
+
file_name: {
|
|
38
|
+
type: String,
|
|
39
|
+
trim: true,
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
/** MIME type, e.g. image/png */
|
|
43
|
+
mimetype: {
|
|
44
|
+
type: String,
|
|
45
|
+
trim: true,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/** File size in bytes */
|
|
49
|
+
size: {
|
|
50
|
+
type: Number,
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/** Image width/height (when applicable) */
|
|
54
|
+
dimension: {
|
|
55
|
+
type: DimensionObject,
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/** Last update timestamp */
|
|
59
|
+
updated_at: {
|
|
60
|
+
type: Date,
|
|
61
|
+
default: Date.now,
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/** TTL safety-net: auto-expires after 7 days. Scan worker should clean up well before this. */
|
|
65
|
+
created_at: {
|
|
66
|
+
type: Date,
|
|
67
|
+
default: Date.now,
|
|
68
|
+
expires: 3_600 * 24 * 7,
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
TempUpload.index({store: 1, upload_token: 1})
|
|
74
|
+
|
|
75
|
+
module.exports = TempUpload
|