mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
last added fix
This commit is contained in:
parent
ba3d59e0f2
commit
3c7d25f574
1 changed files with 3 additions and 3 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue