fix: _delete missing userId rename

pull/9078/head
Agusti Fernandez Pardo 2022-06-16 01:48:29 +02:00
parent 1889ececf8
commit 8b87cde733
1 changed files with 1 additions and 1 deletions

View File

@ -38,7 +38,7 @@ export async function deleteHandler(req: NextApiRequest) {
if (!isAdmin && query.userId !== req.userId) if (!isAdmin && query.userId !== req.userId)
throw new HttpError({ statusCode: 401, message: "Unauthorized" }); throw new HttpError({ statusCode: 401, message: "Unauthorized" });
const user = await prisma.user.findUnique({ where: { id: query.id } }); const user = await prisma.user.findUnique({ where: { id: query.userId } });
if (!user) throw new HttpError({ statusCode: 404, message: "User not found" }); if (!user) throw new HttpError({ statusCode: 404, message: "User not found" });
await prisma.user.delete({ where: { id: user.id } }); await prisma.user.delete({ where: { id: user.id } });