perf: pre-load booking data for all users (#11243)
* perf: pre-load booking data for all users * Fixing property issues * Fixes * Removed unwanted console.log * Made comment for intention of refactor more clear * fix: types * _count is optional * Assign to const bookings * Added mock for prisma booking * Fixed unit tests * Added lint ignore for prisma field * Update bookingScenario.ts * Fix linting --------- Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
1 parent
9fba8c548b
commit
84408025ed
5 files changed
+159
-43
No files matched your search
@@ -194,10 +194,17 @@ async function addBookings(bookings: InputBooking[], eventTypes: InputEventType[
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const statusIn = where.OR[0].status?.in || [];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const userIdIn = where.OR[0].userId?.in || [];
|
||||
const firstConditionMatches =
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
statusIn.includes(booking.status) && booking.userId === where.OR[0].userId;
|
||||
statusIn.includes(booking.status) &&
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
(booking.userId === where.OR[0].userId || userIdIn.includes(booking.userId));
|
||||
|
||||
// We return this booking if either condition is met
|
||||
return firstConditionMatches;
|
||||
|
||||
Reference in new issue
Block a user