fix: popular-items query referenced non-existent imageFilename on globalItems
All checks were successful
CI / ci (push) Successful in 1m17s
CI / e2e (push) Has been skipped
CI / deploy (push) Successful in 16s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 15:07:38 +02:00
parent 29f925027c
commit 2beabe88f9
2 changed files with 3 additions and 5 deletions

View File

@@ -5,7 +5,6 @@ import {
getRecentGlobalItems, getRecentGlobalItems,
getTrendingCategories, getTrendingCategories,
} from "../services/discovery.service.ts"; } from "../services/discovery.service.ts";
import { withImageUrls } from "../services/storage.service.ts";
type Env = { Variables: { db?: any } }; type Env = { Variables: { db?: any } };
@@ -52,8 +51,7 @@ app.get("/popular-items", async (c) => {
} }
const results = await getPopularItemsByTags(db, tagNames, limit); const results = await getPopularItemsByTags(db, tagNames, limit);
const enriched = await withImageUrls(results); return c.json({ items: results });
return c.json({ items: enriched });
}); });
export { app as discoveryRoutes }; export { app as discoveryRoutes };

View File

@@ -150,7 +150,7 @@ export async function getPopularItemsByTags(
category: string | null; category: string | null;
weightGrams: number | null; weightGrams: number | null;
priceCents: number | null; priceCents: number | null;
imageFilename: string | null; imageUrl: string | null;
description: string | null; description: string | null;
ownerCount: number; ownerCount: number;
}> }>
@@ -165,7 +165,7 @@ export async function getPopularItemsByTags(
category: globalItems.category, category: globalItems.category,
weightGrams: globalItems.weightGrams, weightGrams: globalItems.weightGrams,
priceCents: globalItems.priceCents, priceCents: globalItems.priceCents,
imageFilename: globalItems.imageFilename, imageUrl: globalItems.imageUrl,
description: globalItems.description, description: globalItems.description,
ownerCount: sql<number>`CAST(COUNT(DISTINCT ${items.id}) AS INT)`, ownerCount: sql<number>`CAST(COUNT(DISTINCT ${items.id}) AS INT)`,
}) })