@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.
Files changed (73) hide show
  1. package/.claude/settings.local.json +8 -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 +9 -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
package/schemas/Shop.js CHANGED
@@ -1,13 +1,16 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Shop within a Store (multi-shop support) */
4
5
  const Shop = 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,12 +18,14 @@ const Shop = new Schema({
15
18
  index: true,
16
19
  },
17
20
 
21
+ /** Status */
18
22
  status: {
19
23
  type: String,
20
24
  trim: true,
21
25
  index: true,
22
26
  },
23
27
 
28
+ /** URL-friendly slug */
24
29
  handle: {
25
30
  type: String,
26
31
  trim: true,
@@ -28,27 +33,32 @@ const Shop = new Schema({
28
33
  index: true,
29
34
  },
30
35
 
36
+ /** @ref Account — shop owner */
31
37
  owner: {
32
38
  type: Schema.Types.ObjectId,
33
39
  },
34
40
 
41
+ /** Number of products */
35
42
  products_count: {
36
43
  type: Number,
37
44
  default: 0,
38
45
  index: true,
39
46
  },
40
47
 
48
+ /** Randomize product display order */
41
49
  random: {
42
50
  type: Boolean,
43
51
  default: false,
44
52
  index: true,
45
53
  },
46
54
 
55
+ /** Last update timestamp */
47
56
  updated_at: {
48
57
  type: Date,
49
58
  default: Date.now
50
59
  },
51
60
 
61
+ /** Record creation timestamp */
52
62
  created_at: {
53
63
  type: Date,
54
64
  default: Date.now
@@ -1,53 +1,64 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Shopify API credentials per store */
4
5
  const ShopifyAPI = 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 Admin API access token */
11
14
  admin_access_token: {
12
15
  type: String,
13
16
  trim: true,
14
17
  },
15
18
 
19
+ /** Shopify Storefront API access token */
16
20
  storefront_access_token: {
17
21
  type: String,
18
22
  trim: true,
19
23
  },
20
24
 
25
+ /** Shopify session cookies */
21
26
  cookies: {
22
27
  type: String,
23
28
  trim: true,
24
29
  },
25
30
 
31
+ /** CSRF protection token */
26
32
  csrf_token: {
27
33
  type: String,
28
34
  trim: true,
29
35
  },
30
36
 
37
+ /** Shop app session cookies */
31
38
  shop_app_cookies: {
32
39
  type: String,
33
40
  trim: true,
34
41
  },
35
42
 
43
+ /** OAuth client ID */
36
44
  client_id: {
37
45
  type: String,
38
46
  trim: true,
39
47
  },
40
48
 
49
+ /** OAuth client secret */
41
50
  client_secret: {
42
51
  type: String,
43
52
  trim: true,
44
53
  },
45
54
 
55
+ /** Last update timestamp */
46
56
  updated_at: {
47
57
  type: Date,
48
58
  default: Date.now
49
59
  },
50
60
 
61
+ /** Record creation timestamp */
51
62
  created_at: {
52
63
  type: Date,
53
64
  default: Date.now
@@ -55,4 +66,3 @@ const ShopifyAPI = new Schema({
55
66
  })
56
67
 
57
68
  module.exports = ShopifyAPI
58
-
@@ -1,73 +1,87 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Synced Shopify data object (pages, themes, scripts, etc.) */
4
5
  const ShopifyObject = 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 object ID */
11
14
  id: {
12
15
  type: String,
13
16
  trim: true,
14
17
  index: true,
15
18
  },
16
19
 
20
+ /** Object type, e.g. 'page', 'theme', 'script_tag' */
17
21
  type: {
18
22
  type: String,
19
23
  trim: true,
20
24
  index: true,
21
25
  },
22
26
 
27
+ /** Sub-type for further classification */
23
28
  sub_type: {
24
29
  type: String,
25
30
  trim: true,
26
31
  index: true,
27
32
  },
28
33
 
34
+ /** URL-friendly slug */
29
35
  handle: {
30
36
  type: String,
31
37
  trim: true,
32
38
  index: true,
33
39
  },
34
40
 
41
+ /** Display title */
35
42
  title: {
36
43
  type: String,
37
44
  trim: true,
38
45
  },
39
46
 
47
+ /** Content body */
40
48
  body: {
41
49
  type: String,
42
50
  trim: true,
43
51
  },
44
52
 
53
+ /** Raw Shopify data */
45
54
  data: {
46
55
  type: Schema.Types.Mixed,
47
56
  default: {},
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 sync timestamp */
56
67
  synced_at: {
57
68
  type: Date,
58
69
  },
59
70
 
71
+ /** Last update timestamp */
60
72
  updated_at: {
61
73
  type: Date,
62
74
  default: Date.now
63
75
  },
64
76
 
77
+ /** Record creation timestamp */
65
78
  created_at: {
66
79
  type: Date,
67
80
  default: Date.now
68
81
  }
69
82
  })
70
83
 
84
+ /** Compound index for querying by store + type + sub_type */
71
85
  ShopifyObject.index({
72
86
  store: 1,
73
87
  type: 1,
@@ -75,4 +89,3 @@ ShopifyObject.index({
75
89
  })
76
90
 
77
91
  module.exports = ShopifyObject
78
-
@@ -1,51 +1,61 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Short link domain */
4
5
  const ShortDomain = new Schema({
6
+ /** Domain hostname */
5
7
  domain: {
6
8
  type: String,
7
9
  trim: true,
8
10
  index: true,
9
11
  },
10
12
 
13
+ /** Status */
11
14
  status: {
12
15
  type: String,
13
16
  index: true,
14
17
  default: 'active'
15
18
  },
16
19
 
20
+ /** Brand color for UI display */
17
21
  color: {
18
22
  type: String,
19
23
  trim: true,
20
24
  },
21
25
 
26
+ /** Default redirect URL when no slug matches */
22
27
  redirect_to: {
23
28
  type: String,
24
29
  trim: true,
25
30
  },
26
31
 
32
+ /** Whether this domain belongs to a store */
27
33
  is_store: {
28
34
  type: Boolean,
29
35
  default: false,
30
36
  index: true,
31
37
  },
32
38
 
39
+ /** Total click count */
33
40
  clicks_count: {
34
41
  type: Number,
35
42
  default: 0,
36
43
  index: true
37
44
  },
38
45
 
46
+ /** @ref Account — users who can create short links on this domain */
39
47
  users: {
40
48
  type: [Schema.Types.ObjectId],
41
49
  index: true,
42
50
  },
43
51
 
52
+ /** Last update timestamp */
44
53
  updated_at: {
45
54
  type: Date,
46
55
  default: Date.now
47
56
  },
48
57
 
58
+ /** Record creation timestamp */
49
59
  created_at: {
50
60
  type: Date,
51
61
  default: Date.now
@@ -53,4 +63,3 @@ const ShortDomain = new Schema({
53
63
  })
54
64
 
55
65
  module.exports = ShortDomain
56
-
@@ -1,49 +1,59 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Click tracking log for short URLs */
4
5
  const ShortLog = new Schema({
6
+ /** @ref ShortUrl */
5
7
  short: {
6
8
  type: Schema.Types.ObjectId,
7
9
  index: true,
8
10
  required: true,
9
11
  },
10
12
 
13
+ /** Clicked short URL */
11
14
  url: {
12
15
  type: String,
13
16
  trim: true,
14
17
  required: true
15
18
  },
16
19
 
20
+ /** Final destination URL */
17
21
  destination_url: {
18
22
  type: String,
19
23
  trim: true,
20
24
  },
21
25
 
26
+ /** Browser user agent string */
22
27
  user_agent: {
23
28
  type: String,
24
29
  trim: true,
25
30
  },
26
31
 
32
+ /** HTTP referer header */
27
33
  referer: {
28
34
  type: String,
29
35
  trim: true,
30
36
  },
31
37
 
38
+ /** Country code */
32
39
  country: {
33
40
  type: String,
34
41
  trim: true,
35
42
  },
36
43
 
44
+ /** IP address */
37
45
  ip: {
38
46
  type: String,
39
47
  trim: true,
40
48
  },
41
49
 
50
+ /** Visitor type: 'human' or 'bot' */
42
51
  viewer_type: {
43
52
  type: String,
44
53
  trim: true,
45
54
  },
46
55
 
56
+ /** Record creation timestamp */
47
57
  created_at: {
48
58
  type: Date,
49
59
  default: Date.now,
@@ -1,7 +1,9 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Short link (slug + domain → destination URL) */
4
5
  const ShortUrl = new Schema({
6
+ /** Full destination URL */
5
7
  url: {
6
8
  type: String,
7
9
  trim: true,
@@ -9,65 +11,77 @@ const ShortUrl = new Schema({
9
11
  index: true,
10
12
  },
11
13
 
14
+ /** Domain of the destination URL */
12
15
  destination_domain: {
13
16
  type: String,
14
17
  trim: true,
15
18
  index: true,
16
19
  },
17
20
 
21
+ /** Short path segment */
18
22
  slug: {
19
23
  type: String,
20
24
  trim: true,
21
25
  index: true
22
26
  },
23
27
 
28
+ /** Short link domain */
24
29
  domain: {
25
30
  type: String,
26
31
  trim: true,
27
32
  index: true,
28
33
  },
29
34
 
35
+ /** @ref ShortDomain */
30
36
  domain_id: {
31
37
  type: Schema.Types.ObjectId,
32
38
  index: true,
33
39
  },
34
40
 
41
+ /** Status */
35
42
  status: {
36
43
  type: String,
37
44
  index: true,
38
45
  default: 'active'
39
46
  },
40
47
 
48
+ /** @ref Account — last editor */
41
49
  edited_by: {
42
50
  type: Schema.Types.ObjectId,
43
51
  },
44
52
 
53
+ /** @ref Account — creator */
45
54
  created_by: {
46
55
  type: Schema.Types.ObjectId,
47
56
  index: true,
48
57
  },
49
58
 
59
+ /** Total click count */
50
60
  clicks_count: {
51
61
  type: Number,
52
62
  default: 0
53
63
  },
54
64
 
65
+ /** Clicks removed (e.g. bot clicks cleaned up) */
55
66
  deleted_clicks: {
56
67
  type: Number,
57
68
  default: 0
58
69
  },
59
70
 
71
+ /** Last update timestamp */
60
72
  updated_at: {
61
73
  type: Date,
62
74
  default: Date.now
63
75
  },
64
76
 
77
+ /** Record creation timestamp */
65
78
  created_at: {
66
79
  type: Date,
67
80
  default: Date.now
68
81
  }
69
82
  })
70
83
 
84
+ /** Compound index: unique short link per slug + domain */
71
85
  ShortUrl.index({
72
86
  slug: 1,
73
87
  domain: 1
package/schemas/Store.js CHANGED
@@ -1,40 +1,52 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Main store entity */
4
5
  const Store = new Schema({
6
+ /** Display name */
5
7
  name: {
6
8
  type: String,
7
9
  trim: true,
8
10
  },
9
11
 
12
+ /** Store subdomain (e.g. 'mystore' for mystore.pintahub.com) */
10
13
  subdomain: {
11
14
  type: String,
12
15
  trim: true,
13
16
  index: true,
14
17
  },
15
18
 
19
+ /** Custom primary domain */
16
20
  primary_domain: {
17
21
  type: String,
18
22
  trim: true,
19
23
  index: true,
20
24
  },
21
25
 
26
+ /** Store number identifier */
22
27
  number: {
23
28
  type: String,
24
29
  trim: true,
25
30
  index: true,
26
31
  },
27
32
 
33
+ /** Checkout page domain */
28
34
  checkout_domain: {
29
35
  type: String,
30
36
  trim: true,
31
37
  },
32
38
 
39
+ /** Shopify shop ID */
33
40
  shop_id: {
34
41
  type: String,
35
42
  trim: true,
36
43
  },
37
44
 
45
+ /**
46
+ * Store status:
47
+ * - active: store is live
48
+ * - inactive: store is disabled
49
+ */
38
50
  status: {
39
51
  type: String,
40
52
  default: 'active',
@@ -42,36 +54,43 @@ const Store = new Schema({
42
54
  index: true
43
55
  },
44
56
 
57
+ /** @ref StoreSetting */
45
58
  setting: {
46
59
  type: Schema.Types.ObjectId,
47
60
  },
48
61
 
62
+ /** Maintenance mode message (null = not in maintenance) */
49
63
  maintenance_mode: {
50
64
  type: String,
51
65
  trim: true
52
66
  },
53
67
 
68
+ /** SEO indexing: 'enabled' or 'disabled' */
54
69
  search_engine_indexing: {
55
70
  type: String,
56
71
  trim: true,
57
72
  default: 'enabled',
58
73
  },
59
74
 
75
+ /** @ref Account — users with access to this store */
60
76
  users: {
61
77
  type: [Schema.Types.ObjectId],
62
78
  index: true,
63
79
  },
64
80
 
81
+ /** Shopify Shop app ID */
65
82
  shop_app_id: {
66
83
  type: String,
67
84
  trim: true,
68
85
  },
69
86
 
87
+ /** Last update timestamp */
70
88
  updated_at: {
71
89
  type: Date,
72
90
  default: Date.now
73
91
  },
74
92
 
93
+ /** Record creation timestamp */
75
94
  created_at: {
76
95
  type: Date,
77
96
  default: Date.now
@@ -79,4 +98,3 @@ const Store = new Schema({
79
98
  })
80
99
 
81
100
  module.exports = Store
82
-
@@ -1,24 +1,29 @@
1
1
  const {Schema} = require('mongoose')
2
2
 
3
3
 
4
+ /** Store activity event (analytics tracking) */
4
5
  const StoreEvent = 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
+ /** @ref Product — related product (if applicable) */
11
14
  product: {
12
15
  type: Schema.Types.ObjectId,
13
16
  index: true,
14
17
  },
15
18
 
19
+ /** Visitor session identifier */
16
20
  session_id: {
17
21
  type: String,
18
22
  trim: true,
19
23
  index: true,
20
24
  },
21
25
 
26
+ /** Event name, e.g. 'page_view', 'add_to_cart', 'purchase' */
22
27
  name: {
23
28
  type: String,
24
29
  trim: true,
@@ -26,15 +31,18 @@ const StoreEvent = new Schema({
26
31
  index: true,
27
32
  },
28
33
 
34
+ /** URL */
29
35
  url: {
30
36
  type: String,
31
37
  trim: true,
32
38
  },
33
39
 
40
+ /** IP address */
34
41
  ip: {
35
42
  type: String,
36
43
  },
37
44
 
45
+ /** ISO country code (uppercase) */
38
46
  country: {
39
47
  type: String,
40
48
  trim: true,
@@ -42,28 +50,33 @@ const StoreEvent = new Schema({
42
50
  uppercase: true,
43
51
  },
44
52
 
53
+ /** Browser user agent string */
45
54
  user_agent: {
46
55
  type: String,
47
56
  trim: true,
48
57
  },
49
58
 
59
+ /** Extra event metadata */
50
60
  meta: {
51
61
  type: Schema.Types.Mixed,
52
62
  default: {}
53
63
  },
54
64
 
65
+ /** Visitor type: 'human' or 'bot' */
55
66
  viewer_type: {
56
67
  type: String,
57
68
  trim: true,
58
69
  default: 'human'
59
70
  },
60
71
 
72
+ /** HTTP referrer domain */
61
73
  referrer_domain: {
62
74
  type: String,
63
75
  trim: true,
64
76
  index: true,
65
77
  },
66
78
 
79
+ /** Record creation timestamp */
67
80
  created_at: {
68
81
  type: Date,
69
82
  default: Date.now,
@@ -73,4 +86,3 @@ const StoreEvent = new Schema({
73
86
 
74
87
 
75
88
  module.exports = StoreEvent
76
-