feat: Org owners should be able to see all bookings in bookings tab. (#15314)
* feat: Org owners should be able to see all bookings in bookings tab. * perf: optimize the query * perf: make it a separate query --------- Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Omar López <zomars@me.com>
This commit is contained in:
co-authored by
Alex van Andel
Omar López
parent
a4d733fb9d
commit
06ec89e787
@@ -289,6 +289,7 @@ export async function getBookings({
|
||||
bookingsQueryUserId,
|
||||
bookingsQueryAttendees,
|
||||
bookingsQueryTeamMember,
|
||||
bookingsQueryOrganizationMembers,
|
||||
bookingsQuerySeatReference,
|
||||
//////////////////////////
|
||||
|
||||
@@ -350,6 +351,35 @@ export async function getBookings({
|
||||
take: take + 1,
|
||||
skip,
|
||||
}),
|
||||
prisma.booking.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
user: {
|
||||
teams: {
|
||||
some: {
|
||||
team: {
|
||||
isOrganization: true,
|
||||
members: {
|
||||
some: {
|
||||
userId: user.id,
|
||||
role: {
|
||||
in: ["ADMIN", "OWNER"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
AND: [passedBookingsStatusFilter, ...filtersCombined],
|
||||
},
|
||||
orderBy,
|
||||
take: take + 1,
|
||||
skip,
|
||||
}),
|
||||
prisma.booking.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
@@ -434,6 +464,7 @@ export async function getBookings({
|
||||
bookingsQueryUserId
|
||||
.concat(bookingsQueryAttendees)
|
||||
.concat(bookingsQueryTeamMember)
|
||||
.concat(bookingsQueryOrganizationMembers)
|
||||
.concat(bookingsQuerySeatReference)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user