diff --git a/scripts/check-photos-display.ts b/scripts/check-photos-display.ts deleted file mode 100644 index 9514e8c..0000000 --- a/scripts/check-photos-display.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { PrismaClient } from '@prisma/client' - -const prisma = new PrismaClient() - -async function checkPhotosDisplay() { - try { - console.log('=== Checking Photos Display ===\n') - - // Check albums marked for photography - const photographyAlbums = await prisma.album.findMany({ - where: { - status: 'published', - isPhotography: true - }, - include: { - photos: { - where: { - status: 'published' - } - } - } - }) - - console.log(`Found ${photographyAlbums.length} published photography albums:`) - photographyAlbums.forEach((album) => { - console.log(`- "${album.title}" (${album.slug}): ${album.photos.length} published photos`) - }) - - // Check individual photos marked to show in photos - const individualPhotos = await prisma.photo.findMany({ - where: { - status: 'published', - showInPhotos: true, - albumId: null - } - }) - - console.log(`\nFound ${individualPhotos.length} individual photos marked to show in Photos`) - individualPhotos.forEach((photo) => { - console.log(`- Photo ID ${photo.id}: ${photo.filename}`) - }) - - // Check if there are any published photos in albums - const photosInAlbums = await prisma.photo.findMany({ - where: { - status: 'published', - showInPhotos: true, - albumId: { not: null } - }, - include: { - album: true - } - }) - - console.log( - `\nFound ${photosInAlbums.length} published photos in albums with showInPhotos=true` - ) - const albumGroups = photosInAlbums.reduce( - (acc, photo) => { - const albumTitle = photo.album?.title || 'Unknown' - acc[albumTitle] = (acc[albumTitle] || 0) + 1 - return acc - }, - {} as Record - ) - - Object.entries(albumGroups).forEach(([album, count]) => { - console.log(`- Album "${album}": ${count} photos`) - }) - - // Check media marked as photography - const photographyMedia = await prisma.media.findMany({ - where: { - isPhotography: true - } - }) - - console.log(`\nFound ${photographyMedia.length} media items marked as photography`) - - // Check for any photos regardless of status - const allPhotos = await prisma.photo.findMany({ - include: { - album: true - } - }) - - console.log(`\nTotal photos in database: ${allPhotos.length}`) - const statusCounts = allPhotos.reduce( - (acc, photo) => { - acc[photo.status] = (acc[photo.status] || 0) + 1 - return acc - }, - {} as Record - ) - - Object.entries(statusCounts).forEach(([status, count]) => { - console.log(`- Status "${status}": ${count} photos`) - }) - - // Check all albums - const allAlbums = await prisma.album.findMany({ - include: { - _count: { - select: { photos: true } - } - } - }) - - console.log(`\nTotal albums in database: ${allAlbums.length}`) - allAlbums.forEach((album) => { - console.log( - `- "${album.title}" (${album.slug}): status=${album.status}, isPhotography=${album.isPhotography}, photos=${album._count.photos}` - ) - }) - } catch (error) { - console.error('Error checking photos:', error) - } finally { - await prisma.$disconnect() - } -} - -checkPhotosDisplay() diff --git a/scripts/test-photos-query.ts b/scripts/test-photos-query.ts deleted file mode 100644 index f229105..0000000 --- a/scripts/test-photos-query.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { PrismaClient } from '@prisma/client' -import 'dotenv/config' - -const prisma = new PrismaClient() - -async function testPhotoQueries() { - console.log('=== Testing Photo Queries ===\n') - - try { - // Query 1: Count all photos - const totalPhotos = await prisma.photo.count() - console.log(`Total photos in database: ${totalPhotos}`) - - // Query 2: Photos with showInPhotos=true and albumId=null - const photosForDisplay = await prisma.photo.findMany({ - where: { - showInPhotos: true, - albumId: null - }, - select: { - id: true, - slug: true, - filename: true, - status: true, - showInPhotos: true, - albumId: true, - publishedAt: true, - createdAt: true - } - }) - - console.log(`\nPhotos with showInPhotos=true and albumId=null: ${photosForDisplay.length}`) - photosForDisplay.forEach((photo) => { - console.log( - ` - ID: ${photo.id}, Status: ${photo.status}, Slug: ${photo.slug || 'none'}, File: ${photo.filename}` - ) - }) - - // Query 3: Check status distribution - const statusCounts = await prisma.photo.groupBy({ - by: ['status'], - where: { - showInPhotos: true, - albumId: null - }, - _count: { - id: true - } - }) - - console.log('\nStatus distribution for photos with showInPhotos=true and albumId=null:') - statusCounts.forEach(({ status, _count }) => { - console.log(` - ${status}: ${_count.id}`) - }) - - // Query 4: Published photos that should appear - const publishedPhotos = await prisma.photo.findMany({ - where: { - status: 'published', - showInPhotos: true, - albumId: null - } - }) - - console.log( - `\nPublished photos (status='published', showInPhotos=true, albumId=null): ${publishedPhotos.length}` - ) - publishedPhotos.forEach((photo) => { - console.log(` - ID: ${photo.id}, File: ${photo.filename}, Published: ${photo.publishedAt}`) - }) - - // Query 5: Check if there are any draft photos that might need publishing - const draftPhotos = await prisma.photo.findMany({ - where: { - status: 'draft', - showInPhotos: true, - albumId: null - } - }) - - if (draftPhotos.length > 0) { - console.log(`\n⚠️ Found ${draftPhotos.length} draft photos with showInPhotos=true:`) - draftPhotos.forEach((photo) => { - console.log(` - ID: ${photo.id}, File: ${photo.filename}`) - }) - console.log('These photos need to be published to appear in the photos page!') - } - - // Query 6: Check unique statuses in the database - const uniqueStatuses = await prisma.photo.findMany({ - distinct: ['status'], - select: { - status: true - } - }) - - console.log('\nAll unique status values in the database:') - uniqueStatuses.forEach(({ status }) => { - console.log(` - "${status}"`) - }) - } catch (error) { - console.error('Error running queries:', error) - } finally { - await prisma.$disconnect() - } -} - -// Run the test -testPhotoQueries() diff --git a/src/lib/components/PhotoGrid.svelte b/src/lib/components/PhotoGrid.svelte deleted file mode 100644 index 156f50e..0000000 --- a/src/lib/components/PhotoGrid.svelte +++ /dev/null @@ -1,41 +0,0 @@ - - -
-
- {#each photoItems as item} - - {/each} -
-
- - diff --git a/src/routes/photos/[slug]/+page.svelte b/src/routes/photos/[slug]/+page.svelte index db1e9b3..ebb6be0 100644 --- a/src/routes/photos/[slug]/+page.svelte +++ b/src/routes/photos/[slug]/+page.svelte @@ -1,5 +1,5 @@