@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.
Files changed (73) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/CLAUDE.md +16 -66
  3. package/package.json +1 -1
  4. package/schemas/Account.js +11 -1
  5. package/schemas/AnnouncementBar.js +12 -1
  6. package/schemas/Artwork.js +12 -1
  7. package/schemas/BlockedLocation.js +6 -0
  8. package/schemas/Collection.js +24 -0
  9. package/schemas/CreatorReport.js +33 -0
  10. package/schemas/CustomField.js +9 -0
  11. package/schemas/Customize.js +13 -0
  12. package/schemas/DimensionObject.js +3 -0
  13. package/schemas/ExportJob.js +19 -1
  14. package/schemas/FavoriteItem.js +8 -1
  15. package/schemas/FieldSetting.js +3 -0
  16. package/schemas/Fulfillment.js +13 -1
  17. package/schemas/Group.js +21 -1
  18. package/schemas/GroupArtwork.js +7 -1
  19. package/schemas/GroupItem.js +9 -1
  20. package/schemas/Image.js +8 -0
  21. package/schemas/ImageObject.js +6 -0
  22. package/schemas/LatestEvent.js +14 -0
  23. package/schemas/LogURL.js +7 -0
  24. package/schemas/MarketingCost.js +13 -0
  25. package/schemas/Media.js +11 -0
  26. package/schemas/MediaUpload.js +16 -1
  27. package/schemas/Menu.js +9 -0
  28. package/schemas/MenuItem.js +14 -0
  29. package/schemas/MoneyObject.js +3 -0
  30. package/schemas/Order.js +38 -1
  31. package/schemas/OrderItem.js +17 -1
  32. package/schemas/Payout.js +10 -1
  33. package/schemas/Post.js +19 -1
  34. package/schemas/PriceRange.js +6 -0
  35. package/schemas/Product.js +67 -5
  36. package/schemas/ProductFeature.js +26 -0
  37. package/schemas/ProductImage.js +15 -0
  38. package/schemas/ProductImport.js +26 -0
  39. package/schemas/ProductRaw.js +22 -0
  40. package/schemas/ProductReport.js +104 -0
  41. package/schemas/ProductTag.js +8 -1
  42. package/schemas/ProductType.js +9 -1
  43. package/schemas/Publication.js +7 -0
  44. package/schemas/RecentView.js +5 -1
  45. package/schemas/Review.js +18 -1
  46. package/schemas/SearchTerm.js +4 -0
  47. package/schemas/Shop.js +10 -0
  48. package/schemas/ShopifyAPI.js +11 -1
  49. package/schemas/ShopifyObject.js +14 -1
  50. package/schemas/ShortDomain.js +10 -1
  51. package/schemas/ShortLog.js +10 -0
  52. package/schemas/ShortUrl.js +14 -0
  53. package/schemas/Store.js +19 -1
  54. package/schemas/StoreEvent.js +13 -1
  55. package/schemas/StoreSetting.js +25 -1
  56. package/schemas/TrackPage.js +9 -1
  57. package/schemas/TransferJob.js +22 -0
  58. package/schemas/User.js +6 -0
  59. package/schemas/WebhookEvent.js +7 -1
  60. package/schemas/products/MediaObject.js +8 -0
  61. package/schemas/products/SeoObject.js +3 -0
  62. package/schemas/products/VideoObject.js +6 -0
  63. package/schemas/types/BrandSettings.js +3 -0
  64. package/schemas/types/DMCASetting.js +3 -0
  65. package/schemas/types/FacebookObject.js +3 -0
  66. package/schemas/types/FooterSetting.js +2 -0
  67. package/schemas/types/FreeShippingSetting.js +3 -0
  68. package/schemas/types/GoogleAnalytics.js +2 -0
  69. package/schemas/types/KlaviyoObject.js +3 -0
  70. package/schemas/types/MerchizeSettings.js +3 -0
  71. package/schemas/types/SocialsObject.js +8 -0
  72. package/schemas/types/TopBarSettings.js +2 -0
  73. package/schemas/types/TrustpilotObject.js +4 -0
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(git add:*)",
5
+ "Bash(git commit:*)",
6
+ "Bash(git push:*)"
7
+ ]
8
+ }
9
+ }
package/CLAUDE.md CHANGED
@@ -68,96 +68,46 @@ index.js # Exports path to schemas/ directory
68
68
 
69
69
  ## Schema Catalog
70
70
 
71
+ > Field-level documentation is in JSDoc comments within each schema file. This catalog provides a quick overview.
72
+
71
73
  ### Accounts & Auth
72
- - **Account** — Seller accounts (email, password, role, status)
73
- - **User** — User-to-Store relationship (refs: store, account)
74
- - **Store** — Main store entity (subdomain, primary_domain, status, users[])
75
- - **Shop** — Shop within a Store (handle, products_count)
76
- - **ShopifyAPI** — Shopify API credentials per store
74
+ Account, User, Store, Shop, ShopifyAPI
77
75
 
78
76
  ### Products
79
- - **Product** Core product (title, handle, status, price_range, tags, collections). Full-text index on title/alternative_title/code/tags
80
- - **ProductFeature** — Extended details (body_html, size_guide, shipping_time, video)
81
- - **ProductImage** — Product images with dimensions and upload status
82
- - **ProductRaw** — Raw synced product data from source platforms
83
- - **ProductType** — Product type classification
84
- - **ProductTag** — Tag with aggregated counts
85
- - **ProductImport** — Import job tracking (url, platform, status)
86
- - **Customize** — Product customization config
87
- - **CustomField** — Dynamic fields for customization
77
+ Product, ProductFeature, ProductImage, ProductRaw, ProductType, ProductTag, ProductImport, Customize, CustomField
88
78
 
89
79
  ### Collections & Groups
90
- - **Collection** — Product collections (title, handle, SEO, featured_image)
91
- - **Group** — Product grouping/bundles (items_count, style, tags)
92
- - **GroupItem** — Items within a group (refs: group, product)
93
- - **GroupArtwork** — Artwork assigned to groups
80
+ Collection, Group, GroupItem, GroupArtwork
94
81
 
95
82
  ### Orders & Fulfillment
96
- - **Order** — Orders (shipping_address, fulfillment_status, financial_status, total_price). Full-text index on name/id/email/phone
97
- - **OrderItem** — Line items (quantity, price, variant info)
98
- - **Fulfillment** — Shipment tracking (tracking_number, tracking_url)
99
- - **Payout** — Payment payouts (net amount, status, type)
83
+ Order, OrderItem, Fulfillment, Payout
100
84
 
101
85
  ### Content & Pages
102
- - **Post** — Blog posts (title, body_html, excerpt, author, tags, SEO)
103
- - **Menu** / **MenuItem** — Navigation menus (hierarchical via parent ref)
104
- - **AnnouncementBar** — Store banner announcements
86
+ Post, Menu, MenuItem, AnnouncementBar
105
87
 
106
88
  ### Media & Assets
107
- - **Image** — Stored images (path, dimension, mimetype, size)
108
- - **Artwork** — Design artwork uploads with processing status
109
- - **Media** — General media files
110
- - **MediaUpload** — Media upload tracking per product
89
+ Image, Artwork, Media, MediaUpload
111
90
 
112
91
  ### Analytics & Tracking
113
- - **StoreEvent** Store activity events (TTL index on created_at)
114
- - **LatestEvent** — Latest event snapshots (TTL: 30 days)
115
- - **RecentView** — Recently viewed products (TTL: 90 days)
116
- - **SearchTerm** — Search term tracking
117
- - **FavoriteItem** — Favorited products per session
118
- - **TrackPage** — Page access logs (TTL: 7 days)
119
- - **MarketingCost** — Ad campaign cost tracking per product
92
+ StoreEvent, LatestEvent, RecentView, SearchTerm, FavoriteItem, TrackPage, MarketingCost
120
93
 
121
94
  ### Short URLs
122
- - **ShortUrl** Short links (slug + domain, clicks_count)
123
- - **ShortDomain** — Short link domains
124
- - **ShortLog** — Click tracking for short URLs
125
- - **LogURL** — General URL logging
95
+ ShortUrl, ShortDomain, ShortLog, LogURL
126
96
 
127
97
  ### Jobs & Events
128
- - **ExportJob** — Data export jobs (status, path_file)
129
- - **TransferJob** — Product transfer between stores
130
- - **WebhookEvent** — Webhook event queue (TTL: 2 days)
98
+ ExportJob, TransferJob, WebhookEvent
131
99
 
132
100
  ### Settings & Config
133
- - **StoreSetting** — Store configuration (brand, logo, socials, integrations)
134
- - **BlockedLocation** — Geographic blocking rules
135
- - **Publication** — Product publication channels
136
- - **ShopifyObject** — Synced Shopify data
101
+ StoreSetting, BlockedLocation, Publication, ShopifyObject
137
102
 
138
103
  ### Reports
139
- - **CreatorReport** — Monthly creator performance report per store (account ref, period "YYYY-MM", orders_count, items_sold, revenue, ads_spent, profit, status: active|completed|deleted, last_aggregated_at)
104
+ CreatorReport, ProductReport
140
105
 
141
106
  ### Reviews
142
- - **Review** — Product reviews (vote_value, content, country_code, source)
143
-
144
- ## Common Embedded Types
145
-
146
- Used as sub-documents across multiple schemas:
147
-
148
- | Type | Fields | Used In |
149
- |------|--------|---------|
150
- | **MoneyObject** | amount, currency (default: 'USD') | Order, OrderItem, Payout, MarketingCost |
151
- | **ImageObject** | id, altText, url, width, height | Product, Collection, Post, StoreSetting |
152
- | **DimensionObject** | width, height | Image, ProductImage |
153
- | **SeoObject** | title, description | Collection, ProductRaw |
154
- | **VideoObject** | id, url, width, height, mime_type | ProductFeature |
155
- | **MediaObject** | id, url, alt_text, width, height, mime_type, content_type | ProductRaw |
156
- | **PriceRange** | minVariantPrice, maxVariantPrice | Product |
157
-
158
- ### Store Setting Types (schemas/types/)
107
+ Review
159
108
 
160
- BrandSettings, DMCASetting, FacebookObject, FooterSetting, FreeShippingSetting, GoogleAnalytics, KlaviyoObject, MerchizeSettings, SocialsObject, TopBarSettings, TrustpilotObject
109
+ ### Embedded Types (schemas/types/, schemas/products/)
110
+ MoneyObject, ImageObject, DimensionObject, PriceRange, SeoObject, VideoObject, MediaObject, BrandSettings, DMCASetting, FacebookObject, FooterSetting, FreeShippingSetting, GoogleAnalytics, KlaviyoObject, MerchizeSettings, SocialsObject, TopBarSettings, TrustpilotObject
161
111
 
162
112
  ## Conventions
163
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/database-schemas",
3
- "version": "4.5.0",
3
+ "version": "4.6.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,36 +1,43 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Seller account with authentication credentials and role */
4
5
  const Account = new Schema({
6
+ /** Display name */
5
7
  name: {
6
8
  type: String,
7
9
  trim: true,
8
10
  index: true
9
11
  },
10
12
 
13
+ /** Login email address */
11
14
  email: {
12
15
  type: String,
13
16
  trim: true,
14
17
  required: true
15
18
  },
16
19
 
20
+ /** Hashed password */
17
21
  password: {
18
22
  type: String,
19
23
  trim: true
20
24
  },
21
25
 
26
+ /** Account role, e.g. 'seller', 'admin' */
22
27
  role: {
23
28
  type: String,
24
29
  trim: true,
25
30
  default: 'seller'
26
31
  },
27
32
 
33
+ /** Whether this account is a creator */
28
34
  is_creator: {
29
35
  type: Boolean,
30
36
  default: false,
31
37
  index: true
32
38
  },
33
39
 
40
+ /** Account status, e.g. 'active', 'inactive' */
34
41
  status: {
35
42
  type: String,
36
43
  trim: true,
@@ -38,20 +45,24 @@ const Account = new Schema({
38
45
  default: 'active'
39
46
  },
40
47
 
48
+ /** Last time the account was active */
41
49
  last_active_at: {
42
50
  type: Date
43
51
  },
44
52
 
53
+ /** Linked advertising account IDs */
45
54
  ad_accounts: {
46
55
  type: [String],
47
56
  default: []
48
57
  },
49
58
 
59
+ /** Last update timestamp */
50
60
  updated_at: {
51
61
  type: Date,
52
62
  default: Date.now
53
63
  },
54
64
 
65
+ /** Record creation timestamp */
55
66
  created_at: {
56
67
  type: Date,
57
68
  default: Date.now
@@ -59,4 +70,3 @@ const Account = new Schema({
59
70
  })
60
71
 
61
72
  module.exports = Account
62
-
@@ -1,13 +1,16 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Store banner announcement displayed to visitors */
4
5
  const AnnouncementBar = 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
+ /** Announcement identifier */
11
14
  id: {
12
15
  type: String,
13
16
  trim: true,
@@ -15,49 +18,58 @@ const AnnouncementBar = new Schema({
15
18
  index: true,
16
19
  },
17
20
 
21
+ /** Announcement name */
18
22
  name: {
19
23
  type: String,
20
24
  trim: true,
21
25
  required: true,
22
26
  },
23
27
 
28
+ /** Placement zone on the page */
24
29
  zone: {
25
30
  type: String,
26
31
  trim: true,
27
32
  required: true,
28
33
  },
29
34
 
35
+ /** Banner display text */
30
36
  content: {
31
37
  type: String,
32
38
  trim: true,
33
39
  },
34
40
 
41
+ /** CTA button text */
35
42
  action_text: {
36
43
  type: String,
37
44
  trim: true,
38
45
  },
39
46
 
47
+ /** CTA button link */
40
48
  action_url: {
41
49
  type: String,
42
50
  trim: true,
43
51
  },
44
52
 
53
+ /** CTA button tooltip */
45
54
  action_title: {
46
55
  type: String,
47
56
  trim: true,
48
57
  },
49
58
 
59
+ /** Shopify sync identifier */
50
60
  sync_id: {
51
61
  type: String,
52
62
  trim: true,
53
63
  index: true,
54
64
  },
55
65
 
66
+ /** Last update timestamp */
56
67
  updated_at: {
57
68
  type: Date,
58
69
  default: Date.now
59
70
  },
60
71
 
72
+ /** Record creation timestamp */
61
73
  created_at: {
62
74
  type: Date,
63
75
  default: Date.now
@@ -65,4 +77,3 @@ const AnnouncementBar = new Schema({
65
77
  })
66
78
 
67
79
  module.exports = AnnouncementBar
68
-
@@ -1,38 +1,46 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Design artwork upload with processing status */
4
5
  const Artwork = 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
+ /** Public URL of the artwork */
11
14
  url: {
12
15
  type: String,
13
16
  trim: true,
14
17
  },
15
18
 
19
+ /** Storage file path */
16
20
  path_file: {
17
21
  type: String,
18
22
  trim: true,
19
23
  },
20
24
 
25
+ /** MIME type, e.g. 'image/png' */
21
26
  mimetype: {
22
27
  type: String,
23
28
  trim: true,
24
29
  },
25
30
 
31
+ /** File size in bytes */
26
32
  size: {
27
33
  type: Number,
28
34
  },
29
35
 
36
+ /** Storage zone: 'internal' or external */
30
37
  zone: {
31
38
  type: String,
32
39
  trim: true,
33
40
  default: 'internal',
34
41
  },
35
42
 
43
+ /** Processing status, e.g. 'pending', 'completed', 'failed' */
36
44
  status: {
37
45
  type: String,
38
46
  trim: true,
@@ -40,21 +48,25 @@ const Artwork = new Schema({
40
48
  index: true,
41
49
  },
42
50
 
51
+ /** Dominant color extracted from artwork */
43
52
  color: {
44
53
  type: String,
45
54
  trim: true,
46
55
  },
47
56
 
57
+ /** Processing retry count */
48
58
  attempts: {
49
59
  type: Number,
50
60
  default: 0,
51
61
  },
52
62
 
63
+ /** Last update timestamp */
53
64
  updated_at: {
54
65
  type: Date,
55
66
  default: Date.now
56
67
  },
57
68
 
69
+ /** Record creation timestamp */
58
70
  created_at: {
59
71
  type: Date,
60
72
  default: Date.now
@@ -62,4 +74,3 @@ const Artwork = new Schema({
62
74
  })
63
75
 
64
76
  module.exports = Artwork
65
-
@@ -1,13 +1,16 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Geographic blocking rule for a store */
4
5
  const BlockedLocation = new Schema({
6
+ /** @ref Store */
5
7
  store: {
6
8
  type: Schema.Types.ObjectId,
7
9
  required: true,
8
10
  index: true,
9
11
  },
10
12
 
13
+ /** Blocking level, e.g. 'country' */
11
14
  type: {
12
15
  type: String,
13
16
  required: true,
@@ -15,17 +18,20 @@ const BlockedLocation = new Schema({
15
18
  default: 'country'
16
19
  },
17
20
 
21
+ /** Blocked value, e.g. country code 'US', 'VN' */
18
22
  value: {
19
23
  type: String,
20
24
  required: true,
21
25
  index: true,
22
26
  },
23
27
 
28
+ /** Last update timestamp */
24
29
  updated_at: {
25
30
  type: Date,
26
31
  default: Date.now,
27
32
  },
28
33
 
34
+ /** Record creation timestamp */
29
35
  created_at: {
30
36
  type: Date,
31
37
  default: Date.now,
@@ -2,27 +2,33 @@ const {Schema} = require('mongoose')
2
2
  const ImageObject = require('./ImageObject')
3
3
 
4
4
 
5
+ /** Embedded SEO metadata */
5
6
  const SeoObject = new Schema({
6
7
  _id: false,
7
8
 
9
+ /** Display title */
8
10
  title: {
9
11
  type: String,
10
12
  trim: true,
11
13
  },
12
14
 
15
+ /** Description */
13
16
  description: {
14
17
  type: String,
15
18
  trim: true,
16
19
  },
17
20
  })
18
21
 
22
+ /** Product collection for organizing and grouping products */
19
23
  const Collection = new Schema({
24
+ /** @ref Store */
20
25
  store: {
21
26
  type: Schema.Types.ObjectId,
22
27
  required: true,
23
28
  index: true,
24
29
  },
25
30
 
31
+ /** Shopify collection ID */
26
32
  id: {
27
33
  type: String,
28
34
  trim: true,
@@ -30,17 +36,20 @@ const Collection = new Schema({
30
36
  index: true,
31
37
  },
32
38
 
39
+ /** Display title */
33
40
  title: {
34
41
  type: String,
35
42
  trim: true,
36
43
  },
37
44
 
45
+ /** Internal collection code */
38
46
  code: {
39
47
  type: String,
40
48
  trim: true,
41
49
  index: true,
42
50
  },
43
51
 
52
+ /** Collection status, e.g. 'active', 'inactive' */
44
53
  status: {
45
54
  type: String,
46
55
  trim: true,
@@ -49,6 +58,7 @@ const Collection = new Schema({
49
58
  index: true,
50
59
  },
51
60
 
61
+ /** Visibility on storefront: 'visible' or 'hidden' */
52
62
  visibility: {
53
63
  type: String,
54
64
  trim: true,
@@ -56,73 +66,87 @@ const Collection = new Schema({
56
66
  default: 'visible',
57
67
  },
58
68
 
69
+ /** Alternative/secondary title */
59
70
  alternative_title: {
60
71
  type: String,
61
72
  trim: true,
62
73
  },
63
74
 
75
+ /** URL-friendly slug */
64
76
  handle: {
65
77
  type: String,
66
78
  trim: true,
67
79
  index: true,
68
80
  },
69
81
 
82
+ /** Featured image */
70
83
  featured_image: {
71
84
  type: ImageObject,
72
85
  },
73
86
 
87
+ /** Description */
74
88
  description: {
75
89
  type: String,
76
90
  trim: true,
77
91
  },
78
92
 
93
+ /** HTML-formatted description */
79
94
  description_html: {
80
95
  type: String,
81
96
  trim: true,
82
97
  },
83
98
 
99
+ /** Number of products */
84
100
  products_count: {
85
101
  type: Number,
86
102
  index: true,
87
103
  },
88
104
 
105
+ /** Display this collection on homepage */
89
106
  show_on_homepage: {
90
107
  type: Boolean,
91
108
  default: false,
92
109
  index: true
93
110
  },
94
111
 
112
+ /** Last Shopify sync timestamp */
95
113
  last_synced_at: {
96
114
  type: Date,
97
115
  default: Date.now
98
116
  },
99
117
 
118
+ /** Include sensitive/adult products in this collection */
100
119
  show_sensitive_products: {
101
120
  type: Boolean,
102
121
  default: false,
103
122
  },
104
123
 
124
+ /** Product display mode for this collection */
105
125
  show_items_mode: {
106
126
  type: String,
107
127
  trim: true,
108
128
  default: ''
109
129
  },
110
130
 
131
+ /** SEO metadata */
111
132
  seo: {
112
133
  type: SeoObject,
113
134
  },
114
135
 
136
+ /** Shopify sync identifier */
115
137
  sync_id: {
116
138
  type: String,
117
139
  trim: true,
118
140
  index: true,
119
141
  },
120
142
 
143
+ /** Last update timestamp */
121
144
  updated_at: {
122
145
  type: Date,
123
146
  default: Date.now,
124
147
  },
125
148
 
149
+ /** Record creation timestamp */
126
150
  created_at: {
127
151
  type: Date,
128
152
  default: Date.now,
@@ -4,28 +4,38 @@ const MoneyObject = require('./MoneyObject')
4
4
 
5
5
  const AdAccountStat = new Schema({
6
6
  _id: false,
7
+ /** Display name */
7
8
  name: {
8
9
  type: String,
9
10
  trim: true,
10
11
  },
12
+ /** Ad account cost */
11
13
  cost: {
12
14
  type: MoneyObject,
13
15
  }
14
16
  })
15
17
 
18
+ /**
19
+ * Monthly creator performance report per store.
20
+ * Aggregated by a daily schedule job for the current month (status: active).
21
+ * When the month ends, status transitions to "completed".
22
+ */
16
23
  const CreatorReport = new Schema({
24
+ /** @ref Store */
17
25
  store: {
18
26
  type: Schema.Types.ObjectId,
19
27
  index: true,
20
28
  required: true,
21
29
  },
22
30
 
31
+ /** @ref Account — the creator account */
23
32
  account: {
24
33
  type: Schema.Types.ObjectId,
25
34
  index: true,
26
35
  required: true,
27
36
  },
28
37
 
38
+ /** Monthly period in "YYYY-MM" format, e.g. "2026-04" */
29
39
  period: {
30
40
  type: String,
31
41
  trim: true,
@@ -33,39 +43,52 @@ const CreatorReport = new Schema({
33
43
  index: true,
34
44
  },
35
45
 
46
+ /** Total number of orders in this period */
36
47
  orders_count: {
37
48
  type: Number,
38
49
  default: 0,
39
50
  },
40
51
 
52
+ /** Total quantity of items sold */
41
53
  items_sold: {
42
54
  type: Number,
43
55
  default: 0,
44
56
  },
45
57
 
58
+ /** Total revenue */
46
59
  revenue: {
47
60
  type: MoneyObject,
48
61
  },
49
62
 
63
+ /** Total advertising spend */
50
64
  ads_spent: {
51
65
  type: MoneyObject,
52
66
  },
53
67
 
68
+ /** Net profit (revenue - ads_spent - costs) */
54
69
  profit: {
55
70
  type: MoneyObject,
56
71
  },
57
72
 
73
+ /** Per-ad-account cost breakdown */
58
74
  ad_accounts: {
59
75
  type: [AdAccountStat],
60
76
  default: [],
61
77
  },
62
78
 
79
+ /** Campaign IDs excluded from aggregation */
63
80
  exclude_campaigns: {
64
81
  type: [String],
65
82
  trim: true,
66
83
  default: []
67
84
  },
68
85
 
86
+ /**
87
+ * Report lifecycle status:
88
+ * - active: current month, updated daily by schedule
89
+ * - completed: past month, finalized
90
+ * - deleted: soft-deleted
91
+ */
69
92
  status: {
70
93
  type: String,
71
94
  trim: true,
@@ -74,6 +97,12 @@ const CreatorReport = new Schema({
74
97
  index: true,
75
98
  },
76
99
 
100
+ /**
101
+ * Aggregation job status:
102
+ * - pending: not yet processed
103
+ * - processing: aggregation in progress
104
+ * - completed: aggregation finished
105
+ */
77
106
  aggregation_status: {
78
107
  type: String,
79
108
  trim: true,
@@ -81,21 +110,25 @@ const CreatorReport = new Schema({
81
110
  enum: ['pending', 'processing', 'completed'],
82
111
  },
83
112
 
113
+ /** Admin notes */
84
114
  note: {
85
115
  type: String,
86
116
  trim: true,
87
117
  },
88
118
 
119
+ /** Timestamp of the last successful aggregation run */
89
120
  last_aggregated_at: {
90
121
  type: Date,
91
122
  index: true,
92
123
  },
93
124
 
125
+ /** Last update timestamp */
94
126
  updated_at: {
95
127
  type: Date,
96
128
  default: Date.now,
97
129
  },
98
130
 
131
+ /** Record creation timestamp */
99
132
  created_at: {
100
133
  type: Date,
101
134
  default: Date.now,