From ae7605ad4a08ed3b72f929f48115c911c4a597a8 Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Thu, 10 Apr 2025 17:47:20 -0600 Subject: [PATCH 1/3] Nullable album createdAt --- .../20250410234700_nullable_album_created_at/migration.sql | 2 ++ prisma/schema.prisma | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 prisma/migrations/20250410234700_nullable_album_created_at/migration.sql diff --git a/prisma/migrations/20250410234700_nullable_album_created_at/migration.sql b/prisma/migrations/20250410234700_nullable_album_created_at/migration.sql new file mode 100644 index 0000000..10f8397 --- /dev/null +++ b/prisma/migrations/20250410234700_nullable_album_created_at/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE `albums` MODIFY `createdAt` DATETIME(0) NULL DEFAULT CURRENT_TIMESTAMP(0); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 8db3389..1f2a85a 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -130,7 +130,7 @@ model albums { releaseDate DateTime? @db.Date label String? @db.VarChar(255) vgmdb String? @db.VarChar(255) - createdAt DateTime @default(now()) @db.DateTime(0) + createdAt DateTime? @default(now()) @db.DateTime(0) updatedAt DateTime @default(now()) @db.DateTime(0) publishedAt DateTime @default(now()) description String? @db.VarChar(255) From eb1763215473dcf900df3649d13e0b14a4599b11 Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Thu, 10 Apr 2025 18:25:16 -0600 Subject: [PATCH 2/3] Ensure alt property is provided in image --- src/pages/500.astro | 2 +- src/pages/album/[id].astro | 4 ++-- src/pages/api/album/delete.ts | 2 +- src/pages/maintenance.astro | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/500.astro b/src/pages/500.astro index 1075646..39f623c 100644 --- a/src/pages/500.astro +++ b/src/pages/500.astro @@ -10,6 +10,6 @@ import GuraGif from '../img/assets/doggo-thumbs-up.gif'
Something went wrong.... yubi yubi
- Gawr Gura roomba +
diff --git a/src/pages/album/[id].astro b/src/pages/album/[id].astro index 9734563..a9e0f70 100644 --- a/src/pages/album/[id].astro +++ b/src/pages/album/[id].astro @@ -287,7 +287,7 @@ const coverImage = await getImage({ width={130} height={50} style={{ height: 'auto', width: '130px' }} - alt={provider} + alt={provider ?? 'Store icon'} src={`/img/provider/${provider}.jpg`} /> @@ -317,7 +317,7 @@ const coverImage = await getImage({ class='rounded-md' width={30} height={30} - alt={provider} + alt={provider ?? 'Provider'} src={`/img/provider/${provider}.png`} /> diff --git a/src/pages/api/album/delete.ts b/src/pages/api/album/delete.ts index 0871f0c..d41cccb 100644 --- a/src/pages/api/album/delete.ts +++ b/src/pages/api/album/delete.ts @@ -14,7 +14,7 @@ export const POST: APIRoute = async ({ request, locals }) => { let body try { - const formData = await parseForm(request) + const formData = await parseForm(await request.formData()) body = s.create(formData, DeleteAlbum) await prismaClient.albums.findUniqueOrThrow({ where: { id: body.albumId }, select: { id: true } }) } catch (err) { diff --git a/src/pages/maintenance.astro b/src/pages/maintenance.astro index 85a6a10..9e35194 100644 --- a/src/pages/maintenance.astro +++ b/src/pages/maintenance.astro @@ -14,6 +14,6 @@ import GuraGif from '../img/assets/doggo-thumbs-up.gif' >our Discord Server for updates - Gawr Gura roomba + From 88ef4c70609569027932b35038a6fa995a612360 Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Thu, 10 Apr 2025 18:37:24 -0600 Subject: [PATCH 3/3] Handle out of index last-added pages --- src/components/lastAdded/FooterNav.astro | 2 +- src/layouts/PaginatedAlbumList.astro | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/lastAdded/FooterNav.astro b/src/components/lastAdded/FooterNav.astro index edbdb65..8c8682b 100644 --- a/src/components/lastAdded/FooterNav.astro +++ b/src/components/lastAdded/FooterNav.astro @@ -17,7 +17,7 @@ fullPageList.forEach((n) => { }) const currentListIndex = pageList.findIndex((l) => l.includes(page)) -const currentList = pageList[currentListIndex] +const currentList = pageList[currentListIndex] ?? [] ---
    diff --git a/src/layouts/PaginatedAlbumList.astro b/src/layouts/PaginatedAlbumList.astro index b1488b3..ad22422 100644 --- a/src/layouts/PaginatedAlbumList.astro +++ b/src/layouts/PaginatedAlbumList.astro @@ -13,16 +13,12 @@ import DefaultSEO from 'components/DefaultSEO.astro' import FooterNav from 'components/lastAdded/FooterNav.astro' const { albums, limitMD, limitXS, ...listProps } = Astro.props - -if (albums.length === 0) { - Astro.redirect('/404') -} ---
    -
    +