Read: Aggregate and GroupBy

const aggregations = await prisma.post.aggregate({
	_sum: { 
		likeNum: true 
	},
	_avg: { 
		likeNum: true 
	},
	_count: { 
		id: true 
	},
	_max: { 
		likeNum: true 
	},
	_min: { 
		likeNum: true 
	},
})
const groupPosts = await prisma.post.groupBy({
	by: ["authorId"],
	_sum: { 
		likeNum: true 
	},
	_avg: { 
		likeNum: true 
	},
	_count: { 
		id: true 
	},
	_max: { 
		likeNum: true 
	},
	_min: { 
		likeNum: true 
	},
})