diff --git a/scripts/pokemon-helper.ts b/scripts/pokemon-helper.ts index 9db7ff3..67f0e4e 100644 --- a/scripts/pokemon-helper.ts +++ b/scripts/pokemon-helper.ts @@ -234,4 +234,7 @@ where not exists (select 1 from cards where product_id=t.product_id and variant= `); console.log(`Inserted ${inserts.rowCount} rows into cards table`); + const skuUpdates = await db.execute(sql`update skus s set card_id = c.card_id from cards c where s.product_id = c.product_id and s.variant = c.variant and s.card_id is distinct from c.card_id`); + console.log(`Updated ${skuUpdates.rowCount} rows in skus table`); + } diff --git a/scripts/preload-tcgplayer.ts b/scripts/preload-tcgplayer.ts index ef9931f..6a5fec4 100644 --- a/scripts/preload-tcgplayer.ts +++ b/scripts/preload-tcgplayer.ts @@ -204,9 +204,9 @@ async function syncProductLine(productLine: string, field: string, fieldValue: s }, }); - console.log(`item: ${item.setId}\tdetail: ${detailData.setId}`); - console.log(`item: ${item.setCode}\tdetail: ${detailData.setCode}`); - console.log(`item: ${item.setName}\tdetail: ${detailData.setName}`); + // console.log(`item: ${item.setId}\tdetail: ${detailData.setId}`); + // console.log(`item: ${item.setCode}\tdetail: ${detailData.setCode}`); + // console.log(`item: ${item.setName}\tdetail: ${detailData.setName}`); // set is... await db.insert(schema.sets).values({ setId: detailData.setId, @@ -242,7 +242,7 @@ async function syncProductLine(productLine: string, field: string, fieldValue: s } // get image if it doesn't already exist - const imagePath = path.join(process.cwd(), 'public', 'cards', `${item.productId}.jpg`); + const imagePath = path.join(process.cwd(), 'static', 'cards', `${item.productId}.jpg`); if (!await helper.FileExists(imagePath)) { const imageResponse = await fetch(`https://tcgplayer-cdn.tcgplayer.com/product/${item.productId}_in_1000x1000.jpg`); if (imageResponse.ok) {