mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-13 16:22:39 +10:00
fix: return user library for client
This commit is contained in:
@ -1,8 +1,9 @@
|
|||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
import userLibraryManager from "~/server/internal/userlibrary";
|
||||||
|
|
||||||
export default defineClientEventHandler(async (h3) => {
|
export default defineClientEventHandler(async (h3, { fetchUser }) => {
|
||||||
// TODO return the user's library
|
const user = await fetchUser();
|
||||||
const games = await prisma.game.findMany({});
|
const library = await userLibraryManager.fetchLibrary(user.id);
|
||||||
return games;
|
return library.entries.map((e) => e.game);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user