feat(store): new endpoints, ui and beginnings of main store page

This commit is contained in:
DecDuck
2024-11-23 21:29:24 +11:00
parent 9c2249ed08
commit 9cbdcbcdf6
13 changed files with 272 additions and 83 deletions

View File

@ -1,36 +0,0 @@
import prisma from "~/server/internal/db/database";
export default defineEventHandler(async (h3) => {
const userId = await h3.context.session.getUserId(h3);
if (!userId) throw createError({ statusCode: 403 });
const rawGames = await prisma.game.findMany({
select: {
id: true,
mName: true,
mShortDescription: true,
mCoverId:true,
mDevelopers: {
select: {
id: true,
mName: true,
},
},
mPublishers: {
select: {
id: true,
mName: true,
},
},
versions: {
select: {
platform: true,
},
},
},
});
const games = rawGames.map((e) => ({...e, platforms: e.versions.map((e) => e.platform).filter((e, _, r) => !r.includes(e))}))
return games;
});