fix: build webhooks and event-types

This commit is contained in:
Agusti Fernandez Pardo
2022-05-20 00:58:42 +02:00
parent 2e8f42c5d7
commit f2ce2f324b
6 changed files with 188 additions and 187 deletions
+11 -12
View File
@@ -40,19 +40,18 @@ async function getAllorCreateUser(
message: "No Users were found",
error,
});
} else if (method === "POST") {
const isAdmin = await prisma.user
.findUnique({ where: { id: userId } })
.then((user) => user?.role === "ADMIN");
if (!isAdmin) res.status(401).json({ message: "You are not authorized" });
else {
const user = await prisma.user.create({
data: schemaUserReadPublic.parse(body),
});
res.status(201).json({ user });
}
}
// else if (method === "POST") {
// const isAdmin = await prisma.user
// .findUnique({ where: { id: userId } })
// .then((user) => user?.role === "ADMIN");
// if (!isAdmin) res.status(401).json({ message: "You are not authorized" });
// else {
// const user = await prisma.user.create({
// data: schemaUserReadPublic.parse(body),
// });
// res.status(201).json({ user });
// }
// }
}
// No POST endpoint for users for now as a regular user you're expected to signup.