fix: _delete missing userId rename
parent
1889ececf8
commit
8b87cde733
|
@ -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 } });
|
||||||
|
|
Loading…
Reference in New Issue