The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update users.ts
Tom Heatone451495747ba
diff --git a/pages/api/projects/[slug]/users.ts b/pages/api/projects/[slug]/users.tsindex d1ff012e2e..2ea804b491 100644--- a/pages/api/projects/[slug]/users.ts+++ b/pages/api/projects/[slug]/users.ts@@ -32,6 +32,17 @@ export default withProjectAuth(async (req, res, project) => {if (!userId) {return res.status(400).end("Missing userId");}++ const usersCount = await prisma.projectUsers.count({+ where: {+ projectId: project.id,+ },+ });++ if (count === 1) {+ return res.status(400).end("Cannot remove only user");+ }+const response = await prisma.projectUsers.delete({where: {userId_projectId: {