Add guest management functionality to existing bookings#2
Conversation
* feat: ability to add guests via app.cal.com/bookings * fix: some update * fix: minor issue * fix: final update * update * update * add requested changes * fix type error * small update * final update * fix type error * fix location * update calender event --------- Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>
Codoki PR ReviewSummary: Tighten guests schema validation, prevent duplicates Issues (Critical & High only)
Showing top 3 issues. Critical: 0, High: 3. See inline suggestions for more. Key Feedback (click to expand)
Confidence: 2/5 — Not ready to merge (3 high · status: Requires changes) React with 👍 or 👎 if you found this review useful. |
|
|
||
| if (!booking) throw new TRPCError({ code: "NOT_FOUND", message: "booking_not_found" }); | ||
|
|
||
| const isTeamAdminOrOwner = |
There was a problem hiding this comment.
| const isTeamAdminOrOwner = | |
| ```suggestion | |
| const isTeamAdminOrOwner = | |
| (await isTeamAdmin(user.id, booking.eventType?.teamId ?? 0)) || | |
| (await isTeamOwner(user.id, booking.eventType?.teamId ?? 0)); |
| }; | ||
| } | ||
|
|
||
| const credentials = await getUsersCredentials(ctx.user); |
There was a problem hiding this comment.
| const credentials = await getUsersCredentials(ctx.user); | |
| ```suggestion | |
| const credentials = await getUsersCredentials(booking.user); | |
| const eventManager = new EventManager({ | |
| ...booking.user, | |
| credentials: [...credentials], | |
| }); |
| await eventManager.updateCalendarAttendees(evt, booking); | ||
|
|
||
| try { | ||
| await sendAddGuestsEmails(evt, guests); |
There was a problem hiding this comment.
| await sendAddGuestsEmails(evt, guests); | |
| ```suggestion | |
| await sendAddGuestsEmails(evt, uniqueGuests); |
| @@ -0,0 +1,8 @@ | |||
| import { z } from "zod"; | |||
|
|
|||
| export const ZAddGuestsInputSchema = z.object({ | |||
There was a problem hiding this comment.
🔷 Medium: The schema allows any number (including non-integers) for bookingId and accepts an empty guests array and duplicate emails with differing cases/whitespace. This can cause duplicate invitations and ambiguous server behavior. Normalize, enforce uniqueness, require at least one guest, and constrain bookingId to a positive integer.
No description provided.