🚑 Fix can invite new members in workspace bool

Closes #964
This commit is contained in:
Baptiste Arnaud
2023-10-25 17:57:13 +02:00
parent 4b248d554f
commit 53558dc303
6 changed files with 19 additions and 13 deletions

View File

@@ -36,9 +36,10 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
where: { workspaceId: workspace.id },
}),
])
const seatsLimit = getSeatsLimit(workspace)
if (
getSeatsLimit(workspace) <=
existingMembersCount + existingInvitationsCount
seatsLimit !== 'inf' &&
seatsLimit <= existingMembersCount + existingInvitationsCount
)
return res.status(400).send('Seats limit reached')
if (existingUser) {