last added fix

This commit is contained in:
Jorge Vargas 2025-04-03 21:30:13 -06:00
parent ba3d59e0f2
commit 3c7d25f574

View file

@ -5,18 +5,18 @@ import { AlbumStatus } from '@prisma/client'
import PaginatedAlbumList from 'layouts/PaginatedAlbumList.astro' import PaginatedAlbumList from 'layouts/PaginatedAlbumList.astro'
const page = Math.max(1, parseInt(Astro.params.page ?? '1')); const page = Math.max(1, parseInt(Astro.params.page ?? '1'))
const take = 50 const take = 50
const limitMD = 12 const limitMD = 12
const limitXS = 5 const limitXS = 5
const albums = await prismaClient.albums.findMany({ const albums = await prismaClient.albums.findMany({
where: { status: AlbumStatus.SHOW }, where: { status: AlbumStatus.SHOW },
select: { id: true, title: true, publishedAt: true }, select: { id: true, title: true },
take, take,
skip: take * (page - 1), skip: take * (page - 1),
orderBy: { publishedAt: 'desc' } orderBy: { publishedAt: 'desc' }
}); })
const count = await prismaClient.albums.count({ where: { status: AlbumStatus.SHOW } }) const count = await prismaClient.albums.count({ where: { status: AlbumStatus.SHOW } })
const fullPageList = [...Array(Math.ceil(count / take))].map((v, i) => i + 1) const fullPageList = [...Array(Math.ceil(count / take))].map((v, i) => i + 1)