perf: Insights - put teamId filter first (#16581)

This commit is contained in:
Keith Williams
2024-09-10 19:40:19 +00:00
committed by GitHub
parent c056cabbbd
commit be9b0fb9a8
@@ -209,18 +209,18 @@ export const insightsRouter = router({
whereConditional = {
...whereConditional,
OR: [
{
userId: {
in: userIdsFromOrg,
},
isTeamBooking: false,
},
{
teamId: {
in: [ctx.user.organizationId, ...teamsFromOrg.map((t) => t.id)],
},
isTeamBooking: true,
},
{
userId: {
in: userIdsFromOrg,
},
isTeamBooking: false,
},
],
};
}
@@ -436,18 +436,18 @@ export const insightsRouter = router({
whereConditional = {
OR: [
{
userId: {
in: userIdsFromOrg,
},
isTeamBooking: false,
},
{
teamId: {
in: [ctx.user.organizationId, ...teamsFromOrg.map((t) => t.id)],
},
isTeamBooking: true,
},
{
userId: {
in: userIdsFromOrg,
},
isTeamBooking: false,
},
],
};
}
@@ -614,18 +614,18 @@ export const insightsRouter = router({
bookingWhere = {
...bookingWhere,
OR: [
{
userId: {
in: userIdsFromOrg,
},
isTeamBooking: false,
},
{
teamId: {
in: [ctx.user.organizationId, ...teamsFromOrg.map((t) => t.id)],
},
isTeamBooking: true,
},
{
userId: {
in: userIdsFromOrg,
},
isTeamBooking: false,
},
],
};
}