Skip to content

Scheduling infrastructure for absolutely everyone.

fix: delete organization user endpoint not working in api v2 (#21136)

Anwar Sadath37f271bd74be
diff --git a/apps/api/v2/src/modules/organizations/users/index/organizations-users.repository.ts b/apps/api/v2/src/modules/organizations/users/index/organizations-users.repository.ts
index fe10bdf9895..282af31bb42 100644
--- a/apps/api/v2/src/modules/organizations/users/index/organizations-users.repository.ts
+++ b/apps/api/v2/src/modules/organizations/users/index/organizations-users.repository.ts
@@ -141,7 +141,16 @@ export class OrganizationsUsersRepository {
return await this.dbWrite.prisma.user.delete({
where: {
id: userId,
- organizationId: orgId,
+ OR: [
+ { organizationId: orgId },
+ {
+ profiles: {
+ some: {
+ organizationId: orgId,
+ },
+ },
+ },
+ ],
},
include: {
profiles: {