fix: webhooks for managed event types (#10958)
Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Omar López <[email protected]>
This commit is contained in:
8 files changed
+36
-14
No files matched your search
@@ -22,8 +22,14 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
try {
|
||||
const where: Prisma.BookingWhereInput = {};
|
||||
if (validKey.teamId) where.eventType = { teamId: validKey.teamId };
|
||||
else where.userId = validKey.userId;
|
||||
if (validKey.teamId) {
|
||||
where.eventType = {
|
||||
OR: [{ teamId: validKey.teamId }, { parent: { teamId: validKey.teamId } }],
|
||||
};
|
||||
} else {
|
||||
where.userId = validKey.userId;
|
||||
}
|
||||
|
||||
const bookings = await prisma.booking.findMany({
|
||||
take: 3,
|
||||
where,
|
||||
|
||||
Reference in new issue
Block a user