mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-17 10:11:10 +10:00
feat: add ability to review and revoke clients
This commit is contained in:
17
server/api/v1/user/client/[id]/index.delete.ts
Normal file
17
server/api/v1/user/client/[id]/index.delete.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import clientHandler from "~/server/internal/clients/handler";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const userId = await aclManager.getUserIdACL(h3, ["clients:revoke"]);
|
||||
if (!userId) throw createError({ statusCode: 403 });
|
||||
|
||||
const clientId = getRouterParam(h3, "id");
|
||||
if (!clientId)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Client ID missing in route params",
|
||||
});
|
||||
|
||||
await clientHandler.removeClient(clientId);
|
||||
});
|
||||
Reference in New Issue
Block a user