From 2beabe88f95be00e96c5e0331654c94f5be77ce1 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Mon, 13 Apr 2026 15:07:38 +0200 Subject: [PATCH] fix: popular-items query referenced non-existent imageFilename on globalItems Co-Authored-By: Claude Opus 4.6 (1M context) --- src/server/routes/discovery.ts | 4 +--- src/server/services/discovery.service.ts | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/server/routes/discovery.ts b/src/server/routes/discovery.ts index 5ae4758..bf60099 100644 --- a/src/server/routes/discovery.ts +++ b/src/server/routes/discovery.ts @@ -5,7 +5,6 @@ import { getRecentGlobalItems, getTrendingCategories, } from "../services/discovery.service.ts"; -import { withImageUrls } from "../services/storage.service.ts"; type Env = { Variables: { db?: any } }; @@ -52,8 +51,7 @@ app.get("/popular-items", async (c) => { } const results = await getPopularItemsByTags(db, tagNames, limit); - const enriched = await withImageUrls(results); - return c.json({ items: enriched }); + return c.json({ items: results }); }); export { app as discoveryRoutes }; diff --git a/src/server/services/discovery.service.ts b/src/server/services/discovery.service.ts index e6e4451..cd41697 100644 --- a/src/server/services/discovery.service.ts +++ b/src/server/services/discovery.service.ts @@ -150,7 +150,7 @@ export async function getPopularItemsByTags( category: string | null; weightGrams: number | null; priceCents: number | null; - imageFilename: string | null; + imageUrl: string | null; description: string | null; ownerCount: number; }> @@ -165,7 +165,7 @@ export async function getPopularItemsByTags( category: globalItems.category, weightGrams: globalItems.weightGrams, priceCents: globalItems.priceCents, - imageFilename: globalItems.imageFilename, + imageUrl: globalItems.imageUrl, description: globalItems.description, ownerCount: sql`CAST(COUNT(DISTINCT ${items.id}) AS INT)`, })