[feat] implemented product variants

This commit is contained in:
2026-02-23 19:05:55 -05:00
parent 30433696e5
commit 240e4ce88b
6 changed files with 52 additions and 15 deletions

View File

@@ -15,12 +15,12 @@ export const partial = true;
export const prerender = false;
const searchParams = Astro.url.searchParams;
const productId = Number(searchParams.get('productId')) || 0;
const cardId = Number(searchParams.get('cardId')) || 0;
// query the database for the card with the given productId and return the card data as json
const card = await db.query.cards.findFirst({
where: { productId: Number(productId) },
where: { cardId: Number(cardId) },
with: {
prices: true,
set: true,
@@ -29,7 +29,8 @@ const card = await db.query.cards.findFirst({
const nearMint = await db.query.skus.findFirst({
where: {
productId: Number(productId),
productId: card?.productId || 0,
variant: card?.variant || "",
}
});