partial: new documentation additions (company admin)

This commit is contained in:
DecDuck
2025-08-09 22:18:34 +10:00
parent 7af29ef0eb
commit ef7a62bf0b
15 changed files with 181 additions and 122 deletions

View File

@ -7,31 +7,37 @@ const GameDelete = type({
id: "string",
}).configure(throwingArktype);
export default defineEventHandler(async (h3) => {
const allowed = await aclManager.allowSystemACL(h3, ["company:update"]);
if (!allowed) throw createError({ statusCode: 403 });
/**
* Delete a game's association with a company
* @param id Company ID
*/
export default defineEventHandler<{ body: typeof GameDelete.infer }>(
async (h3) => {
const allowed = await aclManager.allowSystemACL(h3, ["company:update"]);
if (!allowed) throw createError({ statusCode: 403 });
const companyId = getRouterParam(h3, "id")!;
const companyId = getRouterParam(h3, "id")!;
const body = await readDropValidatedBody(h3, GameDelete);
const body = await readDropValidatedBody(h3, GameDelete);
await prisma.game.update({
where: {
id: body.id,
},
data: {
publishers: {
disconnect: {
id: companyId,
await prisma.game.update({
where: {
id: body.id,
},
data: {
publishers: {
disconnect: {
id: companyId,
},
},
developers: {
disconnect: {
id: companyId,
},
},
},
developers: {
disconnect: {
id: companyId,
},
},
},
});
});
return;
});
return;
},
);