mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 08:41:15 +10:00
game version re-ordering
This commit is contained in:
26
server/api/v1/admin/game/version.delete.ts
Normal file
26
server/api/v1/admin/game/version.delete.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const user = await h3.context.session.getAdminUser(h3);
|
||||
if (!user) throw createError({ statusCode: 403 });
|
||||
|
||||
const body = await readBody(h3);
|
||||
const gameId = body.id.toString();
|
||||
const version = body.versionName.toString();
|
||||
if (!gameId || !version)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Missing ID or versionName in body",
|
||||
});
|
||||
|
||||
await prisma.gameVersion.delete({
|
||||
where: {
|
||||
gameId_versionName: {
|
||||
gameId: gameId,
|
||||
versionName: version,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return {};
|
||||
});
|
||||
Reference in New Issue
Block a user