portfolio/lib/views.ts

13 lines
278 B
TypeScript
Raw Normal View History

2023-01-28 21:59:01 +00:00
import {prisma} from '@/lib/prisma'
export async function getViews() {
const totalViews: { _sum: { count: any } } = await prisma.views.aggregate({
_sum: {
count: true
}
})
return {
views: totalViews._sum.count.toString()
}
}