Enforce a per-plan team limit when creating teams in cloud mode
This commit is contained in:
1 parent
889b2b7952
commit
bc97f9f439
4 files changed
+89
-18
No files matched your search
@@ -105,6 +105,17 @@ export async function getAllUserTeams(userId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function getUserOwnedTeamCount(userId: string) {
|
||||
return prisma.client.team.count({
|
||||
where: {
|
||||
deletedAt: null,
|
||||
members: {
|
||||
some: { userId, role: ROLES.teamOwner },
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function getTeamOwner(teamId: string) {
|
||||
return prisma.client.teamUser.findFirst({
|
||||
where: { teamId, role: ROLES.teamOwner },
|
||||
|
||||
Reference in new issue
Block a user