Scheduling infrastructure for absolutely everyone.
feat: attach booker name/email to insights CSV (#17280)
Benny Joo402180169882
diff --git a/packages/features/insights/server/events.ts b/packages/features/insights/server/events.tsindex bdd0e2044c8..38d3bc78a3e 100644--- a/packages/features/insights/server/events.ts+++ b/packages/features/insights/server/events.ts@@ -207,7 +207,39 @@ class EventsInsights {where: whereConditional,});- return csvData;+ const csvDataWithBookerInfo = await Promise.all(+ csvData.map(async (bookingTimeStatus) => {+ if (!bookingTimeStatus.uid) {+ return bookingTimeStatus;+ }++ const booking = await prisma.booking.findUnique({+ where: { uid: bookingTimeStatus.uid },+ select: {+ attendees: {+ select: {+ name: true,+ email: true,+ },+ },+ },+ });++ if (!booking || !booking.attendees.length) {+ return bookingTimeStatus;+ }+ const { attendees } = booking;+ const booker = attendees[0];++ return {+ ...bookingTimeStatus,+ bookerEmail: booker.email,+ bookerName: booker.name,+ };+ })+ );++ return csvDataWithBookerInfo;};/*