mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-21 20:21:10 +10:00
partial: user routes
This commit is contained in:
@ -2,16 +2,15 @@ import { APITokenMode } from "~/prisma/client/enums";
|
||||
import aclManager from "~/server/internal/acls";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
/**
|
||||
* Revoke token
|
||||
* @param id Token ID
|
||||
*/
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const userId = await aclManager.getUserIdACL(h3, []); // No ACLs only allows session authentication
|
||||
if (!userId) throw createError({ statusCode: 403 });
|
||||
|
||||
const id = h3.context.params?.id;
|
||||
if (!id)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "No id in router params",
|
||||
});
|
||||
const id = getRouterParam(h3, "id")!;
|
||||
|
||||
const deleted = await prisma.aPIToken.delete({
|
||||
where: { id: id, userId: userId, mode: APITokenMode.User },
|
||||
|
||||
Reference in New Issue
Block a user