refactored 404 page, fixed copy image toast on mobile and filtered missing images to exclude sealed

This commit is contained in:
zach
2026-03-12 13:40:12 -04:00
parent c10e34cc34
commit 835a174da2
5 changed files with 242 additions and 178 deletions

View File

@@ -1,18 +1,22 @@
import * as schema from '../src/db/schema.ts';
import { db, ClosePool } from '../src/db/index.ts';
import { sql } from "drizzle-orm";
import fs from "node:fs/promises";
import path from "node:path";
async function findMissingImages() {
const cards = await db.select().from(schema.tcgcards);
const cards = await db
.select()
.from(schema.tcgcards)
.where(sql`${schema.tcgcards.sealed} = false`);
const missingImages: string[] = [];
for (const card of cards) {
const imagePath = path.join(process.cwd(), 'public', 'cards', `${card.productId}.jpg`);
try {
await fs.access(imagePath);
} catch (err) {
missingImages.push(`${card.productId}\t${card.productName}\t${card.number}`);
missingImages.push(`${card.productId}\t${card.setId}\t${card.productName}\t${card.number}`);
}
}
return missingImages;