Enforce a per-plan team limit when creating teams in cloud mode

This commit is contained in:
Mike Cao committed 2026-07-18 01:35:13 -07:00
1 parent 889b2b7952
commit bc97f9f439
4 files changed
+89 -18

No files matched your search

+11
View File
@@ -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 },