@zeyolabs/shopping 2026.11.46 → 2026.11.47
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/db/schema.ts +38 -30
- package/package.json +1 -1
package/db/schema.ts
CHANGED
|
@@ -26,35 +26,39 @@ export const variationGroups = sqliteTable('variation_groups', {
|
|
|
26
26
|
name: text('name').notNull(),
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
export const products = sqliteTable(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
29
|
+
export const products = sqliteTable(
|
|
30
|
+
'products',
|
|
31
|
+
{
|
|
32
|
+
active: integer('active', { mode: 'boolean' }).notNull().default(true),
|
|
33
|
+
/** Pre-discount price shown struck through, when higher than `pricePence`. */
|
|
34
|
+
comparePricePence: integer('compare_price_pence'),
|
|
35
|
+
createdAt: integer('created_at').notNull(),
|
|
36
|
+
description: text('description').notNull().default(''),
|
|
37
|
+
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
38
|
+
/** Show "only N left" when the sellable count is at or below this. Null: never. */
|
|
39
|
+
lowStockThreshold: integer('low_stock_threshold'),
|
|
40
|
+
massGrams: integer('mass_grams').notNull().default(0),
|
|
41
|
+
maxPerOrder: integer('max_per_order').notNull().default(10),
|
|
42
|
+
name: text('name').notNull(),
|
|
43
|
+
/** Single units sold together as one purchase; `stock` is held in single units. */
|
|
44
|
+
packSize: integer('pack_size').notNull().default(1),
|
|
45
|
+
pricePence: integer('price_pence').notNull(),
|
|
46
|
+
/** When the product last went from not sellable to sellable (set by `StockService.setStock`). */
|
|
47
|
+
restockedAt: integer('restocked_at'),
|
|
48
|
+
shortDescription: text('short_description').notNull().default(''),
|
|
49
|
+
sku: text('sku').notNull().unique(),
|
|
50
|
+
slug: text('slug').notNull().unique(),
|
|
51
|
+
/** Purchases counted when an order is paid. */
|
|
52
|
+
sold: integer('sold').notNull().default(0),
|
|
53
|
+
sortOrder: integer('sort_order').notNull().default(0),
|
|
54
|
+
/** Units in stock, in single units (a product sold in packs of 10 with 30 in stock sells 3). */
|
|
55
|
+
stock: integer('stock').notNull().default(0),
|
|
56
|
+
variationGroupId: integer('variation_group_id').references(() => variationGroups.id),
|
|
57
|
+
/** This product's option within its variation group, e.g. "Black". */
|
|
58
|
+
variationLabel: text('variation_label'),
|
|
59
|
+
},
|
|
60
|
+
(t) => [index('products_variation_group_idx').on(t.variationGroupId)]
|
|
61
|
+
);
|
|
58
62
|
|
|
59
63
|
/**
|
|
60
64
|
* A combined product is made of other products: it has no stock of its own, and what can be sold is
|
|
@@ -108,7 +112,11 @@ export const productCategories = sqliteTable(
|
|
|
108
112
|
.notNull()
|
|
109
113
|
.references(() => products.id),
|
|
110
114
|
},
|
|
111
|
-
(t) => [
|
|
115
|
+
(t) => [
|
|
116
|
+
primaryKey({ columns: [t.productId, t.categoryId] }),
|
|
117
|
+
// A category page looks up its products by category.
|
|
118
|
+
index('product_categories_category_idx').on(t.categoryId, t.productId),
|
|
119
|
+
]
|
|
112
120
|
);
|
|
113
121
|
|
|
114
122
|
/** File names in the R2 bucket (products/<file>). The lowest position is the cover. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeyolabs/shopping",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.47",
|
|
4
4
|
"description": "Shop and order fulfilment for SvelteKit 3 on Cloudflare: catalogue, basket, Stripe Checkout, orders, Royal Mail Click & Drop, order emails, packing, pages and admin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|