fix: member filter fix (#19707)

This commit is contained in:
Anik Dhabal Babu
2025-03-04 12:45:27 +00:00
committed by GitHub
parent ae8180e7c2
commit a39b5e47a7
@@ -3,6 +3,7 @@
* Used for filtering people on /bookings.
*/
import type { PrismaClient } from "@calcom/prisma";
import { MembershipRole } from "@calcom/prisma/enums";
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
type ListSimpleMembersOptions = {
@@ -21,12 +22,20 @@ export const listSimpleMembers = async ({ ctx }: ListSimpleMembersOptions) => {
return [];
}
// query all teams the user is a member of
// query all teams the user is a member of and the team is not private
const teamsToQuery = (
await prisma.membership.findMany({
where: {
userId: ctx.user.id,
accepted: true,
NOT: [
{
role: MembershipRole.MEMBER,
team: {
isPrivate: true,
},
},
],
},
select: { teamId: true },
})