enzostvs's picture
enzostvs HF Staff
replace prisma blob saved with datasets
7e19cbb
raw
history blame
623 Bytes
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
export async function POST(request: Request) {
const { ids, page } = await request.json()
const collections = await prisma.collection.findMany({
orderBy: {
id: 'desc'
},
where: {
id: {
in: ids,
}
},
take: 15,
skip: page * 15
})
const total = await prisma.collection.count()
return Response.json(
{
collections,
pagination: {
total,
page: page + 1,
total_pages: Math.ceil(total / 15)
},
status: 200,
ok: true
}
)
}