feat: ratings ui, import giantbomb ratings

This commit is contained in:
DecDuck
2025-05-30 22:07:50 +10:00
parent 185f37f135
commit 3fbe514f65
7 changed files with 64 additions and 25 deletions

View File

@ -22,5 +22,17 @@ export default defineEventHandler(async (h3) => {
if (!game)
throw createError({ statusCode: 404, statusMessage: "Game not found" });
return game;
const rating = await prisma.gameRating.aggregate({
where: {
gameId: game.id,
},
_avg: {
mReviewRating: true,
},
_sum: {
mReviewCount: true,
},
});
return { game, rating };
});