[feat] Set relationship added and displayed

This commit is contained in:
2026-02-17 07:08:02 -05:00
parent 1a95eb93b0
commit f990d70540
2 changed files with 10 additions and 2 deletions

View File

@@ -10,7 +10,13 @@ export const relations = defineRelations(schema, (r) => ({
}, },
cards: { cards: {
prices: r.many.skus(), prices: r.many.skus(),
set: r.one.sets({
from: r.cards.setId,
to: r.sets.setId,
}),
},
sets: {
cards: r.many.cards(),
}, },
})); }));

View File

@@ -13,6 +13,7 @@ const pokemon = await db.query.cards.findMany({
limit: 320, limit: 320,
with: { with: {
prices: true, prices: true,
set: true,
} }
}); });
@@ -42,11 +43,12 @@ const order = ["Near Mint", "Lightly Played", "Moderately Played", "Heavily Play
{pokemon.map((card) => ( {pokemon.map((card) => (
<div class="col"> <div class="col">
<img src={`/cards/${card.productId}.jpg`} alt={card.productName} class="w-100 img-fluid rounded-4 mb-2" /> <img src={`/cards/${card.productId}.jpg`} alt={card.productName} class="w-100 img-fluid rounded-4 mb-2" />
<div class="col-auto h6 my-0">{card.productName}</div> <div class="h6 my-0">{card.productName}</div>
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="copy-small">{card.number}</div> <div class="copy-small">{card.number}</div>
<RarityIcon rarity={card.rarityName} /> <RarityIcon rarity={card.rarityName} />
</div> </div>
<div>{card.set?.setName}</div>
<div class="row row-cols-5 gx-1 mt-1"> <div class="row row-cols-5 gx-1 mt-1">
{card.prices {card.prices
.slice() .slice()