[feat] implemented product variants
This commit is contained in:
@@ -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 || "",
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user