feat: beginnings of platform & redist management

This commit is contained in:
DecDuck
2025-08-27 19:52:36 +10:00
parent d323816b9e
commit ca7a89bbcf
17 changed files with 286 additions and 125 deletions

View File

@ -0,0 +1,19 @@
import aclManager from "~/server/internal/acls";
import prisma from "~/server/internal/db/database";
export default defineEventHandler(async (h3) => {
const allowed = await aclManager.allowSystemACL(h3, ["redist:delete"]);
if (!allowed) throw createError({ statusCode: 403 });
const id = getRouterParam(h3, "id")!;
const { count } = await prisma.redist.deleteMany({
where: {
id,
},
});
if (count == 0) throw createError({ statusCode: 404 });
return;
});

View File

@ -0,0 +1,16 @@
import aclManager from "~/server/internal/acls";
import prisma from "~/server/internal/db/database";
export default defineEventHandler(async (h3) => {
const allowed = await aclManager.allowSystemACL(h3, ["redist:read"]);
if (!allowed) throw createError({ statusCode: 403 });
return await prisma.redist.findMany({
select: {
id: true,
mName: true,
mShortDescription: true,
mIconObjectId: true,
},
});
});