fix: popular-items query referenced non-existent imageFilename on globalItems
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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 };
|
||||
|
||||
@@ -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<number>`CAST(COUNT(DISTINCT ${items.id}) AS INT)`,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user