test(18-02): add failing tests for global item service and seed

- 10 test cases covering search, owner count, link/unlink, seed idempotency
- Added globalItems/itemGlobalLinks tables to SQLite schema
- Added Zod schemas and types for global items
- Created 18-item bikepacking gear seed data JSON
This commit is contained in:
2026-04-05 13:05:28 +02:00
parent f7c9f3dc94
commit 3a6876f7e8
8 changed files with 1393 additions and 0 deletions

View File

@@ -127,6 +127,31 @@ export const apiKeys = sqliteTable("api_keys", {
.$defaultFn(() => new Date()),
});
export const globalItems = sqliteTable("global_items", {
id: integer("id").primaryKey({ autoIncrement: true }),
brand: text("brand").notNull(),
model: text("model").notNull(),
category: text("category"),
weightGrams: real("weight_grams"),
priceCents: integer("price_cents"),
imageUrl: text("image_url"),
description: text("description"),
createdAt: integer("created_at", { mode: "timestamp" })
.notNull()
.$defaultFn(() => new Date()),
});
export const itemGlobalLinks = sqliteTable("item_global_links", {
id: integer("id").primaryKey({ autoIncrement: true }),
itemId: integer("item_id")
.notNull()
.references(() => items.id, { onDelete: "cascade" })
.unique(),
globalItemId: integer("global_item_id")
.notNull()
.references(() => globalItems.id, { onDelete: "cascade" }),
});
export const oauthClients = sqliteTable("oauth_clients", {
id: integer("id").primaryKey({ autoIncrement: true }),
clientId: text("client_id").notNull().unique(),