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,
|
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 };
|
||||||
|
|||||||
@@ -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)`,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user