Skip to content

The Open Source DocuSign Alternative.

fix: scope organisation group deletion (#3047)

David Nguyen1f170ef5e543
diff --git a/packages/lib/server-only/team/delete-team.ts b/packages/lib/server-only/team/delete-team.ts
index 182a004a0..b9393db84 100644
--- a/packages/lib/server-only/team/delete-team.ts
+++ b/packages/lib/server-only/team/delete-team.ts
@@ -85,6 +85,7 @@ export const deleteTeam = async ({ userId, teamId }: DeleteTeamOptions) => {
// Purge all internal organisation groups that have no teams.
await tx.organisationGroup.deleteMany({
where: {
+ organisationId: team.organisationId,
type: OrganisationGroupType.INTERNAL_TEAM,
teamGroups: {
none: {},