mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 08:41:15 +10:00
24 lines
546 B
TypeScript
24 lines
546 B
TypeScript
import prisma from "~/server/internal/db/database";
|
|
import libraryManager from "~/server/internal/library";
|
|
|
|
export default defineEventHandler(async (h3) => {
|
|
const user = await h3.context.session.getAdminUser(h3);
|
|
if (!user) throw createError({ statusCode: 403 });
|
|
|
|
const query = getQuery(h3);
|
|
const gameId = query.id?.toString();
|
|
if (!gameId)
|
|
throw createError({
|
|
statusCode: 400,
|
|
statusMessage: "Missing id in query",
|
|
});
|
|
|
|
await prisma.game.delete({
|
|
where: {
|
|
id: gameId,
|
|
},
|
|
});
|
|
|
|
return {};
|
|
});
|